added onLoadHttpError event, fixed InAppWebView handleMethod, updated example, updated driver tests

This commit is contained in:
Lorenzo Pichilli 2019-11-21 02:19:43 +01:00
parent 2a1e0b8204
commit 64f6995d83
19 changed files with 812 additions and 353 deletions

View File

@ -15,21 +15,25 @@
</component>
<component name="ChangeListManager">
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/example/test_assets/in_app_webview_on_js_dialog_test.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_js_dialog_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_received_http_auth_request_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="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/InAppWebChromeClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewChromeClient.java" 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$/example/lib/chrome_safari_browser_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/app_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/app_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/test_driver/main_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/main_test.dart" 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$/lib/src/content_blocker.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/content_blocker.dart" 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/types.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/types.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
@ -50,19 +54,10 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="104">
<caret line="46" column="24" selection-start-line="46" selection-start-column="24" selection-end-line="46" selection-end-column="24" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="427">
<caret line="33" column="50" selection-start-line="33" selection-start-column="50" selection-end-line="33" selection-end-column="50" />
<state relative-caret-position="-195">
<caret line="344" column="6" selection-start-line="344" selection-start-column="6" selection-end-line="344" selection-end-column="6" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -73,29 +68,17 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="658">
<caret line="199" column="51" selection-start-line="199" selection-start-column="51" selection-end-line="199" selection-end-column="51" />
<state relative-caret-position="-6">
<caret line="207" selection-start-line="207" selection-end-line="207" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart">
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="249">
<caret line="44" column="22" selection-start-line="44" selection-start-column="22" selection-end-line="49" selection-end-column="23" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="134" column="55" lean-forward="true" selection-start-line="134" selection-start-column="55" selection-end-line="134" selection-end-column="55" />
<state relative-caret-position="284">
<caret line="37" column="94" selection-start-line="37" selection-start-column="94" selection-end-line="37" selection-end-column="94" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -104,10 +87,67 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html">
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="60" selection-end-line="15" selection-end-column="7" />
<state relative-caret-position="254">
<caret line="97" column="63" selection-start-line="97" selection-start-column="63" selection-end-line="97" selection-end-column="63" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="432">
<caret line="70" column="48" selection-start-line="70" selection-start-column="48" selection-end-line="70" selection-end-column="48" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<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="152">
<caret line="348" column="14" selection-start-line="348" selection-start-column="7" selection-end-line="348" selection-end-column="14" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="61" column="22" selection-start-line="61" selection-start-column="22" selection-end-line="61" selection-end-column="22" />
<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/test_driver/util_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="15" column="36" selection-start-line="15" selection-start-column="16" selection-end-line="15" selection-end-column="36" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="423">
<caret line="91" column="22" selection-start-line="91" selection-start-column="12" selection-end-line="91" selection-end-column="22" />
</state>
</provider>
</entry>
@ -123,18 +163,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>onConsoleM</find>
<find>return this</find>
<find>return await</find>
<find>onCallJsHandler</find>
<find>ListenerCallback</find>
<find>jsonDecode</find>
<find>CallBac</find>
<find>dart</find>
<find>```</find>
<find>JavaScriptHandlerCallback</find>
<find>addJavaScriptHandler</find>
<find>indexTest</find>
<find>removeJavaScriptHandler</find>
<find>__safeBrowsingEnabled__</find>
<find>__safe</find>
@ -144,7 +172,6 @@
<find>__builtInZoomControls__</find>
<find>android.support.v4</find>
<find>__transparentBackground__</find>
<find>dispose</find>
<find>_dispose</find>
<find>ù</find>
<find>setC</find>
@ -153,6 +180,19 @@
<find>createPromptDialog</find>
<find>houldOverrideUrlLoad</find>
<find>InAppWebViewShouldOverrideUrlLoadingTest</find>
<find>toValue</find>
<find>toValue()</find>
<find>url</find>
<find>targetB</find>
<find>availa</find>
<find>onLoadHttpError</find>
<find>onReceivedHttpAuthRequest</find>
<find>onLoadHtt</find>
<find>onLoadError</find>
<find>startSafeBrowsing</find>
<find>onSafeBrowsingHit</find>
<find>dispose</find>
<find>onSafe</find>
</findStrings>
<replaceStrings>
<replace>activity.getPreferences(0)</replace>
@ -170,16 +210,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/example/ios/Flutter/Debug.xcconfig" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutterwebview/InAppBrowser.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutterwebview/InAppBrowserClient.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutterwebview/InAppBrowserDialog.java" />
<option value="$PROJECT_DIR$/android/settings.gradle" />
<option value="$PROJECT_DIR$/ios/Classes/InAppBrowser.m" />
<option value="$PROJECT_DIR$/ios/Classes/SwiftFlutterPlugin.swift" />
<option value="$PROJECT_DIR$/LICENSE" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserDialog.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserClient.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java" />
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
<option value="$PROJECT_DIR$/example/ios/Podfile" />
@ -207,20 +237,30 @@
<option value="$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/ios/Classes/MyCookieManager.swift" />
<option value="$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/pubspec.yaml" />
<option value="$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/CHANGELOG.md" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_on_js_dialog_test.html" />
<option value="$PROJECT_DIR$/example/test_driver/main_test.dart" />
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart" />
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart" />
<option value="$PROJECT_DIR$/example/test_driver/app_test.dart" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_js_dialog_test.dart" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart" />
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart" />
<option value="$PROJECT_DIR$/example/assets/index.html" />
<option value="$PROJECT_DIR$/lib/src/types.dart" />
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
<option value="$PROJECT_DIR$/example/test_driver/main_test.dart" />
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_received_http_auth_request_test.dart" />
<option value="$PROJECT_DIR$/example/test_driver/app_test.dart" />
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
<option value="$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart" />
<option value="$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart" />
<option value="$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart" />
</list>
</option>
</component>
@ -235,55 +275,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="assets" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="test_assets" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="test_driver" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="AndroidView">
<subPane>
<expand>
@ -313,6 +304,49 @@
<select />
</subPane>
</pane>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="test_driver" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope">
<subPane subId="Project Files">
<expand>
@ -336,7 +370,7 @@
<property name="android.project.structure.proportion" value="0.15" />
<property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/test_assets" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/test_driver" />
<property name="project.structure.last.edited" value="SDK Location" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
@ -344,17 +378,17 @@
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/test_assets" />
<recent name="$PROJECT_DIR$/example/test_driver" />
<recent name="$PROJECT_DIR$/example/assets" />
<recent name="$PROJECT_DIR$/example/assets/images" />
<recent name="$PROJECT_DIR$/android/libs" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/assets/images" />
<recent name="$PROJECT_DIR$/android/src/main/java" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/test_driver" />
<recent name="$PROJECT_DIR$/example/test_assets" />
<recent name="$PROJECT_DIR$/example/assets" />
<recent name="$PROJECT_DIR$/example/assets/images" />
<recent name="$PROJECT_DIR$/android/libs" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
@ -475,7 +509,7 @@
<frame x="0" y="23" width="1920" height="1057" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.6177474" visible="true" weight="0.2087327" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.6177474" visible="true" weight="0.20766774" />
<window_info id="Structure" order="1" sideWeight="0.38225257" side_tool="true" weight="0.2087327" />
<window_info id="Designer" order="2" />
<window_info id="Build Variants" order="3" side_tool="true" />
@ -486,15 +520,15 @@
<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.32745314" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49478307" visible="true" weight="0.34300518" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.34288746" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49478307" weight="0.4580311" />
<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" />
<window_info anchor="bottom" id="TODO" order="6" weight="0.3284974" />
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.50532484" side_tool="true" weight="0.35751295" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.4946752" weight="0.50673574" />
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.4946752" visible="true" weight="0.49015543" />
<window_info anchor="bottom" id="Logcat" order="11" weight="0.32953367" />
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.4968051" weight="0.33782384" />
<window_info anchor="bottom" id="Dependency Viewer" order="13" weight="0.32800853" />
@ -522,60 +556,6 @@
</ignored-roots>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/example/.packages">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/android/.idea/gradle.xml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/android/.idea/misc.xml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/example/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values-v28/values-v28.xml" />
<entry file="file://$PROJECT_DIR$/example/android/app/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="603">
<caret line="64" column="74" selection-start-line="64" selection-start-column="74" selection-end-line="64" selection-end-column="74" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/gradle.properties">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" lean-forward="true" selection-end-line="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/android/gradle.properties">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/android/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="16" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/flutter_inappbrowser.podspec">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" selection-start-line="22" selection-end-line="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="32" column="22" lean-forward="true" selection-start-line="32" selection-start-column="22" selection-end-line="32" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/core/map.dart" />
<entry file="file://$PROJECT_DIR$/example/assets/page-3.html" />
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/convert/json.dart" />
<entry file="file://$PROJECT_DIR$/example/lib/test.dart">
<provider selected="true" editor-type-id="text-editor">
@ -636,30 +616,9 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="228">
<caret line="62" column="50" selection-start-line="62" selection-start-column="16" selection-end-line="62" selection-end-column="50" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="553">
<caret line="92" column="44" selection-start-line="92" selection-start-column="44" selection-end-line="92" selection-end-column="44" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/ios/Classes/MyCookieManager.swift">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="213">
<caret line="84" column="36" lean-forward="true" selection-start-line="84" selection-start-column="36" selection-end-line="84" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/ios/Classes/MyCookieManager.swift" />
<entry file="file://$PROJECT_DIR$/ios/Classes/MyCookieManager.swift">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
@ -667,20 +626,8 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="14" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="15" column="36" selection-start-line="15" selection-start-column="36" selection-end-line="15" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/pubspec.yaml" />
<entry file="file://$PROJECT_DIR$/../cartella senza titolo/flutter_inappbrowser/CHANGELOG.md" />
<entry file="file://$PROJECT_DIR$/ios/Classes/FlutterWebViewController.swift">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="343">
@ -688,13 +635,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="392">
<caret line="52" selection-start-line="52" selection-end-line="52" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
@ -729,16 +669,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="58" column="22" selection-start-line="58" selection-start-column="22" selection-end-line="67" selection-end-column="25" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-388">
@ -775,13 +705,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="104">
<caret line="46" column="24" selection-start-line="46" selection-start-column="24" selection-end-line="46" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="303">
@ -816,39 +739,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-417">
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="427">
<caret line="33" column="50" selection-start-line="33" selection-start-column="50" selection-end-line="33" selection-end-column="50" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="658">
<caret line="199" column="51" selection-start-line="199" selection-start-column="51" selection-end-line="199" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="60" selection-end-line="15" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/assets/page-1.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="104">
@ -856,16 +746,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="249">
<caret line="44" column="22" selection-start-line="44" selection-start-column="22" selection-end-line="49" selection-end-column="23" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
@ -873,16 +753,191 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="134" column="55" lean-forward="true" selection-start-line="134" selection-start-column="55" selection-end-line="134" selection-end-column="55" />
<state relative-caret-position="180">
<caret line="12" column="60" selection-end-line="15" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="690">
<caret line="46" column="24" selection-start-line="46" selection-start-column="24" selection-end-line="46" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="44" column="22" selection-start-line="44" selection-start-column="22" selection-end-line="49" selection-end-column="23" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/content_blocker.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="71" column="19" selection-start-line="71" selection-start-column="9" selection-end-line="71" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="147">
<caret line="16" column="2" selection-start-line="16" selection-start-column="2" selection-end-line="16" selection-end-column="2" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="58" column="22" selection-start-line="58" selection-start-column="22" selection-end-line="67" selection-end-column="25" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="214">
<caret line="15" column="47" lean-forward="true" selection-start-line="15" selection-start-column="47" selection-end-line="15" selection-end-column="47" />
</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="422">
<caret line="56" column="5" selection-start-line="56" selection-start-column="5" selection-end-line="56" selection-end-column="56" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="37" column="94" selection-start-line="37" selection-start-column="94" selection-end-line="37" selection-end-column="94" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-6">
<caret line="207" selection-start-line="207" selection-end-line="207" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="423">
<caret line="91" column="22" selection-start-line="91" selection-start-column="12" selection-end-line="91" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_received_http_auth_request_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="282">
<caret line="45" column="48" selection-start-line="45" selection-start-column="48" selection-end-line="45" selection-end-column="48" />
</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="-2">
<caret line="294" column="31" selection-start-line="294" selection-start-column="31" selection-end-line="294" selection-end-column="31" />
<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="-195">
<caret line="344" column="6" selection-start-line="344" selection-start-column="6" selection-end-line="344" selection-end-column="6" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="152">
<caret line="348" column="14" selection-start-line="348" selection-start-column="7" selection-end-line="348" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="61" column="22" selection-start-line="61" selection-start-column="22" selection-end-line="61" selection-end-column="22" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test_driver/util_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="15" column="36" selection-start-line="15" selection-start-column="16" selection-end-line="15" selection-end-column="36" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="267">
<caret line="147" column="48" selection-start-line="147" selection-start-column="48" selection-end-line="147" selection-end-column="48" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="254">
<caret line="97" column="63" selection-start-line="97" selection-start-column="63" selection-end-line="97" selection-end-column="63" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="432">
<caret line="70" column="48" selection-start-line="70" selection-start-column="48" selection-end-line="70" selection-end-column="48" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View File

@ -29,7 +29,7 @@
- Added `onReceivedServerTrustAuthRequest` and `onReceivedClientCertRequest` events to manage SSL requests
- Added `onFindResultReceived` event, `findAllAsync`, `findNext` and `clearMatches` methods
- Added `shouldInterceptAjaxRequest`, `onAjaxReadyStateChange`, `onAjaxProgress` and `shouldInterceptFetchRequest` events with `useShouldInterceptAjaxRequest` and `useShouldInterceptFetchRequest` webview options
- Added `onNavigationStateChange` event
- Added `onNavigationStateChange` and `onLoadHttpError` events
- Fun: added `getTRexRunnerHtml` and `getTRexRunnerCss` methods to get html (with javascript) and css to recreate the Chromium's t-rex runner game
### BREAKING CHANGES

View File

@ -7,8 +7,6 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.os.Build;
import android.util.AttributeSet;
import android.util.JsonReader;
import android.util.JsonToken;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@ -31,7 +29,6 @@ import com.pichillilorenzo.flutter_inappbrowser.Util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,7 +49,7 @@ final public class InAppWebView extends InputAwareWebView {
public FlutterWebView flutterWebView;
public int id;
public InAppWebViewClient inAppWebViewClient;
public InAppWebChromeClient inAppWebChromeClient;
public InAppWebViewChromeClient inAppWebViewChromeClient;
public InAppWebViewOptions options;
public boolean isLoading = false;
public OkHttpClient httpClient;
@ -538,8 +535,8 @@ final public class InAppWebView extends InputAwareWebView {
addJavascriptInterface(new JavaScriptBridgeInterface((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView), JavaScriptBridgeInterface.name);
inAppWebChromeClient = new InAppWebChromeClient((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView, this.registrar);
setWebChromeClient(inAppWebChromeClient);
inAppWebViewChromeClient = new InAppWebViewChromeClient((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView, this.registrar);
setWebChromeClient(inAppWebViewChromeClient);
inAppWebViewClient = new InAppWebViewClient((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView);
setWebViewClient(inAppWebViewClient);

View File

@ -40,7 +40,7 @@ import io.flutter.plugin.common.PluginRegistry;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
public class InAppWebChromeClient extends WebChromeClient implements PluginRegistry.ActivityResultListener {
public class InAppWebViewChromeClient extends WebChromeClient implements PluginRegistry.ActivityResultListener {
protected static final String LOG_TAG = "IABWebChromeClient";
private PluginRegistry.Registrar registrar;
@ -56,7 +56,7 @@ public class InAppWebChromeClient extends WebChromeClient implements PluginRegis
private int mOriginalOrientation;
private int mOriginalSystemUiVisibility;
public InAppWebChromeClient(Object obj, PluginRegistry.Registrar registrar) {
public InAppWebViewChromeClient(Object obj, PluginRegistry.Registrar registrar) {
super();
this.registrar = registrar;
if (obj instanceof InAppBrowserActivity)

View File

@ -237,6 +237,21 @@ public class InAppWebViewClient extends WebViewClient {
getChannel().invokeMethod("onLoadError", obj);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onReceivedHttpError (WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
super.onReceivedHttpError(view, request, errorResponse);
if(request.isForMainFrame()) {
Map<String, Object> obj = new HashMap<>();
if (inAppBrowserActivity != null)
obj.put("uuid", inAppBrowserActivity.uuid);
obj.put("url", request.getUrl().toString());
obj.put("statusCode", errorResponse.getStatusCode());
obj.put("description", errorResponse.getReasonPhrase());
getChannel().invokeMethod("onLoadHttpError", obj);
}
}
/**
* On received http auth request.
*/
@ -297,7 +312,8 @@ public class InAppWebViewClient extends WebViewClient {
} else {
handler.cancel();
}
//handler.useHttpAuthUsernamePassword();
// used custom CredentialDatabase!
// handler.useHttpAuthUsernamePassword();
return;
case 0:
default:

View File

@ -56,19 +56,19 @@ class _ChromeSafariBrowserExampleScreenState
ListTile(
title: Text('InAppBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/InAppBrowser');
Navigator.pushReplacementNamed(context, '/InAppBrowser');
},
),
ListTile(
title: Text('ChromeSafariBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
Navigator.pushReplacementNamed(context, '/ChromeSafariBrowser');
},
),
ListTile(
title: Text('InAppWebView'),
onTap: () {
Navigator.popAndPushNamed(context, '/');
Navigator.pushReplacementNamed(context, '/');
},
),
],

View File

@ -133,19 +133,19 @@ class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {
ListTile(
title: Text('InAppBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/InAppBrowser');
Navigator.pushReplacementNamed(context, '/InAppBrowser');
},
),
ListTile(
title: Text('ChromeSafariBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
Navigator.pushReplacementNamed(context, '/ChromeSafariBrowser');
},
),
ListTile(
title: Text('InAppWebView'),
onTap: () {
Navigator.popAndPushNamed(context, '/');
Navigator.pushReplacementNamed(context, '/');
},
),
],

View File

@ -83,22 +83,19 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
ListTile(
title: Text('InAppBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/InAppBrowser');
dispose();
Navigator.pushReplacementNamed(context, '/InAppBrowser');
},
),
ListTile(
title: Text('ChromeSafariBrowser'),
onTap: () {
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
dispose();
Navigator.pushReplacementNamed(context, '/ChromeSafariBrowser');
},
),
ListTile(
title: Text('InAppWebView'),
onTap: () {
Navigator.popAndPushNamed(context, '/');
dispose();
Navigator.pushReplacementNamed(context, '/');
},
),
],
@ -163,7 +160,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
databaseEnabled: true,
domStorageEnabled: true,
geolocationEnabled: true,
//safeBrowsingEnabled: true,
safeBrowsingEnabled: true,
//blockNetworkImage: true,
),
),
@ -241,6 +238,10 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
</html>
""");
},
onLoadHttpError: (InAppWebViewController controller, String url,
int statusCode, String description) async {
print("HTTP error $url: $statusCode, $description");
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
@ -364,7 +365,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
onSafeBrowsingHit: (InAppWebViewController controller,
String url, SafeBrowsingThreat threatType) async {
SafeBrowsingResponseAction action =
SafeBrowsingResponseAction.BACK_TO_SAFETY;
SafeBrowsingResponseAction.SHOW_INTERSTITIAL;
return new SafeBrowsingResponse(report: true, action: action);
},
onReceivedHttpAuthRequest: (InAppWebViewController controller,
@ -376,7 +377,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
username: "USERNAME",
password: "PASSWORD",
action: HttpAuthResponseAction
.USE_SAVED_HTTP_AUTH_CREDENTIALS,
.PROCEED,
permanentPersistence: true);
},
onReceivedServerTrustAuthRequest:

View File

@ -206,5 +206,29 @@ void main() {
}, timeout: new Timeout(new Duration(minutes: 5)));
test('InAppWebViewOnSafeBrowsingHitTest', () async {
await Future.delayed(const Duration(milliseconds: 2000));
final appBarTitle = find.byValueKey('AppBarTitle');
while((await driver.getText(appBarTitle)) == "InAppWebViewOnSafeBrowsingHitTest") {
await Future.delayed(const Duration(milliseconds: 1000));
}
String url = await driver.getText(appBarTitle);
expect(url, "chrome://safe-browsing/match?type=malware");
}, timeout: new Timeout(new Duration(minutes: 5)));
test('InAppWebViewOnReceivedHttpAuthRequestTest', () async {
await Future.delayed(const Duration(milliseconds: 2000));
final appBarTitle = find.byValueKey('AppBarTitle');
while((await driver.getText(appBarTitle)) == "InAppWebViewOnReceivedHttpAuthRequestTest") {
await Future.delayed(const Duration(milliseconds: 1000));
}
String title = await driver.getText(appBarTitle);
expect(title, "Authorized");
}, timeout: new Timeout(new Duration(minutes: 5)));
});
}

View File

@ -14,7 +14,7 @@ class InAppWebViewInitialUrlTest extends WidgetTest {
}
class InAppWebViewInitialUrlTestState extends WidgetTestState {
String initialUrl = "https://flutter.dev/";
String appBarTitle = "InAppWebViewInitialUrlTest";
@override
@ -26,7 +26,7 @@ class InAppWebViewInitialUrlTestState extends WidgetTestState {
Expanded(
child: Container(
child: InAppWebView(
initialUrl: initialUrl,
initialUrl: "https://flutter.dev/",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(

View File

@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'custom_widget_test.dart';
import 'main_test.dart';
import 'util_test.dart';
class InAppWebViewOnReceivedHttpAuthRequestTest extends WidgetTest {
final InAppWebViewOnReceivedHttpAuthRequestTestState state = InAppWebViewOnReceivedHttpAuthRequestTestState();
@override
InAppWebViewOnReceivedHttpAuthRequestTestState createState() => state;
}
class InAppWebViewOnReceivedHttpAuthRequestTestState extends WidgetTestState {
String appBarTitle = "InAppWebViewOnReceivedHttpAuthRequestTest";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: myAppBar(state: this, title: appBarTitle),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialUrl: "http://192.168.1.20:8081/",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
clearCache: true,
debuggingEnabled: true
)
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) async {
String h1Content = await controller.evaluateJavascript(source: "document.body.querySelector('h1').textContent");
setState(() {
appBarTitle = h1Content;
});
nextTest(context: context, state: this);
},
onReceivedHttpAuthRequest: (InAppWebViewController controller, HttpAuthChallenge challenge) async {
return new HttpAuthResponse(
username: "USERNAME",
password: "PASSWORD",
action: HttpAuthResponseAction.PROCEED,
permanentPersistence: true);
},
),
),
),
])
)
);
}
}

View File

@ -0,0 +1,70 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'custom_widget_test.dart';
import 'main_test.dart';
import 'util_test.dart';
class InAppWebViewOnSafeBrowsingHitTest extends WidgetTest {
final InAppWebViewOnSafeBrowsingHitTestState state = InAppWebViewOnSafeBrowsingHitTestState();
@override
InAppWebViewOnSafeBrowsingHitTestState createState() => state;
}
class InAppWebViewOnSafeBrowsingHitTestState extends WidgetTestState {
String appBarTitle = "InAppWebViewOnSafeBrowsingHitTest";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: myAppBar(state: this, title: appBarTitle),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialUrl: "chrome://safe-browsing/match?type=malware",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
// if I set javaScriptEnabled to true, it will crash!
javaScriptEnabled: false,
clearCache: true,
debuggingEnabled: true
),
androidInAppWebViewOptions: AndroidInAppWebViewOptions(
databaseEnabled: true,
domStorageEnabled: true,
safeBrowsingEnabled: true,
),
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
if(Platform.isAndroid)
controller.startSafeBrowsing();
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {
setState(() {
appBarTitle = url;
});
nextTest(context: context, state: this);
},
onSafeBrowsingHit: (InAppWebViewController controller, String url, SafeBrowsingThreat threatType) async {
return SafeBrowsingResponse(report: true, action: SafeBrowsingResponseAction.PROCEED);
},
),
),
),
])
)
);
}
}

View File

@ -13,6 +13,8 @@ import 'in_app_webview_on_download_start_test.dart';
import 'in_app_webview_on_js_dialog_test.dart';
import 'in_app_webview_on_load_resource_custom_scheme_test.dart';
import 'in_app_webview_on_load_resource_test.dart';
import 'in_app_webview_on_received_http_auth_request_test.dart';
import 'in_app_webview_on_safe_browsing_hit_test.dart';
import 'in_app_webview_on_target_blank_test.dart';
import 'in_app_webview_should_override_url_loading_test.dart';
@ -32,6 +34,8 @@ Map<String, WidgetBuilder> buildRoutes({@required BuildContext context}) {
'/InAppWebViewOnDownloadStartTest': (context) => InAppWebViewOnDownloadStartTest(),
'/InAppWebViewOnTargetBlankTest': (context) => InAppWebViewOnTargetBlankTest(),
'/InAppWebViewOnJsDialogTest': (context) => InAppWebViewOnJsDialogTest(),
'/InAppWebViewOnSafeBrowsingHitTest': (context) => InAppWebViewOnSafeBrowsingHitTest(),
'/InAppWebViewOnReceivedHttpAuthRequestTest': (context) => InAppWebViewOnReceivedHttpAuthRequestTest(),
};
routes.forEach((k, v) => testRoutes.add(k));
return routes;

View File

@ -1340,6 +1340,11 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
public func webView(_ webView: WKWebView,
decidePolicyFor navigationResponse: WKNavigationResponse,
decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
if navigationResponse.isForMainFrame, let response = navigationResponse.response as? HTTPURLResponse {
if response.statusCode >= 400 {
onLoadHttpError(url: response.url!.absoluteString, statusCode: response.statusCode, description: "")
}
}
if (options?.useOnDownloadStart)! {
let mimeType = navigationResponse.response.mimeType
@ -1427,7 +1432,10 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
switch action {
case 0:
InAppWebView.credentialsProposed = []
completionHandler(.cancelAuthenticationChallenge, nil)
// used .performDefaultHandling to mantain consistency with Android
// because .cancelAuthenticationChallenge will call webView(_:didFail:withError:)
completionHandler(.performDefaultHandling, nil)
//completionHandler(.cancelAuthenticationChallenge, nil)
break
case 1:
let username = response["username"] as! String
@ -1853,6 +1861,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
}
}
public func onLoadHttpError(url: String, statusCode: Int, description: String) {
var arguments: [String: Any] = ["url": url, "statusCode": statusCode, "description": description]
if IABController != nil {
arguments["uuid"] = IABController!.uuid
}
if let channel = getChannel() {
channel.invokeMethod("onLoadHttpError", arguments: arguments)
}
}
public func onProgressChanged(progress: Int) {
var arguments: [String: Any] = ["progress": progress]
if IABController != nil {

View File

@ -42,7 +42,9 @@ class ContentBlockerTriggerResourceType {
return (["document", "image", "style-sheet", "script", "font",
"media", "svg-document", "raw"].contains(value)) ? ContentBlockerTriggerResourceType._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
@override
String toString() => _value;
static const DOCUMENT = const ContentBlockerTriggerResourceType._internal('document');
static const IMAGE = const ContentBlockerTriggerResourceType._internal('image');
@ -67,7 +69,9 @@ class ContentBlockerTriggerLoadType {
static ContentBlockerTriggerLoadType fromValue(String value) {
return (["first-party", "third-party"].contains(value)) ? ContentBlockerTriggerLoadType._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
@override
String toString() => _value;
///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource.
static const FIRST_PARTY = const ContentBlockerTriggerLoadType._internal('first-party');
@ -187,7 +191,9 @@ class ContentBlockerActionType {
static ContentBlockerActionType fromValue(String value) {
return (["block", "css-display-none", "make-https"].contains(value)) ? ContentBlockerActionType._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
@override
String toString() => _value;
///Stops loading of the resource. If the resource was cached, the cache is ignored.
static const BLOCK = const ContentBlockerActionType._internal('block');

View File

@ -301,6 +301,19 @@ class InAppBrowser {
}
///Event fires when the [InAppBrowser] main page receives an HTTP error.
///
///[url] represents the url of the main page that received the HTTP error.
///
///[statusCode] represents the status code of the response. HTTP errors have status codes >= 400.
///
///[description] represents the description of the HTTP error. On iOS, it is always an empty string.
///
///**NOTE**: available on Android 23+.
void onLoadHttpError(String url, int statusCode, String description) {
}
///Event fires when the current [progress] (range 0-100) of loading a page is changed.
void onProgressChanged(int progress) {

View File

@ -35,6 +35,17 @@ class InAppWebView extends StatefulWidget {
///Event fires when the [InAppWebView] encounters an error loading an [url].
final void Function(InAppWebViewController controller, String url, int code, String message) onLoadError;
///Event fires when the [InAppWebView] main page receives an HTTP error.
///
///[url] represents the url of the main page that received the HTTP error.
///
///[statusCode] represents the status code of the response. HTTP errors have status codes >= 400.
///
///[description] represents the description of the HTTP error. On iOS, it is always an empty string.
///
///**NOTE**: available on Android 23+.
final void Function(InAppWebViewController controller, String url, int statusCode, String description) onLoadHttpError;
///Event fires when the current [progress] of loading a page is changed.
final void Function(InAppWebViewController controller, int progress) onProgressChanged;
@ -233,6 +244,7 @@ class InAppWebView extends StatefulWidget {
this.onLoadStart,
this.onLoadStop,
this.onLoadError,
this.onLoadHttpError,
this.onConsoleMessage,
this.onProgressChanged,
this.shouldOverrideUrlLoading,
@ -401,6 +413,15 @@ class InAppWebViewController {
else if (_inAppBrowser != null)
_inAppBrowser.onLoadError(url, code, message);
break;
case "onLoadHttpError":
String url = call.arguments["url"];
int statusCode = call.arguments["statusCode"];
String description = call.arguments["description"];
if (_widget != null && _widget.onLoadHttpError != null)
_widget.onLoadHttpError(this, url, statusCode, description);
else if (_inAppBrowser != null)
_inAppBrowser.onLoadHttpError(url, statusCode, description);
break;
case "onProgressChanged":
int progress = call.arguments["progress"];
if (_widget != null && _widget.onProgressChanged != null)
@ -499,7 +520,7 @@ class InAppWebViewController {
case "onSafeBrowsingHit":
String url = call.arguments["url"];
SafeBrowsingThreat threatType = SafeBrowsingThreat.fromValue(call.arguments["threatType"]);
if (_widget != null && _widget.onJsPrompt != null)
if (_widget != null && _widget.onSafeBrowsingHit != null)
return (await _widget.onSafeBrowsingHit(this, url, threatType))?.toMap();
else if (_inAppBrowser != null)
return (await _inAppBrowser.onSafeBrowsingHit(url, threatType))?.toMap();
@ -548,7 +569,7 @@ class InAppWebViewController {
int activeMatchOrdinal = call.arguments["activeMatchOrdinal"];
int numberOfMatches = call.arguments["numberOfMatches"];
bool isDoneCounting = call.arguments["isDoneCounting"];
if (_widget != null && _widget.onReceivedClientCertRequest != null)
if (_widget != null && _widget.onFindResultReceived != null)
_widget.onFindResultReceived(this, activeMatchOrdinal, numberOfMatches, isDoneCounting);
else if (_inAppBrowser != null)
_inAppBrowser.onFindResultReceived(activeMatchOrdinal, numberOfMatches, isDoneCounting);

View File

@ -32,8 +32,9 @@ class ConsoleMessageLevel {
return ConsoleMessageLevel._internal(value);
return null;
}
toValue() => _value;
toString() {
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 0:
return "TIP";
@ -219,7 +220,7 @@ class GeolocationPermissionShowPromptResponse {
class JsAlertResponseAction {
final int _value;
const JsAlertResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
static const CONFIRM = const JsAlertResponseAction._internal(0);
@ -256,7 +257,7 @@ class JsAlertResponse {
class JsConfirmResponseAction {
final int _value;
const JsConfirmResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
static const CONFIRM = const JsConfirmResponseAction._internal(0);
static const CANCEL = const JsConfirmResponseAction._internal(1);
@ -297,7 +298,7 @@ class JsConfirmResponse {
class JsPromptResponseAction {
final int _value;
const JsPromptResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
static const CONFIRM = const JsPromptResponseAction._internal(0);
static const CANCEL = const JsPromptResponseAction._internal(1);
@ -349,7 +350,22 @@ class SafeBrowsingThreat {
return SafeBrowsingThreat._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
String toString() {
switch(_value) {
case 1:
return "SAFE_BROWSING_THREAT_MALWARE";
case 2:
return "SAFE_BROWSING_THREAT_PHISHING";
case 3:
return "SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE";
case 4:
return "SAFE_BROWSING_THREAT_BILLING";
case 0:
default:
return "SAFE_BROWSING_THREAT_UNKNOWN";
}
}
static const SAFE_BROWSING_THREAT_UNKNOWN = const SafeBrowsingThreat._internal(0);
static const SAFE_BROWSING_THREAT_MALWARE = const SafeBrowsingThreat._internal(1);
@ -367,7 +383,7 @@ class SafeBrowsingThreat {
class SafeBrowsingResponseAction {
final int _value;
const SafeBrowsingResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Act as if the user clicked the "back to safety" button.
static const BACK_TO_SAFETY = const SafeBrowsingResponseAction._internal(0);
@ -404,7 +420,7 @@ class SafeBrowsingResponse {
class HttpAuthResponseAction {
final int _value;
const HttpAuthResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Instructs the WebView to cancel the authentication request.
static const CANCEL = const HttpAuthResponseAction._internal(0);
@ -484,7 +500,7 @@ class HttpAuthCredential {
class ServerTrustAuthResponseAction {
final int _value;
const ServerTrustAuthResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Instructs the WebView to cancel the authentication challenge.
static const CANCEL = const ServerTrustAuthResponseAction._internal(0);
@ -534,7 +550,7 @@ class ServerTrustChallenge {
class ClientCertResponseAction {
final int _value;
const ClientCertResponseAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Cancel this request.
static const CANCEL = const ClientCertResponseAction._internal(0);
@ -611,7 +627,21 @@ class AndroidInAppWebViewCacheMode {
return AndroidInAppWebViewCacheMode._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "LOAD_CACHE_ELSE_NETWORK";
case 2:
return "LOAD_NO_CACHE";
case 3:
return "LOAD_CACHE_ONLY";
case -1:
default:
return "LOAD_DEFAULT";
}
}
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network.
@ -640,7 +670,21 @@ class AndroidInAppWebViewModeMenuItem {
return AndroidInAppWebViewModeMenuItem._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "MENU_ITEM_SHARE";
case 2:
return "MENU_ITEM_WEB_SEARCH";
case 4:
return "MENU_ITEM_PROCESS_TEXT";
case 0:
default:
return "MENU_ITEM_NONE";
}
}
///No menu items should be disabled.
static const MENU_ITEM_NONE = const AndroidInAppWebViewModeMenuItem._internal(0);
@ -668,7 +712,19 @@ class AndroidInAppWebViewForceDark {
return AndroidInAppWebViewForceDark._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "FORCE_DARK_AUTO";
case 2:
return "FORCE_DARK_ON";
case 0:
default:
return "FORCE_DARK_OFF";
}
}
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
@ -691,7 +747,9 @@ class AndroidInAppWebViewLayoutAlgorithm {
static AndroidInAppWebViewLayoutAlgorithm fromValue(String value) {
return (["NORMAL", "TEXT_AUTOSIZING"].contains(value)) ? AndroidInAppWebViewLayoutAlgorithm._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
@override
String toString() => _value;
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = const AndroidInAppWebViewLayoutAlgorithm._internal("NORMAL");
@ -718,7 +776,19 @@ class AndroidInAppWebViewMixedContentMode {
return AndroidInAppWebViewMixedContentMode._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "MIXED_CONTENT_NEVER_ALLOW";
case 2:
return "MIXED_CONTENT_COMPATIBILITY_MODE";
case 0:
default:
return "MIXED_CONTENT_ALWAYS_ALLOW";
}
}
///In this mode, the WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
///This is the least secure mode of operation for the WebView, and where possible apps should not set this mode.
@ -748,7 +818,17 @@ class IosInAppWebViewSelectionGranularity {
return IosInAppWebViewSelectionGranularity._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "CHARACTER";
case 0:
default:
return "DYNAMIC";
}
}
///Selection granularity varies automatically based on the selection.
static const DYNAMIC = const IosInAppWebViewSelectionGranularity._internal(0);
@ -771,7 +851,9 @@ class IosInAppWebViewDataDetectorTypes {
return (["NONE", "PHONE_NUMBER", "LINK", "ADDRESS", "CALENDAR_EVENT", "TRACKING_NUMBER",
"TRACKING_NUMBER", "FLIGHT_NUMBER", "LOOKUP_SUGGESTION", "SPOTLIGHT_SUGGESTION", "ALL"].contains(value)) ? IosInAppWebViewDataDetectorTypes._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
@override
String toString() => _value;
///No detection is performed.
static const NONE = const IosInAppWebViewDataDetectorTypes._internal("NONE");
@ -809,7 +891,19 @@ class InAppWebViewUserPreferredContentMode {
return InAppWebViewUserPreferredContentMode._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "MOBILE";
case 2:
return "DESKTOP";
case 0:
default:
return "RECOMMENDED";
}
}
///The recommended content mode for the current platform.
static const RECOMMENDED = const InAppWebViewUserPreferredContentMode._internal(0);
@ -833,7 +927,33 @@ class IosWebViewOptionsPresentationStyle {
return IosWebViewOptionsPresentationStyle._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "PAGE_SHEET";
case 2:
return "FORM_SHEET";
case 3:
return "CURRENT_CONTEXT";
case 4:
return "CUSTOM";
case 5:
return "OVER_FULL_SCREEN";
case 6:
return "OVER_CURRENT_CONTEXT";
case 7:
return "POPOVER";
case 8:
return "NONE";
case 9:
return "AUTOMATIC";
case 0:
default:
return "FULL_SCREEN";
}
}
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN = const IosWebViewOptionsPresentationStyle._internal(0);
@ -873,7 +993,21 @@ class IosWebViewOptionsTransitionStyle {
return IosWebViewOptionsTransitionStyle._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "FLIP_HORIZONTAL";
case 2:
return "CROSS_DISSOLVE";
case 3:
return "PARTIAL_CURL";
case 0:
default:
return "COVER_VERTICAL";
}
}
///When the view controller is presented, its view slides up from the bottom of the screen.
///On dismissal, the view slides back down. This is the default transition style.
@ -907,7 +1041,19 @@ class IosSafariOptionsDismissButtonStyle {
return IosSafariOptionsDismissButtonStyle._internal(value);
return null;
}
toValue() => _value;
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "CLOSE";
case 2:
return "CANCEL";
case 0:
default:
return "DONE";
}
}
///Makes the button title the localized string "Done".
static const DONE = const IosSafariOptionsDismissButtonStyle._internal(0);
@ -962,7 +1108,7 @@ class ChromeSafariBrowserClassOptions {
class AjaxRequestAction {
final int _value;
const AjaxRequestAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Aborts the current [AjaxRequest].
static const ABORT = const AjaxRequestAction._internal(0);
@ -992,7 +1138,7 @@ class AjaxRequestEventType {
static AjaxRequestEventType fromValue(String value) {
return (["loadstart", "load", "loadend", "progress", "error", "abort"].contains(value)) ? AjaxRequestEventType._internal(value) : null;
}
toValue() => _value;
String toValue() => _value;
String toString() => _value;
///The LOADSTART event is fired when a request has started to load data.
@ -1044,8 +1190,23 @@ class AjaxRequestReadyState {
return AjaxRequestReadyState._internal(value);
return null;
}
toValue() => _value;
String toString() => _value.toString();
int toValue() => _value;
@override
String toString() {
switch(_value) {
case 1:
return "OPENED";
case 2:
return "HEADERS_RECEIVED";
case 3:
return "LOADING";
case 4:
return "DONE";
case 0:
default:
return "UNSENT";
}
}
///Client has been created. `XMLHttpRequest.open()` not called yet.
static const UNSENT = const AjaxRequestReadyState._internal(0);
@ -1176,7 +1337,7 @@ class AjaxRequest {
class FetchRequestAction {
final int _value;
const FetchRequestAction._internal(this._value);
toValue() => _value;
int toValue() => _value;
///Aborts the fetch request.
static const ABORT = const FetchRequestAction._internal(0);

View File

@ -64,10 +64,19 @@ https.createServer(options, appHttps).listen(4433)
appAuthBasic.use((req, res, next) => {
let user = auth(req)
if (user === undefined || user['name'] !== 'user 1' || user['pass'] !== 'password 1') {
if (user === undefined || user['name'] !== 'USERNAME' || user['pass'] !== 'PASSWORD') {
res.statusCode = 401
res.setHeader('WWW-Authenticate', 'Basic realm="Node"')
res.end('Unauthorized')
res.send(`
<html>
<head>
</head>
<body>
<h1>Unauthorized</h1>
</body>
</html>
`);
res.end()
} else {
next()
}
@ -80,7 +89,7 @@ appAuthBasic.get("/", (req, res) => {
<head>
</head>
<body>
<p>HELLO</p>
<h1>Authorized</h1>
</body>
</html>
`);