diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0f5f3379..484a6be0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,13 +15,30 @@ + + + - + + + + + + + + + + + + + + + + + - - @@ -43,20 +60,25 @@ - - + + - + - - - - - + + + + + + + + + + @@ -65,8 +87,8 @@ - - + + @@ -75,6 +97,18 @@ + + + + + + + + + + + + @@ -86,11 +120,6 @@ - loadUrl - showWebPage - InAppBrowserClient - LOG. - preferences getPre client webView @@ -116,6 +145,11 @@ presentationStyle ### inAppBrowserFallback + target + .assets + _blank + .html + close( activity.getPreferences(0) @@ -142,7 +176,6 @@ - @@ -171,6 +210,18 @@ + + + + + + + + + - - @@ -224,12 +280,13 @@ - - - + + + + - + @@ -372,22 +429,22 @@ - + - + - - + + - + @@ -396,13 +453,12 @@ - + - @@ -414,25 +470,29 @@ + - - + - + + + + @@ -442,21 +502,6 @@ - - - - - - - - - - - - - - - @@ -584,13 +629,6 @@ - - - - - - - @@ -647,30 +685,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -692,39 +706,92 @@ - + + + + + + - - - - - + + + + + + + + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d4ca94..52acf4d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 0.4.0 + +- removed `target` parameter to `InAppBrowser.open()` method. To open the url on the system browser, use the `openWithSystemBrowser: true` option +- fixes for the `_ChannelManager` private class +- fixed `EXC_BAD_INSTRUCTION` onLoadStart in Swift +- added `openWithSystemBrowser` and `isLocalFile` options +- added `InAppBrowser.openWithSystemBrowser` method +- added `InAppBrowser.openOnLocalhost` method +- added `InAppBrowser.loadFile` method + ## 0.3.2 - fixed WebView.storyboard path for iOS diff --git a/README.md b/README.md index faaa1f41..5fa05458 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ class MyInAppBrowser extends InAppBrowser { await this.injectScriptCode("console.log({'testObject': 5});"); // the message will be: [object Object] await this.injectScriptCode("console.log('testObjectStringify', JSON.stringify({'testObject': 5}));"); // the message will be: testObjectStringify {"testObject": 5} await this.injectScriptCode("console.error('testError', false);"); // the message will be: testError false - + // add jquery library and custom javascript await this.injectScriptFile("https://code.jquery.com/jquery-3.3.1.min.js"); this.injectScriptCode(""" \$( "body" ).html( "Next Step..." ) """); - + // add custom css this.injectStyleCode(""" body { @@ -81,7 +81,7 @@ class MyInAppBrowser extends InAppBrowser { void onExit() { print("\n\nBrowser closed!\n\n"); } - + @override void shouldOverrideUrlLoading(String url) { print("\n\n override $url\n\n"); @@ -136,8 +136,8 @@ class _MyAppState extends State { title: const Text('Flutter InAppBrowser Plugin example app'), ), body: new Center( - child: new RaisedButton(onPressed: () { - inAppBrowser.open(url: "https://flutter.io/", options: { + child: new RaisedButton(onPressed: () async { + await inAppBrowser.open(url: "https://flutter.io/", options: { "useShouldOverrideUrlLoading": true, "useOnLoadResource": true }); @@ -155,8 +155,10 @@ class _MyAppState extends State { Opens a URL in a new InAppBrowser instance or the system browser. +**NOTE**: If you open the given `url` with the system browser (`openWithSystemBrowser: true`), you wont be able to use the `InAppBrowser` methods! + ```dart -inAppBrowser.open({String url = "about:blank", Map headers = const {}, String target = "_self", Map options = const {}}); +inAppBrowser.open({String url = "about:blank", Map headers = const {}, Map options = const {}}); ``` Opens an `url` in a new `InAppBrowser` instance or the system browser. @@ -165,17 +167,13 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser. - `headers`: The additional headers to be used in the HTTP request for this URL, specified as a map from name to value. -- `target`: The target in which to load the `url`, an optional parameter that defaults to `_self`. - - - `_self`: Opens in the `InAppBrowser`. - - `_blank`: Opens in the `InAppBrowser`. - - `_system`: Opens in the system's web browser. - - `options`: Options for the `InAppBrowser`. All platforms support: - __useShouldOverrideUrlLoading__: Set to `true` to be able to listen at the `shouldOverrideUrlLoading` event. The default value is `false`. - __useOnLoadResource__: Set to `true` to be able to listen at the `onLoadResource()` event. The default value is `false`. + - __openWithSystemBrowser__: Set to `true` to open the given `url` with the system browser. The default value is `false`. + - __isLocalFile__: Set to `true` if the `url` is pointing to a local file (the file must be addded in the `assets` section of your `pubspec.yaml`. See `loadFile()` explanation). The default value is `false`. - __clearCache__: Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`. - __userAgent___: Set the custom WebView's user-agent. - __javaScriptEnabled__: Set to `true` to enable JavaScript. The default value is `true`. @@ -185,9 +183,9 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser. - __toolbarTopBackgroundColor__: Set the custom background color of the toolbat at the top. - __hideUrlBar__: Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`. - __mediaPlaybackRequiresUserGesture__: Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`. - + **Android** supports these additional options: - + - __hideTitleBar__: Set to `true` if you want the title should be displayed. The default value is `false`. - __closeOnCannotGoBack__: Set to `false` to not close the InAppBrowser when the user click on the back button and the WebView cannot go back to the history. The default value is `true`. - __clearSessionCache__: Set to `true` to have the session cookie cache cleared before the new window is opened. @@ -200,14 +198,14 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser. - __progressBar__: Set to `false` to hide the progress bar at the bottom of the toolbar at the top. The default value is `true`. **iOS** supports these additional options: - + - __disallowOverScroll__: 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`. - __toolbarBottom__: Set to `false` to hide the toolbar at the bottom of the WebView. The default value is `true`. - __toolbarBottomBackgroundColor__: Set the custom background color of the toolbat at the bottom. - __toolbarBottomTranslucent__: Set to `true` to set the toolbar at the bottom translucent. The default value is `true`. - __closeButtonCaption__: Set the custom text for the close button. - __closeButtonColor__: Set the custom color for the close button. - - __presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles. + - __presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles. - __transitionStyle__: Set to the custom transition style when presenting the WebView. The default value is `0 //crossDissolve`. See [UIModalTransitionStyle](https://developer.apple.com/documentation/uikit/uimodaltransitionStyle) for all the available styles. - __enableViewportScale__: Set to `true` to allow a viewport meta tag to either disable or restrict the range of user scaling. The default value is `false`. - __suppressesIncrementalRendering__: Set to `true` if you want the WebView suppresses content rendering until it is fully loaded into memory.. The default value is `false`. @@ -218,7 +216,7 @@ Opens an `url` in a new `InAppBrowser` instance or the system browser. - __allowsInlineMediaPlayback__: 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 `