updated code docs
This commit is contained in:
parent
352dd02525
commit
6c5e314795
|
@ -15,14 +15,12 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/FlutterWebViewController.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/FlutterWebViewController.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebViewOptions.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebViewOptions.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/in_app_browser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_browser.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/in_app_webview.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_webview.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/webview_options.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/webview_options.dart" afterDir="false" />
|
||||
</list>
|
||||
|
@ -47,8 +45,20 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="143">
|
||||
<caret line="336" column="42" selection-start-line="336" selection-start-column="42" selection-end-line="336" selection-end-column="42" />
|
||||
<state relative-caret-position="593">
|
||||
<caret line="45" column="536" lean-forward="true" selection-start-line="45" selection-start-column="28" selection-end-line="45" selection-end-column="536" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="418">
|
||||
<caret line="295" column="33" lean-forward="true" selection-start-line="295" selection-start-column="33" selection-end-line="295" selection-end-column="33" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -59,8 +69,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="520">
|
||||
<caret line="511" column="30" selection-start-line="511" selection-start-column="7" selection-end-line="511" selection-end-column="30" />
|
||||
<state relative-caret-position="393">
|
||||
<caret line="67" column="212" lean-forward="true" selection-start-line="67" selection-start-column="38" selection-end-line="67" selection-end-column="212" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -71,8 +81,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="332">
|
||||
<caret line="482" column="6" selection-start-line="482" selection-start-column="6" selection-end-line="482" selection-end-column="6" />
|
||||
<state relative-caret-position="227">
|
||||
<caret line="598" column="42" selection-start-line="598" selection-start-column="6" selection-end-line="598" selection-end-column="42" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -80,18 +90,6 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-250">
|
||||
<caret line="347" column="93" selection-start-line="347" selection-start-column="93" selection-end-line="347" selection-end-column="93" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
|
@ -113,7 +111,7 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="207">
|
||||
<state relative-caret-position="4275">
|
||||
<caret line="295" column="18" selection-start-line="295" selection-start-column="18" selection-end-line="295" selection-end-column="18" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
|
@ -125,8 +123,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="173">
|
||||
<caret line="16" column="681" selection-start-line="16" selection-start-column="661" selection-end-line="16" selection-end-column="681" />
|
||||
<state relative-caret-position="248">
|
||||
<caret line="21" column="54" lean-forward="true" selection-start-line="21" selection-start-column="54" selection-end-line="21" selection-end-column="54" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -143,19 +141,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>injectScriptUrlFile</find>
|
||||
<find>[InAppWebView] window</find>
|
||||
<find>javaScriptEnabled</find>
|
||||
<find>onLoadRes</find>
|
||||
<find>onLoadResource</find>
|
||||
<find>onLoadResource"</find>
|
||||
<find>javaScriptHandlersMap</find>
|
||||
<find>javaScriptHandlers</find>
|
||||
<find>onAjaxSend</find>
|
||||
<find>Action</find>
|
||||
<find>AjaxRequestEventType</find>
|
||||
<find>onAjax</find>
|
||||
<find>onAjaxReadyStateChange</find>
|
||||
<find>onAjaxEvent</find>
|
||||
<find>shouldInterceptAjaxRequest</find>
|
||||
<find>onAjaxProgress</find>
|
||||
|
@ -173,6 +158,19 @@
|
|||
<find>cache</find>
|
||||
<find>customScheme</find>
|
||||
<find>transparentBackground</find>
|
||||
<find>ClientCertResponse</find>
|
||||
<find>shouldO</find>
|
||||
<find>useShouldOverrideUrlLoading</find>
|
||||
<find>**NOTE**: In order to be able to li</find>
|
||||
<find>XMLHttpRequest</find>
|
||||
<find>nDownloadStart</find>
|
||||
<find>ServerTrustAuthResponse</find>
|
||||
<find>onDow</find>
|
||||
<find>InAppWebViewUserPreferredContentMode</find>
|
||||
<find>verticalScrollBarEnabled</find>
|
||||
<find>mixedContentMode</find>
|
||||
<find>eWideViewPort</find>
|
||||
<find>initialScale</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -242,17 +240,17 @@
|
|||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
|
||||
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1920" />
|
||||
<option name="height" value="1057" />
|
||||
|
@ -263,17 +261,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -311,7 +298,6 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="AndroidView">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -341,6 +327,18 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -491,7 +489,7 @@
|
|||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1920" height="1057" extended-state="6" />
|
||||
<frame x="0" y="23" width="1920" height="1057" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.6529745" visible="true" weight="0.15867944" />
|
||||
|
@ -505,7 +503,7 @@
|
|||
<window_info id="Resources Explorer" order="8" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49574015" visible="true" weight="0.29326424" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.59792745" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.34196892" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
|
@ -513,7 +511,7 @@
|
|||
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.50692225" side_tool="true" weight="0.38445595" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" weight="0.32953367" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" weight="0.3896373" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.22487047" />
|
||||
<window_info anchor="bottom" id="Messages" order="11" weight="0.3253886" />
|
||||
<window_info anchor="bottom" id="Dependency Viewer" order="12" weight="0.32800853" />
|
||||
<window_info anchor="bottom" id="Logcat" order="13" weight="0.32953367" />
|
||||
|
@ -758,27 +756,37 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="173">
|
||||
<caret line="16" column="681" selection-start-line="16" selection-start-column="661" selection-end-line="16" selection-end-column="681" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="520">
|
||||
<caret line="511" column="30" selection-start-line="511" selection-start-column="7" selection-end-line="511" selection-end-column="30" />
|
||||
<state relative-caret-position="4275">
|
||||
<caret line="295" column="18" selection-start-line="295" selection-start-column="18" selection-end-line="295" selection-end-column="18" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="207">
|
||||
<caret line="295" column="18" selection-start-line="295" selection-start-column="18" selection-end-line="295" selection-end-column="18" />
|
||||
<state relative-caret-position="248">
|
||||
<caret line="21" column="54" lean-forward="true" selection-start-line="21" selection-start-column="54" selection-end-line="21" selection-end-column="54" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="393">
|
||||
<caret line="67" column="212" lean-forward="true" selection-start-line="67" selection-start-column="38" selection-end-line="67" selection-end-column="212" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="227">
|
||||
<caret line="598" column="42" selection-start-line="598" selection-start-column="6" selection-end-line="598" selection-end-column="42" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -787,28 +795,18 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="143">
|
||||
<caret line="336" column="42" selection-start-line="336" selection-start-column="42" selection-end-line="336" selection-end-column="42" />
|
||||
<state relative-caret-position="593">
|
||||
<caret line="45" column="536" lean-forward="true" selection-start-line="45" selection-start-column="28" selection-end-line="45" selection-end-column="536" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="332">
|
||||
<caret line="482" column="6" selection-start-line="482" selection-start-column="6" selection-end-line="482" selection-end-column="6" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-250">
|
||||
<caret line="347" column="93" selection-start-line="347" selection-start-column="93" selection-end-line="347" selection-end-column="93" />
|
||||
<state relative-caret-position="418">
|
||||
<caret line="295" column="33" lean-forward="true" selection-start-line="295" selection-start-column="33" selection-end-line="295" selection-end-column="33" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
- Merge "Fix abstract method error && swift version error" [#155](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/155) (thanks to [AlexVincent525](https://github.com/AlexVincent525))
|
||||
- Merge "migrating to swift 5.0" [#162](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/162) (thanks to [fattiger00](https://github.com/fattiger00))
|
||||
- Merge "Update readme example" [#178](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/178) (thanks to [SebastienBtr](https://github.com/SebastienBtr))
|
||||
- Merge "handle choose file callback in android" [#183](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/183) (thanks to [crazecoder](https://github.com/crazecoder))
|
||||
- Merge "add initialScale in android" [#186](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/186) (thanks to [crazecoder](https://github.com/crazecoder))
|
||||
- Added `horizontalScrollBarEnabled` and `verticalScrollBarEnabled` options to enable/disable the corresponding scrollbar of the WebView [#165](https://github.com/pichillilorenzo/flutter_inappbrowser/issues/165)
|
||||
- Added `onDownloadStart` event and `useOnDownloadStart` option: event fires when the WebView recognizes and starts a downloadable file.
|
||||
- Added `onLoadResourceCustomScheme` event and `resourceCustomSchemes` option to set custom schemes that WebView must handle to load resources
|
||||
|
|
|
@ -560,9 +560,7 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
settings.setLoadsImagesAutomatically(options.loadsImagesAutomatically);
|
||||
settings.setMinimumFontSize(options.minimumFontSize);
|
||||
settings.setMinimumLogicalFontSize(options.minimumLogicalFontSize);
|
||||
if(options.initialScale != null)
|
||||
setInitialScale(options.initialScale);
|
||||
|
||||
setInitialScale(options.initialScale);
|
||||
settings.setNeedInitialFocus(options.needInitialFocus);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
settings.setOffscreenPreRaster(options.offscreenPreRaster);
|
||||
|
@ -575,9 +573,8 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
setDesktopMode(true);
|
||||
break;
|
||||
case MOBILE:
|
||||
setDesktopMode(false);
|
||||
break;
|
||||
case RECOMMENDED:
|
||||
setDesktopMode(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -985,6 +982,18 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
if (newOptionsMap.get("standardFontFamily") != null && !options.standardFontFamily.equals(newOptions.standardFontFamily))
|
||||
settings.setStandardFontFamily(newOptions.standardFontFamily);
|
||||
|
||||
if (newOptionsMap.get("preferredContentMode") != null && !options.preferredContentMode.equals(newOptions.preferredContentMode)) {
|
||||
switch (fromValue(newOptions.preferredContentMode)) {
|
||||
case DESKTOP:
|
||||
setDesktopMode(true);
|
||||
break;
|
||||
case MOBILE:
|
||||
case RECOMMENDED:
|
||||
setDesktopMode(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newOptionsMap.get("saveFormData") != null && options.saveFormData != newOptions.saveFormData)
|
||||
settings.setSaveFormData(newOptions.saveFormData);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ import com.pichillilorenzo.flutter_inappbrowser.Util;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
|
@ -563,14 +565,21 @@ public class InAppWebViewClient extends WebViewClient {
|
|||
});
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, final String url) {
|
||||
|
||||
final InAppWebView webView = (InAppWebView) view;
|
||||
|
||||
final String url = request.getUrl().toString();
|
||||
String scheme = request.getUrl().getScheme();
|
||||
URI uri;
|
||||
try {
|
||||
uri = new URI(url);
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(LOG_TAG, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
String scheme = uri.getScheme();
|
||||
|
||||
if (webView.options.resourceCustomSchemes != null && webView.options.resourceCustomSchemes.contains(scheme)) {
|
||||
final Map<String, Object> obj = new HashMap<>();
|
||||
|
@ -619,6 +628,13 @@ public class InAppWebViewClient extends WebViewClient {
|
|||
return response;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
||||
String url = request.getUrl().toString();
|
||||
return shouldInterceptRequest(view, url);
|
||||
}
|
||||
|
||||
private MethodChannel getChannel() {
|
||||
return (inAppBrowserActivity != null) ? InAppBrowserFlutterPlugin.inAppBrowser.channel : flutterWebView.channel;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ public class InAppWebViewOptions extends Options {
|
|||
public Boolean debuggingEnabled = false;
|
||||
public Boolean javaScriptCanOpenWindowsAutomatically = false;
|
||||
public Boolean mediaPlaybackRequiresUserGesture = true;
|
||||
public Integer textZoom = 100;
|
||||
public Integer minimumFontSize = 8;
|
||||
public Boolean verticalScrollBarEnabled = true;
|
||||
public Boolean horizontalScrollBarEnabled = true;
|
||||
|
@ -36,6 +35,7 @@ public class InAppWebViewOptions extends Options {
|
|||
public Boolean cacheEnabled = true;
|
||||
public Boolean transparentBackground = false;
|
||||
|
||||
public Integer textZoom = 100;
|
||||
public Boolean clearSessionCache = false;
|
||||
public Boolean builtInZoomControls = false;
|
||||
public Boolean displayZoomControls = false;
|
||||
|
@ -66,7 +66,7 @@ public class InAppWebViewOptions extends Options {
|
|||
public Boolean loadWithOverviewMode = true;
|
||||
public Boolean loadsImagesAutomatically = true;
|
||||
public Integer minimumLogicalFontSize = 8;
|
||||
public Integer initialScale;
|
||||
public Integer initialScale = 0;
|
||||
public Boolean needInitialFocus = true;
|
||||
public Boolean offscreenPreRaster = false;
|
||||
public String sansSerifFontFamily = "sans-serif";
|
||||
|
|
|
@ -362,14 +362,14 @@ class InAppBrowser {
|
|||
|
||||
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`.
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldOverrideUrlLoading] option to `true`.
|
||||
void shouldOverrideUrlLoading(String url) {
|
||||
|
||||
}
|
||||
|
||||
///Event fires when the [InAppBrowser] webview loads a resource.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`.
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
|
||||
void onLoadResource(LoadedResource resource) {
|
||||
|
||||
}
|
||||
|
@ -386,6 +386,8 @@ class InAppBrowser {
|
|||
///Event fires when [InAppBrowser] recognizes and starts a downloadable file.
|
||||
///
|
||||
///[url] represents the url of the file.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnDownloadStart] option to `true`.
|
||||
void onDownloadStart(String url) {
|
||||
|
||||
}
|
||||
|
@ -402,6 +404,8 @@ class InAppBrowser {
|
|||
///Event fires when the [InAppBrowser] webview tries to open a link with `target="_blank"`.
|
||||
///
|
||||
///[url] represents the url of the link.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnTargetBlank] option to `true`.
|
||||
void onTargetBlank(String url) {
|
||||
|
||||
}
|
||||
|
@ -454,19 +458,27 @@ class InAppBrowser {
|
|||
|
||||
}
|
||||
|
||||
///Event fires when a WebView received an HTTP authentication request. The default behavior is to cancel the request.
|
||||
///Event fires when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the auth challenge.
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [HttpAuthChallenge].
|
||||
Future<HttpAuthResponse> onReceivedHttpAuthRequest(HttpAuthChallenge challenge) {
|
||||
|
||||
}
|
||||
|
||||
///Event fires when the WebView need to perform server trust authentication (certificate validation).
|
||||
///The host application must return either [ServerTrustAuthResponse.CANCEL] or [ServerTrustAuthResponse.PROCEED].
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge].
|
||||
Future<ServerTrustAuthResponse> onReceivedServerTrustAuthRequest(ServerTrustChallenge challenge) {
|
||||
|
||||
}
|
||||
|
||||
///Notify the host application to handle a SSL client certificate request.
|
||||
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
|
||||
///is called and does not call [onReceivedClientCertRequest] again for the same host and port pair.
|
||||
///Note that, multiple layers in chromium network stack might be caching the responses.
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
|
||||
Future<ClientCertResponse> onReceivedClientCertRequest(ClientCertChallenge challenge) {
|
||||
|
||||
}
|
||||
|
@ -483,22 +495,42 @@ class InAppBrowser {
|
|||
|
||||
}
|
||||
|
||||
///Event fired when an `XMLHttpRequest` is sent to a server.
|
||||
///It gives the host application a chance to take control over the request before sending it.
|
||||
///
|
||||
///[ajaxRequest] represents the `XMLHttpRequest`.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
Future<AjaxRequest> shouldInterceptAjaxRequest(AjaxRequest ajaxRequest) {
|
||||
|
||||
}
|
||||
|
||||
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
|
||||
///It gives the host application a chance to abort the request.
|
||||
///
|
||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
Future<AjaxRequestAction> onAjaxReadyStateChange(AjaxRequest ajaxRequest) {
|
||||
|
||||
}
|
||||
|
||||
///Event fired as an `XMLHttpRequest` progress.
|
||||
///It gives the host application a chance to abort the request.
|
||||
///
|
||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
Future<AjaxRequestAction> onAjaxProgress(AjaxRequest ajaxRequest) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
///Event fired when an request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
|
||||
///It gives the host application a chance to take control over the request before sending it.
|
||||
///
|
||||
///[fetchRequest] represents a resource request.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
|
||||
Future<FetchRequest> shouldInterceptFetchRequest(FetchRequest fetchRequest) {
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ const javaScriptHandlerForbiddenNames = ["onLoadResource", "shouldInterceptAjaxR
|
|||
/// - __builtInZoomControls__: Set to `true` if the WebView should use its built-in zoom mechanisms. The default value is `false`.
|
||||
/// - __displayZoomControls__: Set to `true` if the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. The default value is `false`.
|
||||
/// - __supportZoom__: Set to `false` if the WebView should not support zooming using its on-screen zoom controls and gestures. The default value is `true`.
|
||||
/// - __databaseEnabled__: Set to `true` if you want injectScriptFilethe database storage API is enabled. The default value is `false`.
|
||||
/// - __databaseEnabled__: Set to `true` if you want the database storage API is enabled. The default value is `false`.
|
||||
/// - __domStorageEnabled__: Set to `true` if you want the DOM storage API is enabled. The default value is `false`.
|
||||
/// - __useWideViewPort__: Set to `true` if the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. The default value is `true`.
|
||||
/// - __safeBrowsingEnabled__: Set to `true` if you want the Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links. The default value is `true`.
|
||||
|
@ -81,14 +81,12 @@ class InAppWebView extends StatefulWidget {
|
|||
|
||||
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`.
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldOverrideUrlLoading] option to `true`.
|
||||
final void Function(InAppWebViewController controller, String url) shouldOverrideUrlLoading;
|
||||
|
||||
///Event fires when the [InAppWebView] loads a resource.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`.
|
||||
///
|
||||
///**NOTE only for Android**: to be able to listen this event, you need also the enable javascript.
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
|
||||
final void Function(InAppWebViewController controller, LoadedResource resource) onLoadResource;
|
||||
|
||||
///Event fires when the [InAppWebView] scrolls.
|
||||
|
@ -101,6 +99,8 @@ class InAppWebView extends StatefulWidget {
|
|||
///Event fires when [InAppWebView] recognizes and starts a downloadable file.
|
||||
///
|
||||
///[url] represents the url of the file.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnDownloadStart] option to `true`.
|
||||
final void Function(InAppWebViewController controller, String url) onDownloadStart;
|
||||
|
||||
///Event fires when the [InAppWebView] 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`.
|
||||
|
@ -113,6 +113,8 @@ class InAppWebView extends StatefulWidget {
|
|||
///Event fires when the [InAppWebView] tries to open a link with `target="_blank"`.
|
||||
///
|
||||
///[url] represents the url of the link.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnTargetBlank] option to `true`.
|
||||
final void Function(InAppWebViewController controller, String url) onTargetBlank;
|
||||
|
||||
///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
|
||||
|
@ -154,15 +156,23 @@ class InAppWebView extends StatefulWidget {
|
|||
///**NOTE**: available only for Android.
|
||||
final Future<SafeBrowsingResponse> Function(InAppWebViewController controller, String url, SafeBrowsingThreat threatType) onSafeBrowsingHit;
|
||||
|
||||
///Event fires when a WebView received an HTTP authentication request. The default behavior is to cancel the request.
|
||||
///Event fires when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the auth challenge.
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [HttpAuthChallenge].
|
||||
final Future<HttpAuthResponse> Function(InAppWebViewController controller, HttpAuthChallenge challenge) onReceivedHttpAuthRequest;
|
||||
|
||||
///Event fires when the WebView need to perform server trust authentication (certificate validation).
|
||||
///The host application must return either [ServerTrustAuthResponse.CANCEL] or [ServerTrustAuthResponse.PROCEED].
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge].
|
||||
final Future<ServerTrustAuthResponse> Function(InAppWebViewController controller, ServerTrustChallenge challenge) onReceivedServerTrustAuthRequest;
|
||||
|
||||
///Notify the host application to handle a SSL client certificate request.
|
||||
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
|
||||
///is called and does not call [onReceivedClientCertRequest] again for the same host and port pair.
|
||||
///Note that, multiple layers in chromium network stack might be caching the responses.
|
||||
///
|
||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
|
||||
final Future<ClientCertResponse> Function(InAppWebViewController controller, ClientCertChallenge challenge) onReceivedClientCertRequest;
|
||||
|
||||
///Event fired as find-on-page operations progress.
|
||||
|
@ -175,16 +185,36 @@ class InAppWebView extends StatefulWidget {
|
|||
///[isDoneCounting] whether the find operation has actually completed.
|
||||
final void Function(InAppWebViewController controller, int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) onFindResultReceived;
|
||||
|
||||
///Event fired when an `XMLHttpRequest` is sent to a server.
|
||||
///It gives the host application a chance to take control over the request before sending it.
|
||||
///
|
||||
///[ajaxRequest] represents the `XMLHttpRequest`.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
final Future<AjaxRequest> Function(InAppWebViewController controller, AjaxRequest ajaxRequest) shouldInterceptAjaxRequest;
|
||||
|
||||
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
|
||||
///It gives the host application a chance to abort the request.
|
||||
///
|
||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
final Future<AjaxRequestAction> Function(InAppWebViewController controller, AjaxRequest ajaxRequest) onAjaxReadyStateChange;
|
||||
|
||||
///Event fired as an `XMLHttpRequest` progress.
|
||||
///It gives the host application a chance to abort the request.
|
||||
///
|
||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||
final Future<AjaxRequestAction> Function(InAppWebViewController controller, AjaxRequest ajaxRequest) onAjaxProgress;
|
||||
|
||||
///Event fired when an request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
|
||||
///It gives the host application a chance to take control over the request before sending it.
|
||||
///
|
||||
///[fetchRequest] represents a resource request.
|
||||
///
|
||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
|
||||
final Future<FetchRequest> Function(InAppWebViewController controller, FetchRequest fetchRequest) shouldInterceptFetchRequest;
|
||||
|
||||
///Event fired when the navigation state of the [InAppWebView] changes throught the usage of
|
||||
|
|
|
@ -36,34 +36,69 @@ class ChromeSafariBrowserOptions {
|
|||
}
|
||||
}
|
||||
|
||||
///This class represents all the cross-platform WebView options available.
|
||||
class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions, IosOptions {
|
||||
///Set to `true` to be able to listen at the [shouldOverrideUrlLoading] event. The default value is `false`.
|
||||
bool useShouldOverrideUrlLoading;
|
||||
///Set to `true` to be able to listen at the [onLoadResource] event. The default value is `false`.
|
||||
bool useOnLoadResource;
|
||||
///Set to `true` to be able to listen at the [onDownloadStart] event. The default value is `false`.
|
||||
bool useOnDownloadStart;
|
||||
///Set to `true` to be able to listen at the [onTargetBlank] event. The default value is `false`.
|
||||
bool useOnTargetBlank;
|
||||
///Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`.
|
||||
bool clearCache;
|
||||
///Sets the user-agent for the WebView.
|
||||
///
|
||||
///**NOTE**: available on iOS 9.0+.
|
||||
String userAgent;
|
||||
///Append to the existing user-agent. Setting userAgent will override this.
|
||||
///
|
||||
///**NOTE**: available on Android 17+ and on iOS 9.0+.
|
||||
String applicationNameForUserAgent;
|
||||
///Set to `true` to enable JavaScript. The default value is `true`.
|
||||
bool javaScriptEnabled;
|
||||
///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. The default is `false`.
|
||||
///
|
||||
///**NOTE**: on iOS the debugging mode is always enabled.
|
||||
bool debuggingEnabled;
|
||||
///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`.
|
||||
bool mediaPlaybackRequiresUserGesture;
|
||||
int textZoom;
|
||||
///Sets the minimum font size. The default value is `8` for Android, `0` for iOS.
|
||||
int minimumFontSize;
|
||||
///Define whether the vertical scrollbar should be drawn or not. The default value is `true`.
|
||||
bool verticalScrollBarEnabled;
|
||||
///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.
|
||||
List<String> resourceCustomSchemes;
|
||||
///List of [ContentBlocker] that are a set of rules used to block content in the browser window.
|
||||
List<ContentBlocker> contentBlockers;
|
||||
///Sets the content mode that the WebView needs to use. The default value is [InAppWebViewUserPreferredContentMode.RECOMMENDED].
|
||||
///
|
||||
///**NOTE**: available on iOS 13.0+.
|
||||
InAppWebViewUserPreferredContentMode preferredContentMode;
|
||||
///Set to `true` to be able to listen at the [shouldInterceptAjaxRequest] event. The default value is `false`.
|
||||
bool useShouldInterceptAjaxRequest;
|
||||
///Set to `true` to be able to listen at the [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`.
|
||||
///
|
||||
///**NOTE**: available on iOS 9.0+.
|
||||
bool incognito;
|
||||
///Sets whether WebView should use browser caching. The default value is `true`.
|
||||
///
|
||||
///**NOTE**: available on iOS 9.0+.
|
||||
bool cacheEnabled;
|
||||
///Set to `true` to make the background of the WebView transparent. If your app has a dark theme, this can prevent a white flash on initialization. The default value is `false`.
|
||||
bool transparentBackground;
|
||||
|
||||
InAppWebViewOptions({this.useShouldOverrideUrlLoading = false, this.useOnLoadResource = false, this.useOnDownloadStart = false, this.useOnTargetBlank = false,
|
||||
this.clearCache = false, this.userAgent = "", this.applicationNameForUserAgent = "", this.javaScriptEnabled = true, this.debuggingEnabled = false, this.javaScriptCanOpenWindowsAutomatically = false,
|
||||
this.mediaPlaybackRequiresUserGesture = true, this.textZoom = 100, this.minimumFontSize, this.verticalScrollBarEnabled = true, this.horizontalScrollBarEnabled = true,
|
||||
this.mediaPlaybackRequiresUserGesture = true, this.minimumFontSize, this.verticalScrollBarEnabled = true, this.horizontalScrollBarEnabled = true,
|
||||
this.resourceCustomSchemes = const [], this.contentBlockers = const [], this.preferredContentMode = InAppWebViewUserPreferredContentMode.RECOMMENDED,
|
||||
this.useShouldInterceptAjaxRequest = false, this.useShouldInterceptFetchRequest = false, this.incognito = false, this.cacheEnabled = true, this.transparentBackground = false}) {
|
||||
if (this.minimumFontSize == null)
|
||||
|
@ -90,7 +125,6 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
"debuggingEnabled": debuggingEnabled,
|
||||
"javaScriptCanOpenWindowsAutomatically": javaScriptCanOpenWindowsAutomatically,
|
||||
"mediaPlaybackRequiresUserGesture": mediaPlaybackRequiresUserGesture,
|
||||
"textZoom": textZoom,
|
||||
"verticalScrollBarEnabled": verticalScrollBarEnabled,
|
||||
"horizontalScrollBarEnabled": horizontalScrollBarEnabled,
|
||||
"resourceCustomSchemes": resourceCustomSchemes,
|
||||
|
@ -128,7 +162,6 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
options.debuggingEnabled = map["debuggingEnabled"];
|
||||
options.javaScriptCanOpenWindowsAutomatically = map["javaScriptCanOpenWindowsAutomatically"];
|
||||
options.mediaPlaybackRequiresUserGesture = map["mediaPlaybackRequiresUserGesture"];
|
||||
options.textZoom = map["textZoom"];
|
||||
options.verticalScrollBarEnabled = map["verticalScrollBarEnabled"];
|
||||
options.horizontalScrollBarEnabled = map["horizontalScrollBarEnabled"];
|
||||
options.resourceCustomSchemes = List<String>.from(map["resourceCustomSchemes"] ?? []);
|
||||
|
@ -144,60 +177,140 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
}
|
||||
|
||||
class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions {
|
||||
///Sets the text zoom of the page in percent. The default is `100`.
|
||||
int textZoom;
|
||||
///Set to `true` to have the session cookie cache cleared before the new window is opened.
|
||||
bool clearSessionCache;
|
||||
///Set to `true` if the WebView should use its built-in zoom mechanisms. The default value is `false`.
|
||||
bool builtInZoomControls;
|
||||
///Set to `true` if the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. The default value is `false`.
|
||||
bool displayZoomControls;
|
||||
///Set to `false` if the WebView should not support zooming using its on-screen zoom controls and gestures. The default value is `true`.
|
||||
bool supportZoom;
|
||||
///Set to `true` if you want the database storage API is enabled. The default value is `false`.
|
||||
bool databaseEnabled;
|
||||
///Set to `true` if you want the DOM storage API is enabled. The default value is `false`.
|
||||
bool domStorageEnabled;
|
||||
///Set to `true` if the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport.
|
||||
///When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels.
|
||||
///When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used.
|
||||
///If the page does not contain the tag or does not provide a width, then a wide viewport will be used. The default value is `true`.
|
||||
bool useWideViewPort;
|
||||
///Sets whether Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links.
|
||||
///Safe Browsing is enabled by default for devices which support it.
|
||||
///
|
||||
///**NOTE**: available on Android 26+.
|
||||
bool safeBrowsingEnabled;
|
||||
///Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
|
||||
///
|
||||
///**NOTE**: available on Android 21+.
|
||||
AndroidInAppWebViewMixedContentMode mixedContentMode;
|
||||
///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`.
|
||||
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`.
|
||||
bool allowFileAccess;
|
||||
///Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs.
|
||||
///Note that the value of this setting is ignored if the value of [allowFileAccessFromFileURLs] is `true`.
|
||||
///Note too, that this setting affects only JavaScript access to file scheme resources. The default value is `false`.
|
||||
bool allowFileAccessFromFileURLs;
|
||||
///Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin.
|
||||
///Note that this setting affects only JavaScript access to file scheme resources.
|
||||
///This includes access to content from other file scheme URLs. The default value is `false`.
|
||||
bool allowUniversalAccessFromFileURLs;
|
||||
///Sets the path to the Application Caches files. In order for the Application Caches API to be enabled, this option must be set a path to which the application can write.
|
||||
///This option is used one time: repeated calls are ignored.
|
||||
String appCachePath;
|
||||
///Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes). The default value is `false`.
|
||||
bool blockNetworkImage;
|
||||
///Sets whether the WebView should not load resources from the network. The default value is `false`.
|
||||
bool blockNetworkLoads;
|
||||
///Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed.
|
||||
///When navigating back, content is not revalidated, instead the content is just retrieved from the cache. The default value is [AndroidInAppWebViewCacheMode.LOAD_DEFAULT].
|
||||
AndroidInAppWebViewCacheMode cacheMode;
|
||||
///Sets the cursive font family name. The default value is `"cursive"`.
|
||||
String cursiveFontFamily;
|
||||
///Sets the default fixed font size. The default value is `16`.
|
||||
int defaultFixedFontSize;
|
||||
///Sets the default font size. The default value is `16`.
|
||||
int defaultFontSize;
|
||||
///Sets the default text encoding name to use when decoding html pages. The default value is `"UTF-8"`.
|
||||
String defaultTextEncodingName;
|
||||
///Disables the action mode menu items according to menuItems flag.
|
||||
///
|
||||
///**NOTE**: available on Android 24+.
|
||||
AndroidInAppWebViewModeMenuItem disabledActionModeMenuItems;
|
||||
///Sets the fantasy font family name. The default value is `"fantasy"`.
|
||||
String fantasyFontFamily;
|
||||
///Sets the fixed font family name. The default value is `"monospace"`.
|
||||
String fixedFontFamily;
|
||||
///Set the force dark mode for this WebView. The default value is [AndroidInAppWebViewForceDark.FORCE_DARK_OFF].
|
||||
///
|
||||
///**NOTE**: available on Android 29+.
|
||||
AndroidInAppWebViewForceDark forceDark;
|
||||
///Sets whether Geolocation API is enabled. The default value is `true`.
|
||||
bool geolocationEnabled;
|
||||
///Sets the underlying layout algorithm. This will cause a re-layout of the WebView.
|
||||
AndroidInAppWebViewLayoutAlgorithm layoutAlgorithm;
|
||||
///Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width.
|
||||
///This setting is taken into account when the content width is greater than the width of the WebView control, for example, when [useWideViewPort] is enabled.
|
||||
///The default value is `false`.
|
||||
bool loadWithOverviewMode;
|
||||
///Sets whether the WebView should load image resources. Note that this method controls loading of all images, including those embedded using the data URI scheme.
|
||||
///Note that if the value of this setting is changed from false to true, all images resources referenced by content currently displayed by the WebView are loaded automatically.
|
||||
///The default value is `true`.
|
||||
bool loadsImagesAutomatically;
|
||||
///Sets the minimum logical font size. The default is `8`.
|
||||
int minimumLogicalFontSize;
|
||||
///Sets the initial scale for this WebView. 0 means default.The behavior for the default scale depends on the state of [useWideViewPort] and [loadWithOverviewMode].
|
||||
///If the content fits into the WebView control by width, then the zoom is set to 100%. For wide content, the behavior depends on the state of [loadWithOverviewMode].
|
||||
///If its value is true, the content will be zoomed out to be fit by width into the WebView control, otherwise not.
|
||||
///If initial scale is greater than 0, WebView starts with this value as initial scale.
|
||||
///Please note that unlike the scale properties in the viewport meta tag, this method doesn't take the screen density into account.
|
||||
///The default is `0`.
|
||||
int initialScale;
|
||||
///Tells the WebView whether it needs to set a node. The default value is `true`.
|
||||
bool needInitialFocus;
|
||||
///Sets whether this WebView should raster tiles when it is offscreen but attached to a window.
|
||||
///Turning this on can avoid rendering artifacts when animating an offscreen WebView on-screen.
|
||||
///Offscreen WebViews in this mode use more memory. The default value is `false`.
|
||||
///
|
||||
///**NOTE**: available on Android 23+.
|
||||
bool offscreenPreRaster;
|
||||
///Sets the sans-serif font family name. The default value is `"sans-serif"`.
|
||||
String sansSerifFontFamily;
|
||||
///Sets the serif font family name. The default value is `"sans-serif"`.
|
||||
String serifFontFamily;
|
||||
///Sets the standard font family name. The default value is `"sans-serif"`.
|
||||
String standardFontFamily;
|
||||
///Sets whether the WebView should save form data. In Android O, the platform has implemented a fully functional Autofill feature to store form data.
|
||||
///Therefore, the Webview form data save feature is disabled. Note that the feature will continue to be supported on older versions of Android as before.
|
||||
bool saveFormData;
|
||||
///Boolean value to enable third party cookies in the WebView.
|
||||
///Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS.
|
||||
///The default value is `true`.
|
||||
///
|
||||
///**NOTE**: available on Android 21+.
|
||||
bool thirdPartyCookiesEnabled;
|
||||
///Boolean value to enable Hardware Acceleration in the WebView.
|
||||
///The default value is `true`.
|
||||
bool hardwareAcceleration;
|
||||
|
||||
AndroidInAppWebViewOptions({this.clearSessionCache = false, this.builtInZoomControls = false, this.displayZoomControls = false, this.supportZoom = true, this.databaseEnabled = false,
|
||||
AndroidInAppWebViewOptions({this.textZoom = 100, this.clearSessionCache = false, this.builtInZoomControls = false, this.displayZoomControls = false, this.supportZoom = true, this.databaseEnabled = false,
|
||||
this.domStorageEnabled = false, this.useWideViewPort = true, this.safeBrowsingEnabled = true, this.mixedContentMode,
|
||||
this.allowContentAccess = true, this.allowFileAccess = true, this.allowFileAccessFromFileURLs = true, this.allowUniversalAccessFromFileURLs = true,
|
||||
this.allowContentAccess = true, this.allowFileAccess = true, this.allowFileAccessFromFileURLs = false, this.allowUniversalAccessFromFileURLs = false,
|
||||
this.appCachePath, this.blockNetworkImage = false, this.blockNetworkLoads = false, this.cacheMode = AndroidInAppWebViewCacheMode.LOAD_DEFAULT,
|
||||
this.cursiveFontFamily = "cursive", this.defaultFixedFontSize = 16, this.defaultFontSize = 16, this.defaultTextEncodingName = "UTF-8",
|
||||
this.disabledActionModeMenuItems, this.fantasyFontFamily = "fantasy", this.fixedFontFamily = "monospace", this.forceDark = AndroidInAppWebViewForceDark.FORCE_DARK_OFF,
|
||||
this.geolocationEnabled = true, this.layoutAlgorithm, this.loadWithOverviewMode = true, this.loadsImagesAutomatically = true,
|
||||
this.minimumLogicalFontSize = 8, this.needInitialFocus = true, this.offscreenPreRaster = false, this.sansSerifFontFamily = "sans-serif", this.serifFontFamily = "sans-serif",
|
||||
this.standardFontFamily = "sans-serif", this.saveFormData = true, this.thirdPartyCookiesEnabled = true, this.hardwareAcceleration = true, this.initialScale
|
||||
this.standardFontFamily = "sans-serif", this.saveFormData = true, this.thirdPartyCookiesEnabled = true, this.hardwareAcceleration = true, this.initialScale = 0
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"textZoom": textZoom,
|
||||
"clearSessionCache": clearSessionCache,
|
||||
"builtInZoomControls": builtInZoomControls,
|
||||
"displayZoomControls": displayZoomControls,
|
||||
|
@ -243,6 +356,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
|
|||
@override
|
||||
static AndroidInAppWebViewOptions fromMap(Map<String, dynamic> map) {
|
||||
AndroidInAppWebViewOptions options = new AndroidInAppWebViewOptions();
|
||||
options.textZoom = map["textZoom"];
|
||||
options.clearSessionCache = map["clearSessionCache"];
|
||||
options.builtInZoomControls = map["builtInZoomControls"];
|
||||
options.displayZoomControls = map["displayZoomControls"];
|
||||
|
|
Loading…
Reference in New Issue