updated AjaxRequest class, fixed 'InvalidStateError' ajax error #189, No need to listen to window.addEventListener(flutterInAppBrowserPlatformReady, fuction(){ }) javascript event anymore to use JaaScript message handlers
This commit is contained in:
parent
44c17d1efe
commit
f89610ae29
|
@ -15,15 +15,13 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.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/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/assets/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/example/assets/index.html" 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$/example/lib/webview_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/webview_example.screen.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" 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/cookie_manager.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/cookie_manager.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http_auth_credentials_database.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$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" 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" />
|
||||
</list>
|
||||
|
@ -48,8 +46,8 @@
|
|||
<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="194">
|
||||
<caret line="563" column="118" selection-start-line="563" selection-start-column="118" selection-end-line="563" selection-end-column="118" />
|
||||
<state relative-caret-position="127">
|
||||
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -57,23 +55,11 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="244" column="116" selection-start-line="244" selection-start-column="116" selection-end-line="244" selection-end-column="116" />
|
||||
<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$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="188" column="66" selection-start-line="188" selection-start-column="61" selection-end-line="188" selection-end-column="66" />
|
||||
<state relative-caret-position="20">
|
||||
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -82,10 +68,10 @@
|
|||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="613">
|
||||
<caret line="128" selection-start-line="128" selection-end-line="128" />
|
||||
<state relative-caret-position="703">
|
||||
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -94,13 +80,28 @@
|
|||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
||||
<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="180">
|
||||
<caret line="24" column="32" lean-forward="true" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="258">
|
||||
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
|
||||
</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">
|
||||
<state relative-caret-position="446">
|
||||
<caret line="88" selection-start-line="88" selection-end-line="88" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="322">
|
||||
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -117,9 +118,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>InAppWebViewUserPreferredContentMode</find>
|
||||
<find>onSag</find>
|
||||
<find>ServerTrustAuthResponse</find>
|
||||
<find>ClientCertResponse</find>
|
||||
<find>weBVIEWCONTROL</find>
|
||||
<find>getFa</find>
|
||||
|
@ -144,9 +142,12 @@
|
|||
<find>my-special-custom-scheme</find>
|
||||
<find>should</find>
|
||||
<find>resourceCustomSchemes</find>
|
||||
<find>shouldInterceptAjaxRequest</find>
|
||||
<find>evaluateJavascript</find>
|
||||
<find>WebHistory</find>
|
||||
<find>shouldInterceptAjaxRequest</find>
|
||||
<find>flutterInAppBrowserPlatformReady</find>
|
||||
<find>evaluateJ</find>
|
||||
<find>AjaxRequest</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -210,8 +211,6 @@
|
|||
<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$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" />
|
||||
|
@ -220,13 +219,15 @@
|
|||
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1920" />
|
||||
<option name="height" value="1057" />
|
||||
|
@ -273,6 +274,17 @@
|
|||
<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" />
|
||||
|
@ -290,11 +302,6 @@
|
|||
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="t_rex_runner" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="nodejs_server_test_auth_basic_and_ssl" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
||||
|
@ -465,7 +472,7 @@
|
|||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1920" height="1057" extended-state="0" />
|
||||
<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.6529745" visible="true" weight="0.15867944" />
|
||||
|
@ -479,7 +486,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 anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.39170983" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.48290154" />
|
||||
<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" />
|
||||
|
@ -487,11 +494,11 @@
|
|||
<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.307772" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.41658032" />
|
||||
<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" />
|
||||
<window_info active="true" anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" visible="true" weight="0.3253886" />
|
||||
<window_info anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" weight="0.3253886" />
|
||||
<window_info anchor="bottom" id="Flutter Performance" order="15" sideWeight="0.5042598" side_tool="true" weight="0.5160622" />
|
||||
<window_info anchor="bottom" id="Build" order="16" />
|
||||
<window_info anchor="bottom" id="Thumbnails" order="17" weight="0.32953367" />
|
||||
|
@ -517,7 +524,6 @@
|
|||
</ignored-roots>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/client1-crt.pem" />
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/client1-crt.crt" />
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.lock">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
|
@ -661,27 +667,6 @@
|
|||
</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="580">
|
||||
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<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$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret line="88" column="53" selection-start-line="88" selection-start-column="53" selection-end-line="88" selection-end-column="53" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="613">
|
||||
|
@ -695,7 +680,7 @@
|
|||
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="24" column="32" lean-forward="true" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="32" />
|
||||
<caret line="24" column="32" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -739,16 +724,6 @@
|
|||
</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="5379">
|
||||
<caret line="363" column="36" selection-start-line="363" selection-start-column="36" selection-end-line="363" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</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="570">
|
||||
|
@ -759,10 +734,53 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_localhost_server.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<folding>
|
||||
<element signature="e#0#17#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="-4314">
|
||||
<caret line="363" column="36" selection-start-line="363" selection-start-column="36" selection-end-line="363" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</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="258">
|
||||
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="446">
|
||||
<caret line="88" selection-start-line="88" selection-end-line="88" />
|
||||
</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="703">
|
||||
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" />
|
||||
<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="194">
|
||||
<caret line="563" column="118" selection-start-line="563" selection-start-column="118" selection-end-line="563" selection-end-column="118" />
|
||||
<state relative-caret-position="127">
|
||||
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -771,21 +789,18 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="188" column="66" selection-start-line="188" selection-start-column="61" selection-end-line="188" selection-end-column="66" />
|
||||
<state relative-caret-position="20">
|
||||
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" />
|
||||
<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="323">
|
||||
<caret line="244" column="116" selection-start-line="244" selection-start-column="116" selection-end-line="244" selection-end-column="116" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="322">
|
||||
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
- Renamed `injectScriptCode` to `evaluateJavascript`
|
||||
- Renamed `injectStyleCode` to `injectCSSCode`
|
||||
- Renamed `injectStyleFile` to `injectCSSFileFromUrl`
|
||||
- No need to listen to `window.addEventListener("flutterInAppBrowserPlatformReady", fuction(){ })` javascript event anymore to call `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)` to use the JavaScript message handlers
|
||||
|
||||
## 1.2.1
|
||||
|
||||
|
|
|
@ -85,8 +85,6 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" }" +
|
||||
"})(window.console);";
|
||||
|
||||
static final String platformReadyJS = "window.dispatchEvent(new Event('flutterInAppBrowserPlatformReady'));";
|
||||
|
||||
static final String variableForOnLoadResourceJS = "window._flutter_inappbrowser_useOnLoadResource";
|
||||
static final String enableVariableForOnLoadResourceJS = variableForOnLoadResourceJS + " = $PLACEHOLDER_VALUE;";
|
||||
|
||||
|
@ -116,6 +114,29 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" ajax.prototype._flutter_inappbrowser_password = null;" +
|
||||
" ajax.prototype._flutter_inappbrowser_already_onreadystatechange_wrapped = false;" +
|
||||
" ajax.prototype._flutter_inappbrowser_request_headers = {};" +
|
||||
" function convertRequestResponse(request, callback) {" +
|
||||
" if (request.response != null && request.responseType != null) {" +
|
||||
" switch (request.responseType) {" +
|
||||
" case 'arraybuffer':" +
|
||||
" callback(new Uint8Array(request.response));" +
|
||||
" return;" +
|
||||
" case 'blob':" +
|
||||
" const reader = new FileReader();" +
|
||||
" reader.addEventListener('loadend', function() { " +
|
||||
" callback(new Uint8Array(reader.result));" +
|
||||
" });" +
|
||||
" reader.readAsArrayBuffer(blob);" +
|
||||
" return;" +
|
||||
" case 'document':" +
|
||||
" callback(request.response.documentElement.outerHTML);" +
|
||||
" return;" +
|
||||
" case 'json':" +
|
||||
" callback(request.response);" +
|
||||
" return;" +
|
||||
" };" +
|
||||
" }" +
|
||||
" callback(null);" +
|
||||
" };" +
|
||||
" ajax.prototype.open = function(method, url, isAsync, user, password) {" +
|
||||
" isAsync = (isAsync != null) ? isAsync : true;" +
|
||||
" this._flutter_inappbrowser_url = url;" +
|
||||
|
@ -143,36 +164,40 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" responseHeaders[header] = value;" +
|
||||
" });" +
|
||||
" }" +
|
||||
" var ajaxRequest = {" +
|
||||
" method: this._flutter_inappbrowser_method," +
|
||||
" url: this._flutter_inappbrowser_url," +
|
||||
" isAsync: this._flutter_inappbrowser_isAsync," +
|
||||
" user: this._flutter_inappbrowser_user," +
|
||||
" password: this._flutter_inappbrowser_password," +
|
||||
" withCredentials: this.withCredentials," +
|
||||
" headers: this._flutter_inappbrowser_request_headers," +
|
||||
" readyState: this.readyState," +
|
||||
" status: this.status," +
|
||||
" responseURL: this.responseURL," +
|
||||
" responseType: this.responseType," +
|
||||
" responseText: this.responseText," +
|
||||
" statusText: this.statusText," +
|
||||
" responseHeaders, responseHeaders," +
|
||||
" event: {" +
|
||||
" type: e.type," +
|
||||
" loaded: e.loaded," +
|
||||
" lengthComputable: e.lengthComputable," +
|
||||
" total: e.total" +
|
||||
" }" +
|
||||
" };" +
|
||||
" window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxProgress', ajaxRequest).then(function(result) {" +
|
||||
" if (result != null) {" +
|
||||
" switch (result) {" +
|
||||
" case 0:" +
|
||||
" self.abort();" +
|
||||
" return;" +
|
||||
" };" +
|
||||
" }" +
|
||||
" convertRequestResponse(this, function(response) {" +
|
||||
" var ajaxRequest = {" +
|
||||
" method: self._flutter_inappbrowser_method," +
|
||||
" url: self._flutter_inappbrowser_url," +
|
||||
" isAsync: self._flutter_inappbrowser_isAsync," +
|
||||
" user: self._flutter_inappbrowser_user," +
|
||||
" password: self._flutter_inappbrowser_password," +
|
||||
" withCredentials: self.withCredentials," +
|
||||
" headers: self._flutter_inappbrowser_request_headers," +
|
||||
" readyState: self.readyState," +
|
||||
" status: self.status," +
|
||||
" responseURL: self.responseURL," +
|
||||
" responseType: self.responseType," +
|
||||
" response: response," +
|
||||
" responseText: (self.responseType == 'text' || self.responseType == '') ? self.responseText : null," +
|
||||
" responseXML: (self.responseType == 'document' && self.responseXML != null) ? self.responseXML.documentElement.outerHTML : null," +
|
||||
" statusText: self.statusText," +
|
||||
" responseHeaders, responseHeaders," +
|
||||
" event: {" +
|
||||
" type: e.type," +
|
||||
" loaded: e.loaded," +
|
||||
" lengthComputable: e.lengthComputable," +
|
||||
" total: e.total" +
|
||||
" }" +
|
||||
" };" +
|
||||
" window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxProgress', ajaxRequest).then(function(result) {" +
|
||||
" if (result != null) {" +
|
||||
" switch (result) {" +
|
||||
" case 0:" +
|
||||
" self.abort();" +
|
||||
" return;" +
|
||||
" };" +
|
||||
" }" +
|
||||
" });" +
|
||||
" });" +
|
||||
" }" +
|
||||
" };" +
|
||||
|
@ -195,33 +220,37 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" responseHeaders[header] = value;" +
|
||||
" });" +
|
||||
" }" +
|
||||
" var ajaxRequest = {" +
|
||||
" method: this._flutter_inappbrowser_method," +
|
||||
" url: this._flutter_inappbrowser_url," +
|
||||
" isAsync: this._flutter_inappbrowser_isAsync," +
|
||||
" user: this._flutter_inappbrowser_user," +
|
||||
" password: this._flutter_inappbrowser_password," +
|
||||
" withCredentials: this.withCredentials," +
|
||||
" headers: this._flutter_inappbrowser_request_headers," +
|
||||
" readyState: this.readyState," +
|
||||
" status: this.status," +
|
||||
" responseURL: this.responseURL," +
|
||||
" responseType: this.responseType," +
|
||||
" responseText: this.responseText," +
|
||||
" statusText: this.statusText," +
|
||||
" responseHeaders: responseHeaders" +
|
||||
" };" +
|
||||
" window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxReadyStateChange', ajaxRequest).then(function(result) {" +
|
||||
" if (result != null) {" +
|
||||
" switch (result) {" +
|
||||
" case 0:" +
|
||||
" self.abort();" +
|
||||
" return;" +
|
||||
" };" +
|
||||
" }" +
|
||||
" if (onreadystatechange != null) {" +
|
||||
" onreadystatechange();" +
|
||||
" }" +
|
||||
" convertRequestResponse(this, function(response) {" +
|
||||
" var ajaxRequest = {" +
|
||||
" method: self._flutter_inappbrowser_method," +
|
||||
" url: self._flutter_inappbrowser_url," +
|
||||
" isAsync: self._flutter_inappbrowser_isAsync," +
|
||||
" user: self._flutter_inappbrowser_user," +
|
||||
" password: self._flutter_inappbrowser_password," +
|
||||
" withCredentials: self.withCredentials," +
|
||||
" headers: self._flutter_inappbrowser_request_headers," +
|
||||
" readyState: self.readyState," +
|
||||
" status: self.status," +
|
||||
" responseURL: self.responseURL," +
|
||||
" responseType: self.responseType," +
|
||||
" response: response," +
|
||||
" responseText: (self.responseType == 'text' || self.responseType == '') ? self.responseText : null," +
|
||||
" responseXML: (self.responseType == 'document' && self.responseXML != null) ? self.responseXML.documentElement.outerHTML : null," +
|
||||
" statusText: self.statusText," +
|
||||
" responseHeaders: responseHeaders" +
|
||||
" };" +
|
||||
" window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxReadyStateChange', ajaxRequest).then(function(result) {" +
|
||||
" if (result != null) {" +
|
||||
" switch (result) {" +
|
||||
" case 0:" +
|
||||
" self.abort();" +
|
||||
" return;" +
|
||||
" };" +
|
||||
" }" +
|
||||
" if (onreadystatechange != null) {" +
|
||||
" onreadystatechange();" +
|
||||
" }" +
|
||||
" });" +
|
||||
" });" +
|
||||
" } else if (onreadystatechange != null) {" +
|
||||
" onreadystatechange();" +
|
||||
|
@ -243,7 +272,8 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" user: this._flutter_inappbrowser_user," +
|
||||
" password: this._flutter_inappbrowser_password," +
|
||||
" withCredentials: this.withCredentials," +
|
||||
" headers: this._flutter_inappbrowser_request_headers" +
|
||||
" headers: this._flutter_inappbrowser_request_headers," +
|
||||
" responseType: this.responseType" +
|
||||
" };" +
|
||||
" window." + JavaScriptBridgeInterface.name + ".callHandler('shouldInterceptAjaxRequest', ajaxRequest).then(function(result) {" +
|
||||
" if (result != null) {" +
|
||||
|
@ -254,6 +284,9 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" };" +
|
||||
" data = result.data;" +
|
||||
" self.withCredentials = result.withCredentials;" +
|
||||
" if (result.responseType != null) {" +
|
||||
" self.responseType = result.responseType;" +
|
||||
" };" +
|
||||
" for (var header in result.headers) {" +
|
||||
" var value = result.headers[header];" +
|
||||
" self.setRequestHeader(header, value);" +
|
||||
|
|
|
@ -184,12 +184,6 @@ public class InAppWebViewClient extends WebViewClient {
|
|||
view.clearFocus();
|
||||
view.requestFocus();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
webView.evaluateJavascript(InAppWebView.platformReadyJS, (ValueCallback<String>) null);
|
||||
} else {
|
||||
webView.loadUrl("javascript:" + InAppWebView.platformReadyJS.replaceAll("[\r\n]+", ""));
|
||||
}
|
||||
|
||||
Map<String, Object> obj = new HashMap<>();
|
||||
if (inAppBrowserActivity != null)
|
||||
obj.put("uuid", inAppBrowserActivity.uuid);
|
||||
|
|
|
@ -77,26 +77,23 @@
|
|||
window.location = "#foo-" + randomNumber;
|
||||
}
|
||||
|
||||
window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
console.log("ready");
|
||||
|
||||
window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
//console.log(result, typeof result);
|
||||
//console.log(JSON.stringify(result), result.bar);
|
||||
});
|
||||
|
||||
window.flutter_inappbrowser.callHandler('handlerFooWithArgs', 1, true, ['bar', 5], {foo: 'baz'}).then(function(result) {
|
||||
//console.log(result, typeof result);
|
||||
//console.log(JSON.stringify(result));
|
||||
});
|
||||
window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result), result.bar);
|
||||
});
|
||||
|
||||
window.flutter_inappbrowser.callHandler('handlerFooWithArgs', 1, true, ['bar', 5], {foo: 'baz'}).then(function(result) {
|
||||
console.log(result, typeof result);
|
||||
console.log(JSON.stringify(result));
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
console.log("jQuery ready");
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.addEventListener("load", function() {
|
||||
console.log(this.responseText);
|
||||
console.log(this.response);
|
||||
});
|
||||
xhttp.open("POST", "http://192.168.1.20:8082/test-ajax-post");
|
||||
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
|
|
|
@ -290,16 +290,19 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
|||
},
|
||||
shouldInterceptAjaxRequest: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
print("AJAX REQUEST: ${ajaxRequest.method} - ${ajaxRequest.url}, DATA: ${ajaxRequest.data}");
|
||||
if (ajaxRequest.url == "http://192.168.1.20:8082/test-ajax-post") {
|
||||
ajaxRequest.responseType = 'json';
|
||||
}
|
||||
// ajaxRequest.method = "GET";
|
||||
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
|
||||
// ajaxRequest.headers = {
|
||||
// "Custom-Header": "Custom-Value"
|
||||
// };
|
||||
// return ajaxRequest;
|
||||
return null;
|
||||
return ajaxRequest;
|
||||
},
|
||||
onAjaxReadyStateChange: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
print("AJAX READY STATE CHANGE: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.status}, ${ajaxRequest.readyState}, ${ajaxRequest.responseType}, ${ajaxRequest.responseText}, ${ajaxRequest.responseHeaders}");
|
||||
print("AJAX READY STATE CHANGE: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.status}, ${ajaxRequest.readyState}, ${ajaxRequest.responseType}, ${ajaxRequest.responseText}, ${ajaxRequest.response}, ${ajaxRequest.responseHeaders}");
|
||||
return AjaxRequestAction.PROCEED;
|
||||
},
|
||||
onAjaxProgress: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
|
|
|
@ -82,8 +82,6 @@ window.\(JAVASCRIPT_BRIDGE_NAME).callHandler = function() {
|
|||
}
|
||||
"""
|
||||
|
||||
let platformReadyJS = "window.dispatchEvent(new Event('flutterInAppBrowserPlatformReady'));";
|
||||
|
||||
let findTextHighlightJS = """
|
||||
var wkwebview_SearchResultCount = 0;
|
||||
var wkwebview_CurrentHighlight = 0;
|
||||
|
@ -266,6 +264,29 @@ let interceptAjaxRequestsJS = """
|
|||
ajax.prototype._flutter_inappbrowser_password = null;
|
||||
ajax.prototype._flutter_inappbrowser_already_onreadystatechange_wrapped = false;
|
||||
ajax.prototype._flutter_inappbrowser_request_headers = {};
|
||||
function convertRequestResponse(request, callback) {
|
||||
if (request.response != null && request.responseType != null) {
|
||||
switch (request.responseType) {
|
||||
case 'arraybuffer':
|
||||
callback(new Uint8Array(request.response));
|
||||
return;
|
||||
case 'blob':
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('loadend', function() {
|
||||
callback(new Uint8Array(reader.result));
|
||||
});
|
||||
reader.readAsArrayBuffer(blob);
|
||||
return;
|
||||
case 'document':
|
||||
callback(request.response.documentElement.outerHTML);
|
||||
return;
|
||||
case 'json':
|
||||
callback(request.response);
|
||||
return;
|
||||
};
|
||||
}
|
||||
callback(null);
|
||||
};
|
||||
ajax.prototype.open = function(method, url, isAsync, user, password) {
|
||||
isAsync = (isAsync != null) ? isAsync : true;
|
||||
this._flutter_inappbrowser_url = url;
|
||||
|
@ -293,36 +314,40 @@ let interceptAjaxRequestsJS = """
|
|||
responseHeaders[header] = value;
|
||||
});
|
||||
}
|
||||
var ajaxRequest = {
|
||||
method: this._flutter_inappbrowser_method,
|
||||
url: this._flutter_inappbrowser_url,
|
||||
isAsync: this._flutter_inappbrowser_isAsync,
|
||||
user: this._flutter_inappbrowser_user,
|
||||
password: this._flutter_inappbrowser_password,
|
||||
withCredentials: this.withCredentials,
|
||||
headers: this._flutter_inappbrowser_request_headers,
|
||||
readyState: this.readyState,
|
||||
status: this.status,
|
||||
responseURL: this.responseURL,
|
||||
responseType: this.responseType,
|
||||
responseText: this.responseText,
|
||||
statusText: this.statusText,
|
||||
responseHeaders, responseHeaders,
|
||||
event: {
|
||||
type: e.type,
|
||||
loaded: e.loaded,
|
||||
lengthComputable: e.lengthComputable,
|
||||
total: e.total
|
||||
}
|
||||
};
|
||||
window.\(JAVASCRIPT_BRIDGE_NAME).callHandler('onAjaxProgress', ajaxRequest).then(function(result) {
|
||||
if (result != null) {
|
||||
switch (result) {
|
||||
case 0:
|
||||
self.abort();
|
||||
return;
|
||||
};
|
||||
}
|
||||
convertRequestResponse(this, function(response) {
|
||||
var ajaxRequest = {
|
||||
method: self._flutter_inappbrowser_method,
|
||||
url: self._flutter_inappbrowser_url,
|
||||
isAsync: self._flutter_inappbrowser_isAsync,
|
||||
user: self._flutter_inappbrowser_user,
|
||||
password: self._flutter_inappbrowser_password,
|
||||
withCredentials: self.withCredentials,
|
||||
headers: self._flutter_inappbrowser_request_headers,
|
||||
readyState: self.readyState,
|
||||
status: self.status,
|
||||
responseURL: self.responseURL,
|
||||
responseType: self.responseType,
|
||||
response: response,
|
||||
responseText: (self.responseType == 'text' || self.responseType == '') ? self.responseText : null,
|
||||
responseXML: (self.responseType == 'document' && self.responseXML != null) ? self.responseXML.documentElement.outerHTML : null,
|
||||
statusText: self.statusText,
|
||||
responseHeaders, responseHeaders,
|
||||
event: {
|
||||
type: e.type,
|
||||
loaded: e.loaded,
|
||||
lengthComputable: e.lengthComputable,
|
||||
total: e.total
|
||||
}
|
||||
};
|
||||
window.\(JAVASCRIPT_BRIDGE_NAME).callHandler('onAjaxProgress', ajaxRequest).then(function(result) {
|
||||
if (result != null) {
|
||||
switch (result) {
|
||||
case 0:
|
||||
self.abort();
|
||||
return;
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -345,33 +370,37 @@ let interceptAjaxRequestsJS = """
|
|||
responseHeaders[header] = value;
|
||||
});
|
||||
}
|
||||
var ajaxRequest = {
|
||||
method: this._flutter_inappbrowser_method,
|
||||
url: this._flutter_inappbrowser_url,
|
||||
isAsync: this._flutter_inappbrowser_isAsync,
|
||||
user: this._flutter_inappbrowser_user,
|
||||
password: this._flutter_inappbrowser_password,
|
||||
withCredentials: this.withCredentials,
|
||||
headers: this._flutter_inappbrowser_request_headers,
|
||||
readyState: this.readyState,
|
||||
status: this.status,
|
||||
responseURL: this.responseURL,
|
||||
responseType: this.responseType,
|
||||
responseText: this.responseText,
|
||||
statusText: this.statusText,
|
||||
responseHeaders: responseHeaders
|
||||
};
|
||||
window.\(JAVASCRIPT_BRIDGE_NAME).callHandler('onAjaxReadyStateChange', ajaxRequest).then(function(result) {
|
||||
if (result != null) {
|
||||
switch (result) {
|
||||
case 0:
|
||||
self.abort();
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (onreadystatechange != null) {
|
||||
onreadystatechange();
|
||||
}
|
||||
convertRequestResponse(this, function(response) {
|
||||
var ajaxRequest = {
|
||||
method: self._flutter_inappbrowser_method,
|
||||
url: self._flutter_inappbrowser_url,
|
||||
isAsync: self._flutter_inappbrowser_isAsync,
|
||||
user: self._flutter_inappbrowser_user,
|
||||
password: self._flutter_inappbrowser_password,
|
||||
withCredentials: self.withCredentials,
|
||||
headers: self._flutter_inappbrowser_request_headers,
|
||||
readyState: self.readyState,
|
||||
status: self.status,
|
||||
responseURL: self.responseURL,
|
||||
responseType: self.responseType,
|
||||
response: response,
|
||||
responseText: (self.responseType == 'text' || self.responseType == '') ? self.responseText : null,
|
||||
responseXML: (self.responseType == 'document' && self.responseXML != null) ? self.responseXML.documentElement.outerHTML : null,
|
||||
statusText: self.statusText,
|
||||
responseHeaders: responseHeaders
|
||||
};
|
||||
window.\(JAVASCRIPT_BRIDGE_NAME).callHandler('onAjaxReadyStateChange', ajaxRequest).then(function(result) {
|
||||
if (result != null) {
|
||||
switch (result) {
|
||||
case 0:
|
||||
self.abort();
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (onreadystatechange != null) {
|
||||
onreadystatechange();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (onreadystatechange != null) {
|
||||
onreadystatechange();
|
||||
|
@ -393,7 +422,8 @@ let interceptAjaxRequestsJS = """
|
|||
user: this._flutter_inappbrowser_user,
|
||||
password: this._flutter_inappbrowser_password,
|
||||
withCredentials: this.withCredentials,
|
||||
headers: this._flutter_inappbrowser_request_headers
|
||||
headers: this._flutter_inappbrowser_request_headers,
|
||||
responseType: this.responseType
|
||||
};
|
||||
window.\(JAVASCRIPT_BRIDGE_NAME).callHandler('shouldInterceptAjaxRequest', ajaxRequest).then(function(result) {
|
||||
if (result != null) {
|
||||
|
@ -404,6 +434,9 @@ let interceptAjaxRequestsJS = """
|
|||
};
|
||||
data = result.data;
|
||||
self.withCredentials = result.withCredentials;
|
||||
if (result.responseType != null) {
|
||||
self.responseType = result.responseType;
|
||||
};
|
||||
for (var header in result.headers) {
|
||||
var value = result.headers[header];
|
||||
self.setRequestHeader(header, value);
|
||||
|
@ -1310,7 +1343,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
|||
currentURL = url
|
||||
InAppWebView.credentialsProposed = []
|
||||
onLoadStop(url: (currentURL?.absoluteString)!)
|
||||
evaluateJavaScript(platformReadyJS, completionHandler: nil)
|
||||
|
||||
if IABController != nil {
|
||||
IABController!.updateUrlTextField(url: (currentURL?.absoluteString)!)
|
||||
|
|
|
@ -578,8 +578,9 @@ class InAppWebViewController {
|
|||
String password = argMap["password"];
|
||||
bool withCredentials = argMap["withCredentials"];
|
||||
Map<dynamic, dynamic> headers = argMap["headers"];
|
||||
String responseType = argMap["responseType"];
|
||||
|
||||
var request = new AjaxRequest(data: data, method: method, url: url, isAsync: isAsync, user: user, password: password, withCredentials: withCredentials, headers: headers);
|
||||
var request = new AjaxRequest(data: data, method: method, url: url, isAsync: isAsync, user: user, password: password, withCredentials: withCredentials, headers: headers, responseType: responseType);
|
||||
|
||||
if (_widget != null && _widget.shouldInterceptAjaxRequest != null)
|
||||
return jsonEncode(await _widget.shouldInterceptAjaxRequest(this, request));
|
||||
|
@ -600,13 +601,15 @@ class InAppWebViewController {
|
|||
int status = argMap["status"];
|
||||
String responseURL = argMap["responseURL"];
|
||||
String responseType = argMap["responseType"];
|
||||
dynamic response = argMap["response"];
|
||||
String responseText = argMap["responseText"];
|
||||
String responseXML = argMap["responseXML"];
|
||||
String statusText = argMap["statusText"];
|
||||
Map<dynamic, dynamic> responseHeaders = argMap["responseHeaders"];
|
||||
|
||||
var request = new AjaxRequest(data: data, method: method, url: url, isAsync: isAsync, user: user, password: password,
|
||||
withCredentials: withCredentials, headers: headers, readyState: AjaxRequestReadyState.fromValue(readyState), status: status, responseURL: responseURL,
|
||||
responseType: responseType, responseText: responseText, statusText: statusText, responseHeaders: responseHeaders);
|
||||
responseType: responseType, response: response, responseText: responseText, responseXML: responseXML, statusText: statusText, responseHeaders: responseHeaders);
|
||||
|
||||
if (_widget != null && _widget.onAjaxReadyStateChange != null)
|
||||
return jsonEncode(await _widget.onAjaxReadyStateChange(this, request));
|
||||
|
@ -627,7 +630,9 @@ class InAppWebViewController {
|
|||
int status = argMap["status"];
|
||||
String responseURL = argMap["responseURL"];
|
||||
String responseType = argMap["responseType"];
|
||||
dynamic response = argMap["response"];
|
||||
String responseText = argMap["responseText"];
|
||||
String responseXML = argMap["responseXML"];
|
||||
String statusText = argMap["statusText"];
|
||||
Map<dynamic, dynamic> responseHeaders = argMap["responseHeaders"];
|
||||
Map<dynamic, dynamic> eventMap = argMap["event"];
|
||||
|
@ -636,7 +641,7 @@ class InAppWebViewController {
|
|||
|
||||
var request = new AjaxRequest(data: data, method: method, url: url, isAsync: isAsync, user: user, password: password,
|
||||
withCredentials: withCredentials, headers: headers, readyState: AjaxRequestReadyState.fromValue(readyState), status: status, responseURL: responseURL,
|
||||
responseType: responseType, responseText: responseText, statusText: statusText, responseHeaders: responseHeaders, event: event);
|
||||
responseType: responseType, response: response, responseText: responseText, responseXML: responseXML, statusText: statusText, responseHeaders: responseHeaders, event: event);
|
||||
|
||||
if (_widget != null && _widget.onAjaxProgress != null)
|
||||
return jsonEncode(await _widget.onAjaxProgress(this, request));
|
||||
|
@ -1106,14 +1111,6 @@ class InAppWebViewController {
|
|||
///The JavaScript function that can be used to call the handler is `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)`, where `args` are [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
|
||||
///The `args` will be stringified automatically using `JSON.stringify(args)` method and then they will be decoded on the Dart side.
|
||||
///
|
||||
///In order to call `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)` properly, you need to wait and listen the JavaScript event `flutterInAppBrowserPlatformReady`.
|
||||
///This event will be dispatch as soon as the platform (Android or iOS) is ready to handle the `callHandler` method.
|
||||
///```javascript
|
||||
/// window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
/// console.log("ready");
|
||||
/// });
|
||||
///```
|
||||
///
|
||||
///`window.flutter_inappbrowser.callHandler` returns a JavaScript [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
||||
///that can be used to get the json result returned by [JavaScriptHandlerCallback].
|
||||
///In this case, simply return data that you want to send and it will be automatically json encoded using [jsonEncode] from the `dart:convert` library.
|
||||
|
@ -1121,7 +1118,6 @@ class InAppWebViewController {
|
|||
///So, on the JavaScript side, to get data coming from the Dart side, you will use:
|
||||
///```html
|
||||
///<script>
|
||||
/// window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
|
||||
/// window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
|
||||
/// console.log(result, typeof result);
|
||||
/// console.log(JSON.stringify(result));
|
||||
|
@ -1131,19 +1127,8 @@ class InAppWebViewController {
|
|||
/// console.log(result, typeof result);
|
||||
/// console.log(JSON.stringify(result));
|
||||
/// });
|
||||
/// });
|
||||
///</script>
|
||||
///```
|
||||
///
|
||||
///Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
|
||||
///```dart
|
||||
/// // Inject JavaScript that will receive data back from Flutter
|
||||
/// inAppWebViewController.injectScriptCode("""
|
||||
/// window.flutter_inappbrowser.callHandler('test', 'Text from Javascript').then(function(result) {
|
||||
/// console.log(result);
|
||||
/// });
|
||||
/// """);
|
||||
///```
|
||||
void addJavaScriptHandler({@required String handlerName, @required JavaScriptHandlerCallback callback}) {
|
||||
assert(!javaScriptHandlerForbiddenNames.contains(handlerName));
|
||||
this.javaScriptHandlersMap[handlerName] = (callback);
|
||||
|
|
|
@ -938,7 +938,7 @@ class AjaxRequestReadyState {
|
|||
|
||||
///AjaxRequest class represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
|
||||
class AjaxRequest {
|
||||
///Data passed to as a parameter to the `XMLHttpRequest.send()` method.
|
||||
///Data passed as a parameter to the `XMLHttpRequest.send()` method.
|
||||
dynamic data;
|
||||
///The HTTP request method of the `XMLHttpRequest` request.
|
||||
String method;
|
||||
|
@ -969,8 +969,12 @@ class AjaxRequest {
|
|||
///It also lets the author change the [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
|
||||
///If an empty string is set as the value of responseType, the default value of text is used.
|
||||
String responseType;
|
||||
///The response's body content. The content-type depends on the [AjaxRequest.reponseType].
|
||||
dynamic response;
|
||||
///The text received from a server following a request being sent.
|
||||
String responseText;
|
||||
///The HTML or XML string retrieved by the request or null if the request was unsuccessful, has not yet been sent, or if the data can't be parsed as XML or HTML.
|
||||
String responseXML;
|
||||
///A String containing the response's status message as returned by the HTTP server.
|
||||
///Unlike [AjaxRequest.status] which indicates a numerical status code, this property contains the text of the response status, such as "OK" or "Not Found".
|
||||
///If the request's readyState is in [AjaxRequestReadyState.UNSENT] or [AjaxRequestReadyState.OPENED] state, the value of statusText will be an empty string.
|
||||
|
@ -985,7 +989,7 @@ class AjaxRequest {
|
|||
|
||||
AjaxRequest({this.data, this.method, this.url, this.isAsync, this.user, this.password,
|
||||
this.withCredentials, this.headers, this.readyState, this.status, this.responseURL, this.responseType,
|
||||
this.responseText, this.statusText, this.responseHeaders, this.event, this.action = AjaxRequestAction.PROCEED});
|
||||
this.response, this.responseText, this.responseXML, this.statusText, this.responseHeaders, this.event, this.action = AjaxRequestAction.PROCEED});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
|
@ -1001,7 +1005,9 @@ class AjaxRequest {
|
|||
"status": status,
|
||||
"responseURL": responseURL,
|
||||
"responseType": responseType,
|
||||
"response": response,
|
||||
"responseText": responseText,
|
||||
"responseXML": responseXML,
|
||||
"statusText": statusText,
|
||||
"responseHeaders": responseHeaders,
|
||||
"action": action?.toValue()
|
||||
|
|
Loading…
Reference in New Issue