added onFindResultReceived event, added findAllAsync, findNext and clearMatches methods

This commit is contained in:
Lorenzo Pichilli 2019-11-02 04:16:47 +01:00
parent 1f67e98213
commit 6518697e55
17 changed files with 3897 additions and 3566 deletions

View File

@ -15,47 +15,23 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment=""> <list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/PreferredContentModeOptionType.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/assets/certificate.pfx" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/ca-crt.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/ca-crt.srl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/ca-key.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/ca.cnf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/certificate.pfx" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client1-crt.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client1-csr.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client1-key.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client1.cnf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client2-crt.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client2-csr.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client2-key.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/client2.cnf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/package-lock.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/package.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/server-crt.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/server-csr.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/server-key.pem" afterDir="false" />
<change afterPath="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/server.cnf" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" 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$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.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/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_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/Util.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/Util.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_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$/ios/Classes/FlutterWebViewController.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/FlutterWebViewController.swift" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/CredentialDatabase.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/CredentialDatabase.swift" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" beforeDir="false" afterPath="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ios/Classes/SwiftFlutterPlugin.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/SwiftFlutterPlugin.swift" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/channel_manager.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/channel_manager.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$/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/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$/lib/src/types.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/types.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/webview_options.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/webview_options.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
@ -78,38 +54,17 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state> <state relative-caret-position="405">
<caret column="8" selection-start-column="8" selection-end-column="8" /> <caret line="27" column="92" selection-start-line="27" selection-start-column="92" selection-end-line="27" selection-end-column="92" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-6">
<caret line="22" column="17" selection-start-line="22" selection-start-column="17" selection-end-line="22" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart"> <entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="623"> <state relative-caret-position="296">
<caret line="397" column="54" selection-start-line="397" selection-start-column="54" selection-end-line="397" selection-end-column="54" /> <caret line="679" column="4" selection-start-line="679" selection-start-column="4" selection-end-line="679" selection-end-column="4" />
<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$/lib/src/webview_options.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="42" column="83" selection-start-line="42" selection-start-column="83" selection-end-line="42" selection-end-column="83" />
<folding> <folding>
<element signature="e#0#17#0" expanded="true" /> <element signature="e#0#17#0" expanded="true" />
</folding> </folding>
@ -120,22 +75,22 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/types.dart"> <entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="235">
<caret line="24" column="25" selection-start-line="24" selection-start-column="6" selection-end-line="24" selection-end-column="25" /> <caret line="424" column="64" selection-start-line="424" selection-start-column="64" selection-end-line="424" selection-end-column="64" />
<folding> <folding>
<element signature="e#0#25#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart"> <entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85"> <state relative-caret-position="-60">
<caret line="144" column="16" lean-forward="true" selection-start-line="144" selection-start-column="16" selection-end-line="146" selection-end-column="21" /> <caret line="85" column="43" selection-start-line="85" selection-start-column="43" selection-end-line="85" selection-end-column="43" />
<folding> <folding>
<element signature="e#0#22#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -153,9 +108,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>onSafeBrowsingHit</find>
<find>SafeBrowsingResponse</find>
<find>getDomainName</find>
<find>a</find> <find>a</find>
<find>as</find> <find>as</find>
<find>IABWebViewClient</find> <find>IABWebViewClient</find>
@ -168,7 +120,6 @@
<find>HttpAuthResponse</find> <find>HttpAuthResponse</find>
<find>ClientCertResponse</find> <find>ClientCertResponse</find>
<find>onReceivedServerTrustAuthRequest</find> <find>onReceivedServerTrustAuthRequest</find>
<find>on</find>
<find>ServerTrustAuthResponse</find> <find>ServerTrustAuthResponse</find>
<find>certific</find> <find>certific</find>
<find>CER</find> <find>CER</find>
@ -181,8 +132,12 @@
<find>preferredContentMode</find> <find>preferredContentMode</find>
<find>print</find> <find>print</find>
<find>ConsoleMessageLevel</find> <find>ConsoleMessageLevel</find>
<find>_findLocalPath</find>
<find>onConsoleMessage</find> <find>onConsoleMessage</find>
<find>_findLocalPath</find>
<find>package</find>
<find>on</find>
<find>findAll</find>
<find>getFave</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>activity.getPreferences(0)</replace> <replace>activity.getPreferences(0)</replace>
@ -231,35 +186,34 @@
<option value="$PROJECT_DIR$/android/src/main/AndroidManifest.xml" /> <option value="$PROJECT_DIR$/android/src/main/AndroidManifest.xml" />
<option value="$PROJECT_DIR$/lib/in_app_browser.dart" /> <option value="$PROJECT_DIR$/lib/in_app_browser.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_localhost_server.dart" /> <option value="$PROJECT_DIR$/lib/src/in_app_localhost_server.dart" />
<option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
<option value="$PROJECT_DIR$/lib/src/web_history.dart" /> <option value="$PROJECT_DIR$/lib/src/web_history.dart" />
<option value="$PROJECT_DIR$/example/lib/test.dart" /> <option value="$PROJECT_DIR$/example/lib/test.dart" />
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
<option value="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" /> <option value="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" />
<option value="$PROJECT_DIR$/example/ios/Runner/Info.plist" /> <option value="$PROJECT_DIR$/example/ios/Runner/Info.plist" />
<option value="$PROJECT_DIR$/example/lib/main.dart" /> <option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" /> <option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
<option value="$PROJECT_DIR$/example/assets/index.html" /> <option value="$PROJECT_DIR$/example/assets/index.html" />
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" /> <option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
<option value="$PROJECT_DIR$/lib/src/cookie_manager.dart" />
<option value="$PROJECT_DIR$/lib/src/credentials_database.dart" /> <option value="$PROJECT_DIR$/lib/src/credentials_database.dart" />
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" /> <option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
<option value="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" />
<option value="$PROJECT_DIR$/example/pubspec.yaml" /> <option value="$PROJECT_DIR$/example/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" /> <option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
<option value="$PROJECT_DIR$/pubspec.yaml" /> <option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/src/types.dart" />
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" /> <option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" /> <option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" /> <option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
<option value="$PROJECT_DIR$/lib/src/cookie_manager.dart" />
<option value="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" />
<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$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/example/lib/inline_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" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="1" />
<option name="y" value="23" /> <option name="y" value="23" />
<option name="width" value="1920" /> <option name="width" value="1920" />
<option name="height" value="1057" /> <option name="height" value="1057" />
@ -270,36 +224,17 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="AndroidView"> <pane id="Scope">
<subPane> <subPane subId="Project Files">
<expand> <expand>
<path> <path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" /> <item name="Root" type="cbb8eebc:String" user="Root" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" /> <item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="InAppWebView" type="462c0819:PsiDirectoryNode" />
</path> </path>
</expand> </expand>
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
@ -326,12 +261,31 @@
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="Scope"> <pane id="PackagesPane" />
<subPane subId="Project Files"> <pane id="AndroidView">
<subPane>
<expand> <expand>
<path> <path>
<item name="Root" type="cbb8eebc:String" user="Root" /> <item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" /> <item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="1abcf292:AndroidViewProjectNode" />
<item name="flutter_inappbrowser_android" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="InAppWebView" type="462c0819:PsiDirectoryNode" />
</path> </path>
</expand> </expand>
<select /> <select />
@ -487,10 +441,10 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1" y="23" width="1920" height="1057" extended-state="6" /> <frame x="0" y="23" width="1920" height="1057" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.59067357" visible="true" weight="0.15867944" /> <window_info content_ui="combo" id="Project" order="0" sideWeight="0.59067357" visible="true" weight="0.15867944" />
<window_info id="Structure" order="1" sideWeight="0.40932643" side_tool="true" weight="0.15867944" /> <window_info id="Structure" order="1" sideWeight="0.40932643" side_tool="true" weight="0.15867944" />
<window_info id="Designer" order="2" /> <window_info id="Designer" order="2" />
<window_info id="Build Variants" order="3" side_tool="true" /> <window_info id="Build Variants" order="3" side_tool="true" />
@ -501,7 +455,7 @@
<window_info id="Resources Explorer" order="8" /> <window_info id="Resources Explorer" order="8" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" /> <window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49307775" visible="true" weight="0.4" /> <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49307775" visible="true" weight="0.3253886" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.34196892" /> <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="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -537,20 +491,6 @@
</ignored-roots> </ignored-roots>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<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/assets/page-3.html" /> <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://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/convert/json.dart" />
<entry file="file://$PROJECT_DIR$/example/assets/page-2.html"> <entry file="file://$PROJECT_DIR$/example/assets/page-2.html">
@ -650,16 +590,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/channel_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="6" column="20" selection-start-line="6" selection-start-column="6" selection-end-line="6" selection-end-column="20" />
<folding>
<element signature="e#0#25#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/web_history.dart" /> <entry file="file://$PROJECT_DIR$/lib/src/web_history.dart" />
<entry file="file://$PROJECT_DIR$/README.md"> <entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -687,13 +617,6 @@
</state> </state>
</provider> </provider>
</entry> </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="417">
<caret line="41" column="66" selection-start-line="41" selection-start-column="61" selection-end-line="41" selection-end-column="66" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/ios/Podfile"> <entry file="file://$PROJECT_DIR$/example/ios/Podfile">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="990"> <state relative-caret-position="990">
@ -722,16 +645,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="37" column="18" selection-start-line="37" selection-start-column="18" selection-end-line="37" selection-end-column="18" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/packages/flutter/lib/src/material/dialog.dart"> <entry file="file://$USER_HOME$/flutter/packages/flutter/lib/src/material/dialog.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="307"> <state relative-caret-position="307">
@ -753,16 +666,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="65" column="59" selection-start-line="65" selection-start-column="59" selection-end-line="65" selection-end-column="59" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart"> <entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225"> <state relative-caret-position="225">
@ -775,19 +678,9 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/assets/client1-crt.pem" /> <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$/example/assets/client1-crt.crt" />
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="395">
<caret line="61" column="51" selection-start-line="61" selection-start-column="21" selection-end-line="61" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.lock"> <entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/.packages">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/flutter_inappbrowser.podspec"> <entry file="file://$PROJECT_DIR$/ios/flutter_inappbrowser.podspec">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315"> <state relative-caret-position="315">
@ -816,10 +709,47 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart"> <entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/.packages">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/.gitignore">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="204">
<caret line="66" column="68" selection-start-line="66" selection-start-column="66" selection-end-line="66" selection-end-column="68" /> <caret line="42" column="12" selection-start-line="42" selection-start-column="5" selection-end-line="42" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" column="17" selection-start-line="22" selection-start-column="17" selection-end-line="22" selection-end-column="17" />
</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="302">
<caret line="73" lean-forward="true" selection-start-line="73" selection-end-line="73" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="7" selection-start-line="9" selection-start-column="7" selection-end-line="9" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/channel_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="9" selection-start-line="12" selection-start-column="9" selection-end-line="12" selection-end-column="9" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
@ -828,61 +758,86 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175"> <state relative-caret-position="40">
<caret line="28" column="30" selection-start-line="28" selection-start-column="30" selection-end-line="28" selection-end-column="30" /> <caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
<folding>
<element signature="e#0#20#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"> <provider selected="true" editor-type-id="text-editor">
<state> <state>
<caret column="8" selection-start-column="8" selection-end-column="8" /> <folding>
</state> <element signature="e#0#39#0" expanded="true" />
</provider> </folding>
</entry>
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-6">
<caret line="22" column="17" selection-start-line="22" selection-start-column="17" selection-end-line="22" selection-end-column="17" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart"> <entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175"> <state relative-caret-position="198">
<caret line="42" column="83" selection-start-line="42" selection-start-column="83" selection-end-line="42" selection-end-column="83" /> <caret line="168" column="6" selection-start-line="168" selection-start-column="6" selection-end-line="168" selection-end-column="6" />
<folding> <folding>
<element signature="e#0#17#0" expanded="true" /> <element signature="e#0#17#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="401">
<caret line="426" column="51" selection-start-line="426" selection-start-column="51" selection-end-line="426" selection-end-column="51" />
<folding>
<element signature="e#0#20#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="405">
<caret line="27" column="92" selection-start-line="27" selection-start-column="92" selection-end-line="27" selection-end-column="92" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/types.dart"> <entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="235">
<caret line="24" column="25" selection-start-line="24" selection-start-column="6" selection-end-line="24" selection-end-column="25" /> <caret line="424" column="64" selection-start-line="424" selection-start-column="64" selection-end-line="424" selection-end-column="64" />
<folding> <folding>
<element signature="e#0#25#0" expanded="true" /> <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="623">
<caret line="397" column="54" selection-start-line="397" selection-start-column="54" selection-end-line="397" selection-end-column="54" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart"> <entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85"> <state relative-caret-position="-60">
<caret line="144" column="16" lean-forward="true" selection-start-line="144" selection-start-column="16" selection-end-line="146" selection-end-column="21" /> <caret line="85" column="43" selection-start-line="85" selection-start-column="43" selection-end-line="85" selection-end-column="43" />
<folding> <folding>
<element signature="e#0#22#0" expanded="true" /> <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="296">
<caret line="679" column="4" selection-start-line="679" selection-start-column="4" selection-end-line="679" selection-end-column="4" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>

View File

@ -25,7 +25,7 @@
- Added `clearCache()` method - Added `clearCache()` method
- Added `HttpAuthCredentialDatabase` class - Added `HttpAuthCredentialDatabase` class
- Added `onReceivedServerTrustAuthRequest` and `onReceivedClientCertRequest` events to manage SSL requests - Added `onReceivedServerTrustAuthRequest` and `onReceivedClientCertRequest` events to manage SSL requests
- Added `onFindResultReceived` event, `findAllAsync`, `findNext` and `clearMatches` methods
### BREAKING CHANGES ### BREAKING CHANGES
- Deleted `WebResourceRequest` class - Deleted `WebResourceRequest` class

View File

@ -94,8 +94,6 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
@Override @Override
public void onMethodCall(MethodCall call, final Result result) { public void onMethodCall(MethodCall call, final Result result) {
String source;
String urlFile;
switch (call.method) { switch (call.method) {
case "getUrl": case "getUrl":
result.success((webView != null) ? webView.getUrl() : null); result.success((webView != null) ? webView.getUrl() : null);
@ -108,22 +106,22 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
break; break;
case "loadUrl": case "loadUrl":
if (webView != null) if (webView != null)
webView.loadUrl(call.argument("url").toString(), (Map<String, String>) call.argument("headers"), result); webView.loadUrl((String) call.argument("url"), (Map<String, String>) call.argument("headers"), result);
else else
result.success(false); result.success(false);
break; break;
case "postUrl": case "postUrl":
if (webView != null) if (webView != null)
webView.postUrl(call.argument("url").toString(), (byte[]) call.argument("postData"), result); webView.postUrl((String) call.argument("url"), (byte[]) call.argument("postData"), result);
else else
result.success(false); result.success(false);
break; break;
case "loadData": case "loadData":
{ {
String data = call.argument("data").toString(); String data = (String) call.argument("data");
String mimeType = call.argument("mimeType").toString(); String mimeType = (String) call.argument("mimeType");
String encoding = call.argument("encoding").toString(); String encoding = (String) call.argument("encoding");
String baseUrl = call.argument("baseUrl").toString(); String baseUrl = (String) call.argument("baseUrl");
if (webView != null) if (webView != null)
webView.loadData(data, mimeType, encoding, baseUrl, result); webView.loadData(data, mimeType, encoding, baseUrl, result);
@ -133,13 +131,13 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
break; break;
case "loadFile": case "loadFile":
if (webView != null) if (webView != null)
webView.loadFile(call.argument("url").toString(), (Map<String, String>) call.argument("headers"), result); webView.loadFile((String) call.argument("url"), (Map<String, String>) call.argument("headers"), result);
else else
result.success(false); result.success(false);
break; break;
case "injectScriptCode": case "injectScriptCode":
if (webView != null) { if (webView != null) {
source = call.argument("source").toString(); String source = (String) call.argument("source");
webView.injectScriptCode(source, result); webView.injectScriptCode(source, result);
} }
else { else {
@ -148,21 +146,21 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
break; break;
case "injectScriptFile": case "injectScriptFile":
if (webView != null) { if (webView != null) {
urlFile = call.argument("urlFile").toString(); String urlFile = (String) call.argument("urlFile");
webView.injectScriptFile(urlFile); webView.injectScriptFile(urlFile);
} }
result.success(true); result.success(true);
break; break;
case "injectStyleCode": case "injectStyleCode":
if (webView != null) { if (webView != null) {
source = call.argument("source").toString(); String source = (String) call.argument("source");
webView.injectStyleCode(source); webView.injectStyleCode(source);
} }
result.success(true); result.success(true);
break; break;
case "injectStyleFile": case "injectStyleFile":
if (webView != null) { if (webView != null) {
urlFile = call.argument("urlFile").toString(); String urlFile = (String) call.argument("urlFile");
webView.injectStyleFile(urlFile); webView.injectStyleFile(urlFile);
} }
result.success(true); result.success(true);
@ -267,6 +265,30 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
result.success(false); result.success(false);
} }
break; break;
case "findAllAsync":
if (webView != null) {
String find = (String) call.argument("find");
webView.findAllAsync(find);
}
result.success(true);
break;
case "findNext":
if (webView != null) {
Boolean forward = (Boolean) call.argument("forward");
webView.findNext(forward);
result.success(true);
} else {
result.success(false);
}
break;
case "clearMatches":
if (webView != null) {
webView.clearMatches();
result.success(true);
} else {
result.success(false);
}
break;
case "dispose": case "dispose":
dispose(); dispose();
result.success(true); result.success(true);

View File

@ -499,4 +499,27 @@ public class InAppBrowserActivity extends AppCompatActivity {
else else
result.success(false); result.success(false);
} }
public void findAllAsync(String find) {
if (webView != null)
webView.findAllAsync(find);
}
public void findNext(Boolean forward, MethodChannel.Result result) {
if (webView != null) {
webView.findNext(forward);
result.success(true);
}
else
result.success(false);
}
public void clearMatches(MethodChannel.Result result) {
if (webView != null) {
webView.clearMatches();
result.success(true);
}
else
result.success(false);
}
} }

View File

@ -103,7 +103,7 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
case "open": case "open":
boolean isData = (boolean) call.argument("isData"); boolean isData = (boolean) call.argument("isData");
if (!isData) { if (!isData) {
final String url_final = call.argument("url").toString(); final String url_final = (String) call.argument("url");
final boolean useChromeSafariBrowser = (boolean) call.argument("useChromeSafariBrowser"); final boolean useChromeSafariBrowser = (boolean) call.argument("useChromeSafariBrowser");
@ -174,10 +174,10 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
@Override @Override
public void run() { public void run() {
HashMap<String, Object> options = (HashMap<String, Object>) call.argument("options"); HashMap<String, Object> options = (HashMap<String, Object>) call.argument("options");
String data = call.argument("data").toString(); String data = (String) call.argument("data");
String mimeType = call.argument("mimeType").toString(); String mimeType = (String) call.argument("mimeType");
String encoding = call.argument("encoding").toString(); String encoding = (String) call.argument("encoding");
String baseUrl = call.argument("baseUrl").toString(); String baseUrl = (String) call.argument("baseUrl");
openData(activity, uuid, options, data, mimeType, encoding, baseUrl); openData(activity, uuid, options, data, mimeType, encoding, baseUrl);
result.success(true); result.success(true);
} }
@ -194,42 +194,42 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
result.success(getProgress(uuid)); result.success(getProgress(uuid));
break; break;
case "loadUrl": case "loadUrl":
loadUrl(uuid, call.argument("url").toString(), (Map<String, String>) call.argument("headers"), result); loadUrl(uuid, (String) call.argument("url"), (Map<String, String>) call.argument("headers"), result);
break; break;
case "postUrl": case "postUrl":
postUrl(uuid, call.argument("url").toString(), (byte[]) call.argument("postData"), result); postUrl(uuid, (String) call.argument("url"), (byte[]) call.argument("postData"), result);
break; break;
case "loadData": case "loadData":
{ {
String data = call.argument("data").toString(); String data = (String) call.argument("data");
String mimeType = call.argument("mimeType").toString(); String mimeType = (String) call.argument("mimeType");
String encoding = call.argument("encoding").toString(); String encoding = (String) call.argument("encoding");
String baseUrl = call.argument("baseUrl").toString(); String baseUrl = (String) call.argument("baseUrl");
loadData(uuid, data, mimeType, encoding, baseUrl, result); loadData(uuid, data, mimeType, encoding, baseUrl, result);
} }
break; break;
case "loadFile": case "loadFile":
loadFile(uuid, call.argument("url").toString(), (Map<String, String>) call.argument("headers"), result); loadFile(uuid, (String) call.argument("url"), (Map<String, String>) call.argument("headers"), result);
break; break;
case "close": case "close":
close(activity, uuid, result); close(activity, uuid, result);
break; break;
case "injectScriptCode": case "injectScriptCode":
source = call.argument("source").toString(); source = (String) call.argument("source");
injectScriptCode(uuid, source, result); injectScriptCode(uuid, source, result);
break; break;
case "injectScriptFile": case "injectScriptFile":
urlFile = call.argument("urlFile").toString(); urlFile = (String) call.argument("urlFile");
injectScriptFile(uuid, urlFile); injectScriptFile(uuid, urlFile);
result.success(true); result.success(true);
break; break;
case "injectStyleCode": case "injectStyleCode":
source = call.argument("source").toString(); source = (String) call.argument("source");
injectStyleCode(uuid, source); injectStyleCode(uuid, source);
result.success(true); result.success(true);
break; break;
case "injectStyleFile": case "injectStyleFile":
urlFile = call.argument("urlFile").toString(); urlFile = (String) call.argument("urlFile");
injectStyleFile(uuid, urlFile); injectStyleFile(uuid, urlFile);
result.success(true); result.success(true);
break; break;
@ -318,6 +318,18 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
case "clearClientCertPreferences": case "clearClientCertPreferences":
clearClientCertPreferences(uuid, result); clearClientCertPreferences(uuid, result);
break; break;
case "findAllAsync":
String find = (String) call.argument("find");
findAllAsync(uuid, find);
result.success(true);
break;
case "findNext":
Boolean forward = (Boolean) call.argument("forward");
findNext(uuid, forward, result);
break;
case "clearMatches":
clearMatches(uuid, result);
break;
default: default:
result.notImplemented(); result.notImplemented();
} }
@ -713,10 +725,30 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
inAppBrowserActivity.clearSslPreferences(); inAppBrowserActivity.clearSslPreferences();
} }
private void clearClientCertPreferences(String uuid, Result result) { public void clearClientCertPreferences(String uuid, Result result) {
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid); InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
if (inAppBrowserActivity != null) if (inAppBrowserActivity != null)
inAppBrowserActivity.clearClientCertPreferences(result); inAppBrowserActivity.clearClientCertPreferences(result);
result.success(false); result.success(false);
} }
public void findAllAsync(String uuid, String find) {
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
if (inAppBrowserActivity != null)
inAppBrowserActivity.findAllAsync(find);
}
public void findNext(String uuid, Boolean forward, Result result) {
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
if (inAppBrowserActivity != null)
inAppBrowserActivity.findNext(forward, result);
result.success(false);
}
public void clearMatches(String uuid, Result result) {
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
if (inAppBrowserActivity != null)
inAppBrowserActivity.clearMatches(result);
result.success(false);
}
} }

View File

@ -242,6 +242,19 @@ final public class InAppWebView extends InputAwareWebView {
ContentBlockerAction action = ContentBlockerAction.fromMap(contentBlocker.get("action")); ContentBlockerAction action = ContentBlockerAction.fromMap(contentBlocker.get("action"));
contentBlockerHandler.getRuleList().add(new ContentBlocker(trigger, action)); contentBlockerHandler.getRuleList().add(new ContentBlocker(trigger, action));
} }
setFindListener(new FindListener() {
@Override
public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) {
Map<String, Object> obj = new HashMap<>();
if (inAppBrowserActivity != null)
obj.put("uuid", inAppBrowserActivity.uuid);
obj.put("activeMatchOrdinal", activeMatchOrdinal);
obj.put("numberOfMatches", numberOfMatches);
obj.put("isDoneCounting", isDoneCounting);
getChannel().invokeMethod("onFindResultReceived", obj);
}
});
} }
public void loadUrl(String url, MethodChannel.Result result) { public void loadUrl(String url, MethodChannel.Result result) {

View File

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart'; import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';

789
example/lib/inline_example.screen.dart Normal file → Executable file
View File

@ -1,393 +1,396 @@
import 'dart:convert'; import 'dart:async';
import 'dart:io'; import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart'; import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'package:path_provider/path_provider.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter/services.dart' show rootBundle; import 'package:path_provider/path_provider.dart';
import 'package:flutter/services.dart' show rootBundle;
class InlineExampleScreen extends StatefulWidget {
@override class InlineExampleScreen extends StatefulWidget {
_InlineExampleScreenState createState() => new _InlineExampleScreenState(); @override
} _InlineExampleScreenState createState() => new _InlineExampleScreenState();
}
class Foo {
String bar; class Foo {
String baz; String bar;
String baz;
Foo({this.bar, this.baz});
Foo({this.bar, this.baz});
Map<String, dynamic> toJson() {
return { Map<String, dynamic> toJson() {
'bar': this.bar, return {
'baz': this.baz 'bar': this.bar,
}; 'baz': this.baz
} };
} }
}
class _InlineExampleScreenState extends State<InlineExampleScreen> {
InAppWebViewController webView; class _InlineExampleScreenState extends State<InlineExampleScreen> {
String url = ""; InAppWebViewController webView;
double progress = 0; String url = "";
double progress = 0;
TextEditingController _textFieldController = TextEditingController();
TextEditingController _textFieldController = TextEditingController();
@override
void initState() { @override
super.initState(); void initState() {
} super.initState();
}
@override
void dispose() { @override
super.dispose(); void dispose() {
} super.dispose();
}
@override
Widget build(BuildContext context) { @override
// HttpAuthCredentialDatabase.instance().clearAllAuthCredentials(); Widget build(BuildContext context) {
// // HttpAuthCredentialDatabase.instance().clearAllAuthCredentials();
// HttpAuthCredentialDatabase.instance().getHttpAuthCredentials(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081)).then((credentials) { //
// for (var credential in credentials ) // HttpAuthCredentialDatabase.instance().getHttpAuthCredentials(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081)).then((credentials) {
// print("\n\nCREDENTIAL: ${credential.username} ${credential.password}\n\n"); // for (var credential in credentials )
// }); // print("\n\nCREDENTIAL: ${credential.username} ${credential.password}\n\n");
// HttpAuthCredentialDatabase.instance().getAllAuthCredentials().then((result) { // });
// for (var r in result) { // HttpAuthCredentialDatabase.instance().getAllAuthCredentials().then((result) {
// ProtectionSpace protectionSpace = r["protectionSpace"]; // for (var r in result) {
// print("\n\nProtectionSpace: ${protectionSpace.protocol} ${protectionSpace.host}:"); // ProtectionSpace protectionSpace = r["protectionSpace"];
// List<HttpAuthCredential> credentials = r["credentials"]; // print("\n\nProtectionSpace: ${protectionSpace.protocol} ${protectionSpace.host}:");
// for (var credential in credentials) // List<HttpAuthCredential> credentials = r["credentials"];
// print("\tCREDENTIAL: ${credential.username} ${credential.password}"); // for (var credential in credentials)
// } // print("\tCREDENTIAL: ${credential.username} ${credential.password}");
// }); // }
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 1", password: "password 1")); // });
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 2", password: "password 2")); // HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 1", password: "password 1"));
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 2", password: "password 2"));
return Container(
child: Column(children: <Widget>[ return Container(
Container( child: Column(children: <Widget>[
padding: EdgeInsets.all(20.0), Container(
child: Text( padding: EdgeInsets.all(20.0),
"CURRENT URL\n${(url.length > 50) ? url.substring(0, 50) + "..." : url}"), child: Text(
), "CURRENT URL\n${(url.length > 50) ? url.substring(0, 50) + "..." : url}"),
Container( ),
padding: EdgeInsets.all(10.0), Container(
child: progress < 1.0 ? LinearProgressIndicator(value: progress) : Container() padding: EdgeInsets.all(10.0),
), child: progress < 1.0 ? LinearProgressIndicator(value: progress) : Container()
Expanded( ),
child: Container( Expanded(
margin: const EdgeInsets.all(10.0), child: Container(
decoration: margin: const EdgeInsets.all(10.0),
BoxDecoration(border: Border.all(color: Colors.blueAccent)), decoration:
child: InAppWebView( BoxDecoration(border: Border.all(color: Colors.blueAccent)),
//initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1", child: InAppWebView(
initialUrl: "https://flutter.dev/", //initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1",
//initialUrl: "chrome://safe-browsing/match?type=malware", initialUrl: "https://github.com",
//initialUrl: "http://192.168.1.20:8081/", //initialUrl: "chrome://safe-browsing/match?type=malware",
//initialUrl: "https://192.168.1.20:4433/", //initialUrl: "http://192.168.1.20:8081/",
//initialFile: "assets/index.html", //initialUrl: "https://192.168.1.20:4433/",
initialHeaders: {}, //initialFile: "assets/index.html",
initialOptions: [ initialHeaders: {},
InAppWebViewOptions( initialOptions: [
//clearCache: true, InAppWebViewOptions(
useShouldOverrideUrlLoading: true, //clearCache: true,
useOnTargetBlank: true, useShouldOverrideUrlLoading: true,
//useOnLoadResource: true, useOnTargetBlank: true,
useOnDownloadStart: true, //useOnLoadResource: true,
preferredContentMode: InAppWebViewUserPreferredContentMode.DESKTOP, useOnDownloadStart: true,
resourceCustomSchemes: ["my-special-custom-scheme"], preferredContentMode: InAppWebViewUserPreferredContentMode.DESKTOP,
/*contentBlockers: [ resourceCustomSchemes: ["my-special-custom-scheme"],
ContentBlocker( /*contentBlockers: [
ContentBlockerTrigger(".*", ContentBlocker(
resourceType: [ContentBlockerTriggerResourceType.IMAGE, ContentBlockerTriggerResourceType.STYLE_SHEET], ContentBlockerTrigger(".*",
ifTopUrl: ["https://getbootstrap.com/"]), resourceType: [ContentBlockerTriggerResourceType.IMAGE, ContentBlockerTriggerResourceType.STYLE_SHEET],
ContentBlockerAction(ContentBlockerActionType.BLOCK) ifTopUrl: ["https://getbootstrap.com/"]),
) ContentBlockerAction(ContentBlockerActionType.BLOCK)
]*/ )
), ]*/
AndroidInAppWebViewOptions( ),
databaseEnabled: true, AndroidInAppWebViewOptions(
appCacheEnabled: true, databaseEnabled: true,
domStorageEnabled: true, appCacheEnabled: true,
geolocationEnabled: true, domStorageEnabled: true,
safeBrowsingEnabled: true, geolocationEnabled: true,
//blockNetworkImage: true, safeBrowsingEnabled: true,
), //blockNetworkImage: true,
], ),
onWebViewCreated: (InAppWebViewController controller) { ],
webView = controller; onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
if (Platform.isAndroid)
webView.startSafeBrowsing(); if (Platform.isAndroid)
webView.startSafeBrowsing();
webView.addJavaScriptHandler('handlerFoo', (args) {
return new Foo(bar: 'bar_value', baz: 'baz_value'); webView.addJavaScriptHandler('handlerFoo', (args) {
}); return new Foo(bar: 'bar_value', baz: 'baz_value');
});
webView.addJavaScriptHandler('handlerFooWithArgs', (args) {
print(args); webView.addJavaScriptHandler('handlerFooWithArgs', (args) {
return [args[0] + 5, !args[1], args[2][0], args[3]['foo']]; print(args);
}); return [args[0] + 5, !args[1], args[2][0], args[3]['foo']];
}, });
onLoadStart: (InAppWebViewController controller, String url) { },
print("started $url"); onLoadStart: (InAppWebViewController controller, String url) {
setState(() { print("started $url");
this.url = url; setState(() {
}); this.url = url;
}, });
onLoadStop: (InAppWebViewController controller, String url) async { },
print("stopped $url"); onLoadStop: (InAppWebViewController controller, String url) async {
if (Platform.isAndroid) { print("stopped $url");
controller.clearSslPreferences(); if (Platform.isAndroid) {
controller.clearClientCertPreferences(); controller.clearSslPreferences();
} controller.clearClientCertPreferences();
// controller.injectScriptCode(""" }
// document.getElementById("SEARCH_WORD" + 5).scrollIntoView(); //controller.findAllAsync("a");
// """); controller.getFavicon();
}, },
onLoadError: (InAppWebViewController controller, String url, int code, String message) async { onLoadError: (InAppWebViewController controller, String url, int code, String message) async {
print("error $url: $code, $message"); print("error $url: $code, $message");
}, },
onProgressChanged: onProgressChanged:
(InAppWebViewController controller, int progress) { (InAppWebViewController controller, int progress) {
setState(() { setState(() {
this.progress = progress / 100; this.progress = progress / 100;
}); });
}, },
shouldOverrideUrlLoading: (InAppWebViewController controller, String url) { shouldOverrideUrlLoading: (InAppWebViewController controller, String url) {
print("override $url"); print("override $url");
controller.loadUrl(url); controller.loadUrl(url);
}, },
onLoadResource: (InAppWebViewController controller, WebResourceResponse response) { onLoadResource: (InAppWebViewController controller, WebResourceResponse response) {
print("Resource type: '"+response.initiatorType + "' started at: " + print("Resource type: '"+response.initiatorType + "' started at: " +
response.startTime.toString() + response.startTime.toString() +
"ms ---> duration: " + "ms ---> duration: " +
response.duration.toString() + response.duration.toString() +
"ms " + "ms " +
response.url); response.url);
}, },
onConsoleMessage: (InAppWebViewController controller, ConsoleMessage consoleMessage) { onConsoleMessage: (InAppWebViewController controller, ConsoleMessage consoleMessage) {
print(""" print("""
console output: console output:
sourceURL: ${consoleMessage.sourceURL} sourceURL: ${consoleMessage.sourceURL}
lineNumber: ${consoleMessage.lineNumber} lineNumber: ${consoleMessage.lineNumber}
message: ${consoleMessage.message} message: ${consoleMessage.message}
messageLevel: ${consoleMessage.messageLevel.toValue()} messageLevel: ${consoleMessage.messageLevel.toValue()}
"""); """);
}, },
onDownloadStart: (InAppWebViewController controller, String url) async { onDownloadStart: (InAppWebViewController controller, String url) async {
// final taskId = await FlutterDownloader.enqueue( // final taskId = await FlutterDownloader.enqueue(
// url: url, // url: url,
// savedDir: await _findLocalPath(), // savedDir: await _findLocalPath(),
// showNotification: true, // show download progress in status bar (for Android) // showNotification: true, // show download progress in status bar (for Android)
// openFileFromNotification: true, // click on notification to open downloaded file (for Android) // openFileFromNotification: true, // click on notification to open downloaded file (for Android)
// ); // );
}, },
onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async { onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
if (scheme == "my-special-custom-scheme") { if (scheme == "my-special-custom-scheme") {
var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0)); var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
var asBase64 = base64.encode(bytes.buffer.asUint8List()); var asBase64 = base64.encode(bytes.buffer.asUint8List());
var response = new CustomSchemeResponse(asBase64, "image/svg+xml", contentEnconding: "utf-8"); var response = new CustomSchemeResponse(asBase64, "image/svg+xml", contentEnconding: "utf-8");
return response; return response;
} }
return null; return null;
}, },
onTargetBlank: (InAppWebViewController controller, String url) { onTargetBlank: (InAppWebViewController controller, String url) {
print("target _blank: " + url); print("target _blank: " + url);
controller.loadUrl(url); controller.loadUrl(url);
}, },
onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async { onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
GeolocationPermissionShowPromptResponse response; GeolocationPermissionShowPromptResponse response;
await showDialog( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text("Permission Geolocation API"), title: Text("Permission Geolocation API"),
content: Text("Can we use Geolocation API?"), content: Text("Can we use Geolocation API?"),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: Text("Close"), child: Text("Close"),
onPressed: () { onPressed: () {
response = new GeolocationPermissionShowPromptResponse(origin, false, false); response = new GeolocationPermissionShowPromptResponse(origin, false, false);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
FlatButton( FlatButton(
child: Text("Accept"), child: Text("Accept"),
onPressed: () { onPressed: () {
response = new GeolocationPermissionShowPromptResponse(origin, true, true); response = new GeolocationPermissionShowPromptResponse(origin, true, true);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
], ],
); );
}, },
); );
return response; return response;
}, },
onJsAlert: (InAppWebViewController controller, String message) async { onJsAlert: (InAppWebViewController controller, String message) async {
JsAlertResponseAction action = await createAlertDialog(context, message); JsAlertResponseAction action = await createAlertDialog(context, message);
return new JsAlertResponse(handledByClient: true, action: action); return new JsAlertResponse(handledByClient: true, action: action);
}, },
onJsConfirm: (InAppWebViewController controller, String message) async { onJsConfirm: (InAppWebViewController controller, String message) async {
JsConfirmResponseAction action = await createConfirmDialog(context, message); JsConfirmResponseAction action = await createConfirmDialog(context, message);
return new JsConfirmResponse(handledByClient: true, action: action); return new JsConfirmResponse(handledByClient: true, action: action);
}, },
onJsPrompt: (InAppWebViewController controller, String message, String defaultValue) async { onJsPrompt: (InAppWebViewController controller, String message, String defaultValue) async {
_textFieldController.text = defaultValue; _textFieldController.text = defaultValue;
JsPromptResponseAction action = await createPromptDialog(context, message); JsPromptResponseAction action = await createPromptDialog(context, message);
return new JsPromptResponse(handledByClient: true, action: action, value: _textFieldController.text); return new JsPromptResponse(handledByClient: true, action: action, value: _textFieldController.text);
}, },
onSafeBrowsingHit: (InAppWebViewController controller, String url, SafeBrowsingThreat threatType) async { onSafeBrowsingHit: (InAppWebViewController controller, String url, SafeBrowsingThreat threatType) async {
SafeBrowsingResponseAction action = SafeBrowsingResponseAction.BACK_TO_SAFETY; SafeBrowsingResponseAction action = SafeBrowsingResponseAction.BACK_TO_SAFETY;
return new SafeBrowsingResponse(report: true, action: action); return new SafeBrowsingResponse(report: true, action: action);
}, },
onReceivedHttpAuthRequest: (InAppWebViewController controller, HttpAuthChallenge challenge) async { onReceivedHttpAuthRequest: (InAppWebViewController controller, HttpAuthChallenge challenge) async {
print("HTTP AUTH REQUEST: ${challenge.protectionSpace.host}, realm: ${challenge.protectionSpace.realm}, previous failure count: ${challenge.previousFailureCount.toString()}"); print("HTTP AUTH REQUEST: ${challenge.protectionSpace.host}, realm: ${challenge.protectionSpace.realm}, previous failure count: ${challenge.previousFailureCount.toString()}");
return new HttpAuthResponse(username: "USERNAME", password: "PASSWORD", action: HttpAuthResponseAction.USE_SAVED_HTTP_AUTH_CREDENTIALS, permanentPersistence: true); return new HttpAuthResponse(username: "USERNAME", password: "PASSWORD", action: HttpAuthResponseAction.USE_SAVED_HTTP_AUTH_CREDENTIALS, permanentPersistence: true);
}, },
onReceivedServerTrustAuthRequest: (InAppWebViewController controller, ServerTrustChallenge challenge) async { onReceivedServerTrustAuthRequest: (InAppWebViewController controller, ServerTrustChallenge challenge) async {
print("SERVER TRUST AUTH REQUEST: ${challenge.protectionSpace.host}, SSL ERROR CODE: ${challenge.error.toString()}, MESSAGE: ${challenge.message}"); print("SERVER TRUST AUTH REQUEST: ${challenge.protectionSpace.host}, SSL ERROR CODE: ${challenge.error.toString()}, MESSAGE: ${challenge.message}");
return new ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED); return new ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED);
}, },
onReceivedClientCertRequest: (InAppWebViewController controller, ClientCertChallenge challenge) async { onReceivedClientCertRequest: (InAppWebViewController controller, ClientCertChallenge challenge) async {
print("CLIENT CERT REQUEST: ${challenge.protectionSpace.host}"); print("CLIENT CERT REQUEST: ${challenge.protectionSpace.host}");
return new ClientCertResponse(certificatePath: "assets/certificate.pfx", certificatePassword: "", androidKeyStoreType: "PKCS12", action: ClientCertResponseAction.PROCEED); return new ClientCertResponse(certificatePath: "assets/certificate.pfx", certificatePassword: "", androidKeyStoreType: "PKCS12", action: ClientCertResponseAction.PROCEED);
}, },
), onFindResultReceived: (InAppWebViewController controller, int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) async {
), print("Current highlighted: $activeMatchOrdinal, Number of matches found: $numberOfMatches, find operation completed: $isDoneCounting");
), },
ButtonBar( ),
alignment: MainAxisAlignment.center, ),
children: <Widget>[ ),
RaisedButton( ButtonBar(
child: Icon(Icons.arrow_back), alignment: MainAxisAlignment.center,
onPressed: () { children: <Widget>[
if (webView != null) { RaisedButton(
webView.goBack(); child: Icon(Icons.arrow_back),
} onPressed: () {
}, if (webView != null) {
), webView.goBack();
RaisedButton( }
child: Icon(Icons.arrow_forward), },
onPressed: () { ),
if (webView != null) { RaisedButton(
webView.goForward(); child: Icon(Icons.arrow_forward),
} onPressed: () {
}, if (webView != null) {
), webView.goForward();
RaisedButton( }
child: Icon(Icons.refresh), },
onPressed: () { ),
if (webView != null) { RaisedButton(
webView.reload(); child: Icon(Icons.refresh),
} onPressed: () {
}, if (webView != null) {
), webView.reload();
], }
), },
])); ),
} ],
),
Future<JsAlertResponseAction> createAlertDialog(BuildContext context, String message) async { ]));
JsAlertResponseAction action; }
await showDialog( Future<JsAlertResponseAction> createAlertDialog(BuildContext context, String message) async {
context: context, JsAlertResponseAction action;
builder: (BuildContext context) {
return AlertDialog( await showDialog(
content: Text(message), context: context,
actions: <Widget>[ builder: (BuildContext context) {
FlatButton( return AlertDialog(
child: Text("Ok"), content: Text(message),
onPressed: () { actions: <Widget>[
action = JsAlertResponseAction.CONFIRM; FlatButton(
Navigator.of(context).pop(); child: Text("Ok"),
}, onPressed: () {
), action = JsAlertResponseAction.CONFIRM;
], Navigator.of(context).pop();
); },
}, ),
); ],
);
return action; },
} );
Future<JsConfirmResponseAction> createConfirmDialog(BuildContext context, String message) async { return action;
JsConfirmResponseAction action; }
await showDialog( Future<JsConfirmResponseAction> createConfirmDialog(BuildContext context, String message) async {
context: context, JsConfirmResponseAction action;
builder: (BuildContext context) {
return AlertDialog( await showDialog(
content: Text(message), context: context,
actions: <Widget>[ builder: (BuildContext context) {
FlatButton( return AlertDialog(
child: Text("Cancel"), content: Text(message),
onPressed: () { actions: <Widget>[
action = JsConfirmResponseAction.CANCEL; FlatButton(
Navigator.of(context).pop(); child: Text("Cancel"),
}, onPressed: () {
), action = JsConfirmResponseAction.CANCEL;
FlatButton( Navigator.of(context).pop();
child: Text("Ok"), },
onPressed: () { ),
action = JsConfirmResponseAction.CONFIRM; FlatButton(
Navigator.of(context).pop(); child: Text("Ok"),
}, onPressed: () {
), action = JsConfirmResponseAction.CONFIRM;
], Navigator.of(context).pop();
); },
}, ),
); ],
);
return action; },
} );
Future<JsPromptResponseAction> createPromptDialog(BuildContext context, String message) async { return action;
JsPromptResponseAction action; }
await showDialog( Future<JsPromptResponseAction> createPromptDialog(BuildContext context, String message) async {
context: context, JsPromptResponseAction action;
builder: (BuildContext context) {
return AlertDialog( await showDialog(
title: Text(message), context: context,
content: TextField( builder: (BuildContext context) {
controller: _textFieldController, return AlertDialog(
), title: Text(message),
actions: <Widget>[ content: TextField(
FlatButton( controller: _textFieldController,
child: Text("Cancel"), ),
onPressed: () { actions: <Widget>[
action = JsPromptResponseAction.CANCEL; FlatButton(
Navigator.of(context).pop(); child: Text("Cancel"),
}, onPressed: () {
), action = JsPromptResponseAction.CANCEL;
FlatButton( Navigator.of(context).pop();
child: Text("Ok"), },
onPressed: () { ),
action = JsPromptResponseAction.CONFIRM; FlatButton(
Navigator.of(context).pop(); child: Text("Ok"),
}, onPressed: () {
), action = JsPromptResponseAction.CONFIRM;
], Navigator.of(context).pop();
); },
}, ),
); ],
);
return action; },
} );
Future<String> _findLocalPath() async { return action;
final directory = Platform.isAndroid }
? await getExternalStorageDirectory()
: await getApplicationDocumentsDirectory(); Future<String> _findLocalPath() async {
return directory.path; final directory = Platform.isAndroid
} ? await getExternalStorageDirectory()
} : await getApplicationDocumentsDirectory();
return directory.path;
}
}

View File

@ -1,289 +1,325 @@
// //
// FlutterWebViewController.swift // FlutterWebViewController.swift
// flutter_inappbrowser // flutter_inappbrowser
// //
// Created by Lorenzo on 13/11/18. // Created by Lorenzo on 13/11/18.
// //
import Foundation import Foundation
import WebKit import WebKit
public class FlutterWebViewController: NSObject, FlutterPlatformView { public class FlutterWebViewController: NSObject, FlutterPlatformView {
private weak var registrar: FlutterPluginRegistrar? private weak var registrar: FlutterPluginRegistrar?
var webView: InAppWebView? var webView: InAppWebView?
var viewId: Int64 = 0 var viewId: Int64 = 0
var channel: FlutterMethodChannel? var channel: FlutterMethodChannel?
init(registrar: FlutterPluginRegistrar, withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: NSDictionary) { init(registrar: FlutterPluginRegistrar, withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: NSDictionary) {
super.init() super.init()
self.registrar = registrar self.registrar = registrar
self.viewId = viewId self.viewId = viewId
let initialUrl = (args["initialUrl"] as? String)! let initialUrl = (args["initialUrl"] as? String)!
let initialFile = args["initialFile"] as? String let initialFile = args["initialFile"] as? String
let initialData = args["initialData"] as? [String: String] let initialData = args["initialData"] as? [String: String]
let initialHeaders = (args["initialHeaders"] as? [String: String])! let initialHeaders = (args["initialHeaders"] as? [String: String])!
let initialOptions = (args["initialOptions"] as? [String: Any])! let initialOptions = (args["initialOptions"] as? [String: Any])!
let options = InAppWebViewOptions() let options = InAppWebViewOptions()
options.parse(options: initialOptions) options.parse(options: initialOptions)
let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(options: options) let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(options: options)
webView = InAppWebView(frame: frame, configuration: preWebviewConfiguration, IABController: nil, IAWController: self) webView = InAppWebView(frame: frame, configuration: preWebviewConfiguration, IABController: nil, IAWController: self)
let channelName = "com.pichillilorenzo/flutter_inappwebview_" + String(viewId) let channelName = "com.pichillilorenzo/flutter_inappwebview_" + String(viewId)
self.channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger()) self.channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger())
self.channel?.setMethodCallHandler(self.handle) self.channel?.setMethodCallHandler(self.handle)
webView!.options = options webView!.options = options
webView!.prepare() webView!.prepare()
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
self.webView!.configuration.userContentController.removeAllContentRuleLists() self.webView!.configuration.userContentController.removeAllContentRuleLists()
if let contentBlockers = webView!.options?.contentBlockers, contentBlockers.count > 0 { if let contentBlockers = webView!.options?.contentBlockers, contentBlockers.count > 0 {
do { do {
let jsonData = try JSONSerialization.data(withJSONObject: contentBlockers, options: []) let jsonData = try JSONSerialization.data(withJSONObject: contentBlockers, options: [])
let blockRules = String(data: jsonData, encoding: String.Encoding.utf8) let blockRules = String(data: jsonData, encoding: String.Encoding.utf8)
WKContentRuleListStore.default().compileContentRuleList( WKContentRuleListStore.default().compileContentRuleList(
forIdentifier: "ContentBlockingRules", forIdentifier: "ContentBlockingRules",
encodedContentRuleList: blockRules) { (contentRuleList, error) in encodedContentRuleList: blockRules) { (contentRuleList, error) in
if let error = error { if let error = error {
print(error.localizedDescription) print(error.localizedDescription)
return return
} }
let configuration = self.webView!.configuration let configuration = self.webView!.configuration
configuration.userContentController.add(contentRuleList!) configuration.userContentController.add(contentRuleList!)
self.load(initialUrl: initialUrl, initialFile: initialFile, initialData: initialData, initialHeaders: initialHeaders) self.load(initialUrl: initialUrl, initialFile: initialFile, initialData: initialData, initialHeaders: initialHeaders)
} }
return return
} catch { } catch {
print(error.localizedDescription) print(error.localizedDescription)
} }
} }
} }
load(initialUrl: initialUrl, initialFile: initialFile, initialData: initialData, initialHeaders: initialHeaders) load(initialUrl: initialUrl, initialFile: initialFile, initialData: initialData, initialHeaders: initialHeaders)
} }
public func view() -> UIView { public func view() -> UIView {
return webView! return webView!
} }
public func load(initialUrl: String, initialFile: String?, initialData: [String: String]?, initialHeaders: [String: String]) { public func load(initialUrl: String, initialFile: String?, initialData: [String: String]?, initialHeaders: [String: String]) {
if initialFile != nil { if initialFile != nil {
do { do {
try webView!.loadFile(url: initialFile!, headers: initialHeaders) try webView!.loadFile(url: initialFile!, headers: initialHeaders)
} }
catch let error as NSError { catch let error as NSError {
dump(error) dump(error)
} }
return return
} }
if initialData != nil { if initialData != nil {
let data = (initialData!["data"] as? String)! let data = (initialData!["data"] as? String)!
let mimeType = (initialData!["mimeType"] as? String)! let mimeType = (initialData!["mimeType"] as? String)!
let encoding = (initialData!["encoding"] as? String)! let encoding = (initialData!["encoding"] as? String)!
let baseUrl = (initialData!["baseUrl"] as? String)! let baseUrl = (initialData!["baseUrl"] as? String)!
webView!.loadData(data: data, mimeType: mimeType, encoding: encoding, baseUrl: baseUrl) webView!.loadData(data: data, mimeType: mimeType, encoding: encoding, baseUrl: baseUrl)
} }
else { else {
webView!.loadUrl(url: URL(string: initialUrl)!, headers: initialHeaders) webView!.loadUrl(url: URL(string: initialUrl)!, headers: initialHeaders)
} }
} }
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
let arguments = call.arguments as? NSDictionary let arguments = call.arguments as? NSDictionary
switch call.method { switch call.method {
case "getUrl": case "getUrl":
result( (webView != nil) ? webView!.url?.absoluteString : nil ) result( (webView != nil) ? webView!.url?.absoluteString : nil )
break break
case "getTitle": case "getTitle":
result( (webView != nil) ? webView!.title : nil ) result( (webView != nil) ? webView!.title : nil )
break break
case "getProgress": case "getProgress":
result( (webView != nil) ? Int(webView!.estimatedProgress * 100) : nil ) result( (webView != nil) ? Int(webView!.estimatedProgress * 100) : nil )
break break
case "loadUrl": case "loadUrl":
if webView != nil { if webView != nil {
let url = (arguments!["url"] as? String)! let url = (arguments!["url"] as? String)!
let headers = (arguments!["headers"] as? [String: String])! let headers = (arguments!["headers"] as? [String: String])!
webView!.loadUrl(url: URL(string: url)!, headers: headers) webView!.loadUrl(url: URL(string: url)!, headers: headers)
result(true) result(true)
} }
else { else {
result(false) result(false)
} }
break break
case "postUrl": case "postUrl":
if webView != nil { if webView != nil {
let url = (arguments!["url"] as? String)! let url = (arguments!["url"] as? String)!
let postData = (arguments!["postData"] as? FlutterStandardTypedData)! let postData = (arguments!["postData"] as? FlutterStandardTypedData)!
webView!.postUrl(url: URL(string: url)!, postData: postData.data, completionHandler: { () -> Void in webView!.postUrl(url: URL(string: url)!, postData: postData.data, completionHandler: { () -> Void in
result(true) result(true)
}) })
} }
else { else {
result(false) result(false)
} }
break break
case "loadData": case "loadData":
if webView != nil { if webView != nil {
let data = (arguments!["data"] as? String)! let data = (arguments!["data"] as? String)!
let mimeType = (arguments!["mimeType"] as? String)! let mimeType = (arguments!["mimeType"] as? String)!
let encoding = (arguments!["encoding"] as? String)! let encoding = (arguments!["encoding"] as? String)!
let baseUrl = (arguments!["baseUrl"] as? String)! let baseUrl = (arguments!["baseUrl"] as? String)!
webView!.loadData(data: data, mimeType: mimeType, encoding: encoding, baseUrl: baseUrl) webView!.loadData(data: data, mimeType: mimeType, encoding: encoding, baseUrl: baseUrl)
result(true) result(true)
} }
else { else {
result(false) result(false)
} }
break break
case "loadFile": case "loadFile":
if webView != nil { if webView != nil {
let url = (arguments!["url"] as? String)! let url = (arguments!["url"] as? String)!
let headers = (arguments!["headers"] as? [String: String])! let headers = (arguments!["headers"] as? [String: String])!
do { do {
try webView!.loadFile(url: url, headers: headers) try webView!.loadFile(url: url, headers: headers)
result(true) result(true)
} }
catch let error as NSError { catch let error as NSError {
result(FlutterError(code: "InAppBrowserFlutterPlugin", message: error.domain, details: nil)) result(FlutterError(code: "InAppBrowserFlutterPlugin", message: error.domain, details: nil))
return return
} }
} }
else { else {
result(false) result(false)
} }
break break
case "injectScriptCode": case "injectScriptCode":
if webView != nil { if webView != nil {
let source = (arguments!["source"] as? String)! let source = (arguments!["source"] as? String)!
webView!.injectScriptCode(source: source, result: result) webView!.injectScriptCode(source: source, result: result)
} }
else { else {
result("") result("")
} }
break break
case "injectScriptFile": case "injectScriptFile":
if webView != nil { if webView != nil {
let urlFile = (arguments!["urlFile"] as? String)! let urlFile = (arguments!["urlFile"] as? String)!
webView!.injectScriptFile(urlFile: urlFile) webView!.injectScriptFile(urlFile: urlFile)
} }
result(true) result(true)
break break
case "injectStyleCode": case "injectStyleCode":
if webView != nil { if webView != nil {
let source = (arguments!["source"] as? String)! let source = (arguments!["source"] as? String)!
webView!.injectStyleCode(source: source) webView!.injectStyleCode(source: source)
} }
result(true) result(true)
break break
case "injectStyleFile": case "injectStyleFile":
if webView != nil { if webView != nil {
let urlFile = (arguments!["urlFile"] as? String)! let urlFile = (arguments!["urlFile"] as? String)!
webView!.injectStyleFile(urlFile: urlFile) webView!.injectStyleFile(urlFile: urlFile)
} }
result(true) result(true)
break break
case "reload": case "reload":
if webView != nil { if webView != nil {
webView!.reload() webView!.reload()
} }
result(true) result(true)
break break
case "goBack": case "goBack":
if webView != nil { if webView != nil {
webView!.goBack() webView!.goBack()
} }
result(true) result(true)
break break
case "canGoBack": case "canGoBack":
result((webView != nil) && webView!.canGoBack) result((webView != nil) && webView!.canGoBack)
break break
case "goForward": case "goForward":
if webView != nil { if webView != nil {
webView!.goForward() webView!.goForward()
} }
result(true) result(true)
break break
case "canGoForward": case "canGoForward":
result((webView != nil) && webView!.canGoForward) result((webView != nil) && webView!.canGoForward)
break break
case "goBackOrForward": case "goBackOrForward":
if webView != nil { if webView != nil {
let steps = (arguments!["steps"] as? Int)! let steps = (arguments!["steps"] as? Int)!
webView!.goBackOrForward(steps: steps) webView!.goBackOrForward(steps: steps)
} }
result(true) result(true)
break break
case "canGoBackOrForward": case "canGoBackOrForward":
let steps = (arguments!["steps"] as? Int)! let steps = (arguments!["steps"] as? Int)!
result((webView != nil) && webView!.canGoBackOrForward(steps: steps)) result((webView != nil) && webView!.canGoBackOrForward(steps: steps))
break break
case "stopLoading": case "stopLoading":
if webView != nil { if webView != nil {
webView!.stopLoading() webView!.stopLoading()
} }
result(true) result(true)
break break
case "isLoading": case "isLoading":
result((webView != nil) && webView!.isLoading) result((webView != nil) && webView!.isLoading)
break break
case "takeScreenshot": case "takeScreenshot":
if webView != nil { if webView != nil {
webView!.takeScreenshot(completionHandler: { (screenshot) -> Void in webView!.takeScreenshot(completionHandler: { (screenshot) -> Void in
result(screenshot) result(screenshot)
}) })
} }
else { else {
result(nil) result(nil)
} }
break break
case "setOptions": case "setOptions":
if webView != nil { if webView != nil {
let inAppWebViewOptions = InAppWebViewOptions() let inAppWebViewOptions = InAppWebViewOptions()
let inAppWebViewOptionsMap = arguments!["options"] as! [String: Any] let inAppWebViewOptionsMap = arguments!["options"] as! [String: Any]
inAppWebViewOptions.parse(options: inAppWebViewOptionsMap) inAppWebViewOptions.parse(options: inAppWebViewOptionsMap)
webView!.setOptions(newOptions: inAppWebViewOptions, newOptionsMap: inAppWebViewOptionsMap) webView!.setOptions(newOptions: inAppWebViewOptions, newOptionsMap: inAppWebViewOptionsMap)
} }
result(true) result(true)
break break
case "getOptions": case "getOptions":
result((webView != nil) ? webView!.getOptions() : nil) result((webView != nil) ? webView!.getOptions() : nil)
break break
case "getCopyBackForwardList": case "getCopyBackForwardList":
result((webView != nil) ? webView!.getCopyBackForwardList() : nil) result((webView != nil) ? webView!.getCopyBackForwardList() : nil)
break break
case "clearCache": case "findAllAsync":
if webView != nil { if webView != nil {
webView!.clearCache() let find = arguments!["find"] as! String
} webView!.findAllAsync(find: find, completionHandler: nil)
result(true) result(true)
break } else {
case "dispose": result(false)
dispose() }
result(true) break
break case "findNext":
default: if webView != nil {
result(FlutterMethodNotImplemented) let forward = arguments!["forward"] as! Bool
break webView!.findNext(forward: forward, completionHandler: {(value, error) in
} if error != nil {
} result(FlutterError(code: "FlutterWebViewController", message: error?.localizedDescription, details: nil))
return
public func dispose() { }
if webView != nil { result(true)
webView!.IABController = nil })
webView!.IAWController = nil } else {
webView!.uiDelegate = nil result(false)
webView!.navigationDelegate = nil }
webView!.scrollView.delegate = nil break
webView!.stopLoading() case "clearMatches":
webView = nil if webView != nil {
} webView!.clearMatches(completionHandler: {(value, error) in
} if error != nil {
} result(FlutterError(code: "FlutterWebViewController", message: error?.localizedDescription, details: nil))
return
}
result(true)
})
} else {
result(false)
}
break
case "clearCache":
if webView != nil {
webView!.clearCache()
}
result(true)
break
case "dispose":
dispose()
result(true)
break
default:
result(FlutterMethodNotImplemented)
break
}
}
public func dispose() {
if webView != nil {
webView!.IABController = nil
webView!.IAWController = nil
webView!.uiDelegate = nil
webView!.navigationDelegate = nil
webView!.scrollView.delegate = nil
webView!.stopLoading()
webView = nil
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -239,6 +239,18 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
case "getCopyBackForwardList": case "getCopyBackForwardList":
result(self.getCopyBackForwardList(uuid: uuid)) result(self.getCopyBackForwardList(uuid: uuid))
break break
case "findAllAsync":
let find = arguments!["find"] as! String
self.findAllAsync(uuid: uuid, find: find)
result(true)
break
case "findNext":
let forward = arguments!["forward"] as! Bool
self.findNext(uuid: uuid, forward: forward, result: result)
break
case "clearMatches":
self.clearMatches(uuid: uuid, result: result)
break
case "clearCache": case "clearCache":
self.clearCache(uuid: uuid) self.clearCache(uuid: uuid)
result(true) result(true)
@ -752,6 +764,40 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
return nil return nil
} }
func findAllAsync(uuid: String, find: String) {
if let webViewController = self.webViewControllers[uuid] {
webViewController!.webView.findAllAsync(find: find, completionHandler: nil)
}
}
func findNext(uuid: String, forward: Bool, result: @escaping FlutterResult) {
if let webViewController = self.webViewControllers[uuid] {
webViewController!.webView.findNext(forward: forward, completionHandler: {(value, error) in
if error != nil {
result(FlutterError(code: "FlutterWebViewController", message: error?.localizedDescription, details: nil))
return
}
result(true)
})
} else {
result(false)
}
}
func clearMatches(uuid: String, result: @escaping FlutterResult) {
if let webViewController = self.webViewControllers[uuid] {
webViewController!.webView.clearMatches(completionHandler: {(value, error) in
if error != nil {
result(FlutterError(code: "FlutterWebViewController", message: error?.localizedDescription, details: nil))
return
}
result(true)
})
} else {
result(false)
}
}
func clearCache(uuid: String) { func clearCache(uuid: String) {
if let webViewController = self.webViewControllers[uuid] { if let webViewController = self.webViewControllers[uuid] {
webViewController!.webView.clearCache() webViewController!.webView.clearCache()

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
///Manages the cookies used by WebView instances. ///Manages the cookies used by WebView instances.

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'types.dart'; import 'types.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';

View File

@ -4,7 +4,6 @@ import 'dart:collection';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_inappbrowser/src/webview_options.dart'; import 'package:flutter_inappbrowser/src/webview_options.dart';
import 'http_auth_credentials_database.dart';
import 'types.dart'; import 'types.dart';
import 'channel_manager.dart'; import 'channel_manager.dart';
import 'in_app_webview.dart' show InAppWebViewController; import 'in_app_webview.dart' show InAppWebViewController;
@ -424,6 +423,18 @@ class InAppBrowser {
} }
///Event fired as find-on-page operations progress.
///The listener may be notified multiple times while the operation is underway, and the numberOfMatches value should not be considered final unless [isDoneCounting] is true.
///
///[activeMatchOrdinal] represents the zero-based ordinal of the currently selected match.
///
///[numberOfMatches] represents how many matches have been found.
///
///[isDoneCounting] whether the find operation has actually completed.
void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) {
}
void throwIsAlreadyOpened({String message = ''}) { void throwIsAlreadyOpened({String message = ''}) {
if (this.isOpened()) { if (this.isOpened()) {
throw Exception(['Error: ${ (message.isEmpty) ? '' : message + ' '}The browser is already opened.']); throw Exception(['Error: ${ (message.isEmpty) ? '' : message + ' '}The browser is already opened.']);

2235
lib/src/in_app_webview.dart Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
@ -411,6 +412,20 @@ class ClientCertChallenge {
ClientCertChallenge({@required this.protectionSpace}): assert(protectionSpace != null); ClientCertChallenge({@required this.protectionSpace}): assert(protectionSpace != null);
} }
///
class Favicon {
String url;
String rel;
int width;
int height;
Favicon({@required this.url, this.rel, this.width, this.height}): assert(url != null);
String toString() {
return "url: $url, rel: $rel, width: $width, height: $height";
}
}
/// ///
class AndroidInAppWebViewCacheMode { class AndroidInAppWebViewCacheMode {
final int _value; final int _value;
@ -546,24 +561,3 @@ class iOSSafariOptionsDismissButtonStyle {
static const CLOSE = const iOSSafariOptionsDismissButtonStyle._internal(1); static const CLOSE = const iOSSafariOptionsDismissButtonStyle._internal(1);
static const CANCEL = const iOSSafariOptionsDismissButtonStyle._internal(2); static const CANCEL = const iOSSafariOptionsDismissButtonStyle._internal(2);
} }
typedef onWebViewCreatedCallback = void Function(InAppWebViewController controller);
typedef onWebViewLoadStartCallback = void Function(InAppWebViewController controller, String url);
typedef onWebViewLoadStopCallback = void Function(InAppWebViewController controller, String url);
typedef onWebViewLoadErrorCallback = void Function(InAppWebViewController controller, String url, int code, String message);
typedef onWebViewProgressChangedCallback = void Function(InAppWebViewController controller, int progress);
typedef onWebViewConsoleMessageCallback = void Function(InAppWebViewController controller, ConsoleMessage consoleMessage);
typedef shouldOverrideUrlLoadingCallback = void Function(InAppWebViewController controller, String url);
typedef onWebViewLoadResourceCallback = void Function(InAppWebViewController controller, WebResourceResponse response);
typedef onWebViewScrollChangedCallback = void Function(InAppWebViewController controller, int x, int y);
typedef onDownloadStartCallback = void Function(InAppWebViewController controller, String url);
typedef onLoadResourceCustomSchemeCallback = Future<CustomSchemeResponse> Function(InAppWebViewController controller, String scheme, String url);
typedef onTargetBlankCallback = void Function(InAppWebViewController controller, String url);
typedef onGeolocationPermissionsShowPromptCallback = Future<GeolocationPermissionShowPromptResponse> Function(InAppWebViewController controller, String origin);
typedef onJsAlertCallback = Future<JsAlertResponse> Function(InAppWebViewController controller, String message);
typedef onJsConfirmCallback = Future<JsConfirmResponse> Function(InAppWebViewController controller, String message);
typedef onJsPromptCallback = Future<JsPromptResponse> Function(InAppWebViewController controller, String message, String defaultValue);
typedef onSafeBrowsingHitCallback = Future<SafeBrowsingResponse> Function(InAppWebViewController controller, String url, SafeBrowsingThreat threatType);
typedef onReceivedHttpAuthRequestCallback = Future<HttpAuthResponse> Function(InAppWebViewController controller, HttpAuthChallenge challenge);
typedef onReceivedServerTrustAuthRequestCallback = Future<ServerTrustAuthResponse> Function(InAppWebViewController controller, ServerTrustChallenge challenge);
typedef onReceivedClientCertRequestCallback = Future<ClientCertResponse> Function(InAppWebViewController controller, ClientCertChallenge challenge);