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';

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

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
@ -82,7 +83,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
BoxDecoration(border: Border.all(color: Colors.blueAccent)), BoxDecoration(border: Border.all(color: Colors.blueAccent)),
child: InAppWebView( child: InAppWebView(
//initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1", //initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1",
initialUrl: "https://flutter.dev/", initialUrl: "https://github.com",
//initialUrl: "chrome://safe-browsing/match?type=malware", //initialUrl: "chrome://safe-browsing/match?type=malware",
//initialUrl: "http://192.168.1.20:8081/", //initialUrl: "http://192.168.1.20:8081/",
//initialUrl: "https://192.168.1.20:4433/", //initialUrl: "https://192.168.1.20:4433/",
@ -142,9 +143,8 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
controller.clearSslPreferences(); controller.clearSslPreferences();
controller.clearClientCertPreferences(); controller.clearClientCertPreferences();
} }
// controller.injectScriptCode(""" //controller.findAllAsync("a");
// document.getElementById("SEARCH_WORD" + 5).scrollIntoView(); 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");
@ -260,6 +260,9 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
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");
},
), ),
), ),
), ),

View File

@ -259,6 +259,42 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView {
case "getCopyBackForwardList": case "getCopyBackForwardList":
result((webView != nil) ? webView!.getCopyBackForwardList() : nil) result((webView != nil) ? webView!.getCopyBackForwardList() : nil)
break break
case "findAllAsync":
if webView != nil {
let find = arguments!["find"] as! String
webView!.findAllAsync(find: find, completionHandler: nil)
result(true)
} else {
result(false)
}
break
case "findNext":
if webView != nil {
let forward = arguments!["forward"] as! Bool
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)
}
break
case "clearMatches":
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": case "clearCache":
if webView != nil { if webView != nil {
webView!.clearCache() webView!.clearCache()

View File

@ -82,123 +82,154 @@ window.\(JAVASCRIPT_BRIDGE_NAME).callHandler = function() {
let platformReadyJS = "window.dispatchEvent(new Event('flutterInAppBrowserPlatformReady'));"; let platformReadyJS = "window.dispatchEvent(new Event('flutterInAppBrowserPlatformReady'));";
let searchJavascript = """ let findTextHighlightJS = """
var uiWebview_SearchResultCount = 0; var wkwebview_SearchResultCount = 0;
var wkwebview_CurrentHighlight = 0;
var wkwebview_IsDoneCounting = false;
/*! function wkwebview_FindAllAsyncForElement(element, keyword) {
@method uiWebview_HighlightAllOccurencesOfStringForElement if (element) {
@abstract // helper function, recursively searches in elements and their child nodes if (element.nodeType == 3) {
@discussion // helper function, recursively searches in elements and their child nodes // Text node
element - HTML elements var elementTmp = element;
keyword - string to search while (true) {
*/ var value = elementTmp.nodeValue; // Search for keyword in text node
var idx = value.toLowerCase().indexOf(keyword);
function uiWebview_HighlightAllOccurencesOfStringForElement(element,keyword) { if (idx < 0) break;
if (element) {
if (element.nodeType == 3) { // Text node
var count = 0; var span = document.createElement("span");
var elementTmp = element; var text = document.createTextNode(value.substr(idx, keyword.length));
while (true) { span.appendChild(text);
var value = elementTmp.nodeValue; // Search for keyword in text node
var idx = value.toLowerCase().indexOf(keyword);
if (idx < 0) break; span.setAttribute(
"id",
"WKWEBVIEW_SEARCH_WORD_" + wkwebview_SearchResultCount
);
span.setAttribute("class", "wkwebview_Highlight");
var backgroundColor = wkwebview_SearchResultCount == 0 ? "#FF9732" : "#FFFF00";
span.setAttribute("style", "color: #000 !important; background: " + backgroundColor + " !important; padding: 0px !important; margin: 0px !important; border: 0px !important;");
count++; text = document.createTextNode(value.substr(idx + keyword.length));
elementTmp = document.createTextNode(value.substr(idx+keyword.length)); element.deleteData(idx, value.length - idx);
}
uiWebview_SearchResultCount += count; var next = element.nextSibling;
element.parentNode.insertBefore(span, next);
element.parentNode.insertBefore(text, next);
element = text;
var index = uiWebview_SearchResultCount; wkwebview_SearchResultCount++;
while (true) { elementTmp = document.createTextNode(
var value = element.nodeValue; // Search for keyword in text node value.substr(idx + keyword.length)
var idx = value.toLowerCase().indexOf(keyword); );
if (idx < 0) break; // not found, abort window.webkit.messageHandlers["findResultReceived"].postMessage(
JSON.stringify({
//we create a SPAN element for every parts of matched keywords activeMatchOrdinal: wkwebview_CurrentHighlight,
var span = document.createElement("span"); numberOfMatches: wkwebview_SearchResultCount,
var text = document.createTextNode(value.substr(idx,keyword.length)); isDoneCounting: wkwebview_IsDoneCounting
span.appendChild(text); })
);
span.setAttribute("class","uiWebviewHighlight"); }
span.style.backgroundColor="yellow"; } else if (element.nodeType == 1) {
span.style.color="black"; // Element node
if (
index--; element.style.display != "none" &&
span.setAttribute("id", "SEARCH_WORD"+(index)); element.nodeName.toLowerCase() != "select"
//span.setAttribute("id", "SEARCH_WORD"+uiWebview_SearchResultCount); ) {
for (var i = element.childNodes.length - 1; i >= 0; i--) {
//element.parentNode.setAttribute("id", "SEARCH_WORD"+uiWebview_SearchResultCount); wkwebview_FindAllAsyncForElement(
element.childNodes[element.childNodes.length - 1 - i],
//uiWebview_SearchResultCount++; // update the counter keyword
);
text = document.createTextNode(value.substr(idx+keyword.length));
element.deleteData(idx, value.length - idx);
var next = element.nextSibling;
//alert(element.parentNode);
element.parentNode.insertBefore(span, next);
element.parentNode.insertBefore(text, next);
element = text;
}
} else if (element.nodeType == 1) { // Element node
if (element.style.display != "none" && element.nodeName.toLowerCase() != 'select') {
for (var i=element.childNodes.length-1; i>=0; i--) {
uiWebview_HighlightAllOccurencesOfStringForElement(element.childNodes[i],keyword);
}
}
} }
}
} }
}
} }
// the main entry point to start the search // the main entry point to start the search
function uiWebview_HighlightAllOccurencesOfString(keyword) { function wkwebview_FindAllAsync(keyword) {
uiWebview_RemoveAllHighlights(); wkwebview_ClearMatches();
uiWebview_HighlightAllOccurencesOfStringForElement(document.body, keyword.toLowerCase()); wkwebview_FindAllAsyncForElement(document.body, keyword.toLowerCase());
wkwebview_IsDoneCounting = true;
window.webkit.messageHandlers["findResultReceived"].postMessage(
JSON.stringify({
activeMatchOrdinal: wkwebview_CurrentHighlight,
numberOfMatches: wkwebview_SearchResultCount,
isDoneCounting: wkwebview_IsDoneCounting
})
);
} }
// helper function, recursively removes the highlights in elements and their childs // helper function, recursively removes the highlights in elements and their childs
function uiWebview_RemoveAllHighlightsForElement(element) { function wkwebview_ClearMatchesForElement(element) {
if (element) { if (element) {
if (element.nodeType == 1) { if (element.nodeType == 1) {
if (element.getAttribute("class") == "uiWebviewHighlight") { if (element.getAttribute("class") == "wkwebview_Highlight") {
var text = element.removeChild(element.firstChild); var text = element.removeChild(element.firstChild);
element.parentNode.insertBefore(text,element); element.parentNode.insertBefore(text, element);
element.parentNode.removeChild(element); element.parentNode.removeChild(element);
return true; return true;
} else { } else {
var normalize = false; var normalize = false;
for (var i=element.childNodes.length-1; i>=0; i--) { for (var i = element.childNodes.length - 1; i >= 0; i--) {
if (uiWebview_RemoveAllHighlightsForElement(element.childNodes[i])) { if (wkwebview_ClearMatchesForElement(element.childNodes[i])) {
normalize = true; normalize = true;
} }
}
if (normalize) {
element.normalize();
}
}
} }
if (normalize) {
element.normalize();
}
}
} }
return false; }
return false;
} }
// the main entry point to remove the highlights // the main entry point to remove the highlights
function uiWebview_RemoveAllHighlights() { function wkwebview_ClearMatches() {
uiWebview_SearchResultCount = 0; wkwebview_SearchResultCount = 0;
uiWebview_RemoveAllHighlightsForElement(document.body); wkwebview_CurrentHighlight = 0;
wkwebview_ClearMatchesForElement(document.body);
} }
function uiWebview_ScrollTo(idx) { function wkwebview_FindNext(forward) {
var scrollTo = document.getElementById("SEARCH_WORD" + idx); if (wkwebview_SearchResultCount <= 0) return;
if (scrollTo) scrollTo.scrollIntoView();
}
var idx = wkwebview_CurrentHighlight + (forward ? +1 : -1);
idx =
idx < 0
? wkwebview_SearchResultCount - 1
: idx >= wkwebview_SearchResultCount
? 0
: idx;
wkwebview_CurrentHighlight = idx;
var scrollTo = document.getElementById("WKWEBVIEW_SEARCH_WORD_" + idx);
if (scrollTo) {
var highlights = document.getElementsByClassName("wkwebview_Highlight");
for (var i = 0; i < highlights.length; i++) {
var span = highlights[i];
span.style.backgroundColor = "#FFFF00";
}
scrollTo.style.backgroundColor = "#FF9732";
scrollTo.scrollIntoView({
behavior: "auto",
block: "center"
});
window.webkit.messageHandlers["findResultReceived"].postMessage(
JSON.stringify({
activeMatchOrdinal: wkwebview_CurrentHighlight,
numberOfMatches: wkwebview_SearchResultCount,
isDoneCounting: wkwebview_IsDoneCounting
})
);
}
}
""" """
public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler { public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler {
@ -280,6 +311,10 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
configuration.userContentController.addUserScript(resourceObserverJSScript) configuration.userContentController.addUserScript(resourceObserverJSScript)
configuration.userContentController.add(self, name: "resourceLoaded") configuration.userContentController.add(self, name: "resourceLoaded")
let findTextHighlightJSScript = WKUserScript(source: findTextHighlightJS, injectionTime: .atDocumentStart, forMainFrameOnly: false)
configuration.userContentController.addUserScript(findTextHighlightJSScript)
configuration.userContentController.add(self, name: "findResultReceived")
//keyboardDisplayRequiresUserAction = browserOptions?.keyboardDisplayRequiresUserAction //keyboardDisplayRequiresUserAction = browserOptions?.keyboardDisplayRequiresUserAction
configuration.suppressesIncrementalRendering = (options?.suppressesIncrementalRendering)! configuration.suppressesIncrementalRendering = (options?.suppressesIncrementalRendering)!
@ -330,8 +365,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if (options?.clearCache)! { if (options?.clearCache)! {
clearCache() clearCache()
} }
evaluateJavaScript(searchJavascript, completionHandler: nil)
} }
@available(iOS 10.0, *) @available(iOS 10.0, *)
@ -854,15 +887,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
IABController!.forwardButton.isEnabled = canGoForward IABController!.forwardButton.isEnabled = canGoForward
IABController!.spinner.stopAnimating() IABController!.spinner.stopAnimating()
} }
// findAllAsync("Flutter", completionHandler: {(value, error) in
// if error != nil {
// print(error)
// } else if let foundOccurences: Int = value as! Int {
// print(foundOccurences)
// //self.findNext(to: foundOccurences - 4, completionHandler: nil)
// }
// })
} }
public func webView(_ view: WKWebView, public func webView(_ view: WKWebView,
@ -1342,6 +1366,20 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
} }
} }
public func onFindResultReceived(activeMatchOrdinal: Int, numberOfMatches: Int, isDoneCounting: Bool) {
var arguments: [String : Any] = [
"activeMatchOrdinal": activeMatchOrdinal,
"numberOfMatches": numberOfMatches,
"isDoneCounting": isDoneCounting
]
if IABController != nil {
arguments["uuid"] = IABController!.uuid
}
if let channel = getChannel() {
channel.invokeMethod("onFindResultReceived", arguments: arguments)
}
}
public func onScrollChanged(x: Int, y: Int) { public func onScrollChanged(x: Int, y: Int) {
var arguments: [String: Any] = ["x": x, "y": y] var arguments: [String: Any] = ["x": x, "y": y]
if IABController != nil { if IABController != nil {
@ -1563,6 +1601,14 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
let _callHandlerID = body["_callHandlerID"] as! Int64 let _callHandlerID = body["_callHandlerID"] as! Int64
let args = body["args"] as! String let args = body["args"] as! String
onCallJsHandler(handlerName: handlerName, _callHandlerID: _callHandlerID, args: args) onCallJsHandler(handlerName: handlerName, _callHandlerID: _callHandlerID, args: args)
} else if message.name == "findResultReceived" {
if let resource = convertToDictionary(text: message.body as! String) {
let activeMatchOrdinal = resource["activeMatchOrdinal"] as! Int
let numberOfMatches = resource["numberOfMatches"] as! Int
let isDoneCounting = resource["isDoneCounting"] as! Bool
self.onFindResultReceived(activeMatchOrdinal: activeMatchOrdinal, numberOfMatches: numberOfMatches, isDoneCounting: isDoneCounting)
}
} }
} }
@ -1570,16 +1616,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
return (IABController != nil) ? SwiftFlutterPlugin.instance!.channel! : ((IAWController != nil) ? IAWController!.channel! : nil); return (IABController != nil) ? SwiftFlutterPlugin.instance!.channel! : ((IAWController != nil) ? IAWController!.channel! : nil);
} }
func findAllAsync(_ str: String?, completionHandler: ((Any?, Error?) -> Void)?) { func findAllAsync(find: String?, completionHandler: ((Any?, Error?) -> Void)?) {
let startSearch = "uiWebview_HighlightAllOccurencesOfString('\(str ?? "")'); uiWebview_SearchResultCount" let startSearch = "wkwebview_FindAllAsync('\(find ?? "")');"
evaluateJavaScript(startSearch, completionHandler: completionHandler) evaluateJavaScript(startSearch, completionHandler: completionHandler)
} }
func findNext(to index: Int, completionHandler: ((Any?, Error?) -> Void)?) { func findNext(forward: Bool, completionHandler: ((Any?, Error?) -> Void)?) {
evaluateJavaScript("uiWebview_ScrollTo('\(index)')", completionHandler: completionHandler) evaluateJavaScript("wkwebview_FindNext(\(forward ? "true" : "false"));", completionHandler: completionHandler)
} }
func clearMatches(completionHandler: ((Any?, Error?) -> Void)?) { func clearMatches(completionHandler: ((Any?, Error?) -> Void)?) {
evaluateJavaScript("uiWebview_RemoveAllHighlights()", completionHandler: completionHandler) evaluateJavaScript("wkwebview_ClearMatches();", completionHandler: completionHandler)
} }
} }

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.']);

199
lib/src/in_app_webview.dart Normal file → Executable file
View File

@ -84,58 +84,58 @@ class InAppWebViewInitialData {
class InAppWebView extends StatefulWidget { class InAppWebView extends StatefulWidget {
///Event fires when the [InAppWebView] is created. ///Event fires when the [InAppWebView] is created.
final onWebViewCreatedCallback onWebViewCreated; final void Function(InAppWebViewController controller) onWebViewCreated;
///Event fires when the [InAppWebView] starts to load an [url]. ///Event fires when the [InAppWebView] starts to load an [url].
final onWebViewLoadStartCallback onLoadStart; final void Function(InAppWebViewController controller, String url) onLoadStart;
///Event fires when the [InAppWebView] finishes loading an [url]. ///Event fires when the [InAppWebView] finishes loading an [url].
final onWebViewLoadStopCallback onLoadStop; final void Function(InAppWebViewController controller, String url) onLoadStop;
///Event fires when the [InAppWebView] encounters an error loading an [url]. ///Event fires when the [InAppWebView] encounters an error loading an [url].
final onWebViewLoadErrorCallback onLoadError; final void Function(InAppWebViewController controller, String url, int code, String message) onLoadError;
///Event fires when the current [progress] of loading a page is changed. ///Event fires when the current [progress] of loading a page is changed.
final onWebViewProgressChangedCallback onProgressChanged; final void Function(InAppWebViewController controller, int progress) onProgressChanged;
///Event fires when the [InAppWebView] receives a [ConsoleMessage]. ///Event fires when the [InAppWebView] receives a [ConsoleMessage].
final onWebViewConsoleMessageCallback onConsoleMessage; final void Function(InAppWebViewController controller, ConsoleMessage consoleMessage) onConsoleMessage;
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. ///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`.
final shouldOverrideUrlLoadingCallback shouldOverrideUrlLoading; final void Function(InAppWebViewController controller, String url) shouldOverrideUrlLoading;
///Event fires when the [InAppWebView] loads a resource. ///Event fires when the [InAppWebView] loads a resource.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`.
/// ///
///**NOTE only for Android**: to be able to listen this event, you need also the enable javascript. ///**NOTE only for Android**: to be able to listen this event, you need also the enable javascript.
final onWebViewLoadResourceCallback onLoadResource; final void Function(InAppWebViewController controller, WebResourceResponse response) onLoadResource;
///Event fires when the [InAppWebView] scrolls. ///Event fires when the [InAppWebView] scrolls.
/// ///
///[x] represents the current horizontal scroll origin in pixels. ///[x] represents the current horizontal scroll origin in pixels.
/// ///
///[y] represents the current vertical scroll origin in pixels. ///[y] represents the current vertical scroll origin in pixels.
final onWebViewScrollChangedCallback onScrollChanged; final void Function(InAppWebViewController controller, int x, int y) onScrollChanged;
///Event fires when [InAppWebView] recognizes and starts a downloadable file. ///Event fires when [InAppWebView] recognizes and starts a downloadable file.
/// ///
///[url] represents the url of the file. ///[url] represents the url of the file.
final onDownloadStartCallback onDownloadStart; final void Function(InAppWebViewController controller, String url) onDownloadStart;
///Event fires when the [InAppWebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`. ///Event fires when the [InAppWebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
/// ///
///[scheme] represents the scheme of the url. ///[scheme] represents the scheme of the url.
/// ///
///[url] represents the url of the request. ///[url] represents the url of the request.
final onLoadResourceCustomSchemeCallback onLoadResourceCustomScheme; final Future<CustomSchemeResponse> Function(InAppWebViewController controller, String scheme, String url) onLoadResourceCustomScheme;
///Event fires when the [InAppWebView] tries to open a link with `target="_blank"`. ///Event fires when the [InAppWebView] tries to open a link with `target="_blank"`.
/// ///
///[url] represents the url of the link. ///[url] represents the url of the link.
final onTargetBlankCallback onTargetBlank; final void Function(InAppWebViewController controller, String url) onTargetBlank;
///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin. ///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
///Note that for applications targeting Android N and later SDKs (API level > `Build.VERSION_CODES.M`) this method is only called for requests originating from secure origins such as https. ///Note that for applications targeting Android N and later SDKs (API level > `Build.VERSION_CODES.M`) this method is only called for requests originating from secure origins such as https.
@ -144,19 +144,19 @@ class InAppWebView extends StatefulWidget {
///[origin] represents the origin of the web content attempting to use the Geolocation API. ///[origin] represents the origin of the web content attempting to use the Geolocation API.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available only for Android.
final onGeolocationPermissionsShowPromptCallback onGeolocationPermissionsShowPrompt; final Future<GeolocationPermissionShowPromptResponse> Function(InAppWebViewController controller, String origin) onGeolocationPermissionsShowPrompt;
///Event fires when javascript calls the `alert()` method to display an alert dialog. ///Event fires when javascript calls the `alert()` method to display an alert dialog.
///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
/// ///
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
final onJsAlertCallback onJsAlert; final Future<JsAlertResponse> Function(InAppWebViewController controller, String message) onJsAlert;
///Event fires when javascript calls the `confirm()` method to display a confirm dialog. ///Event fires when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
/// ///
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
final onJsConfirmCallback onJsConfirm; final Future<JsConfirmResponse> Function(InAppWebViewController controller, String message) onJsConfirm;
///Event fires when javascript calls the `prompt()` method to display a prompt dialog. ///Event fires when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
@ -164,7 +164,7 @@ class InAppWebView extends StatefulWidget {
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
/// ///
///[defaultValue] represents the default value displayed in the prompt dialog. ///[defaultValue] represents the default value displayed in the prompt dialog.
final onJsPromptCallback onJsPrompt; final Future<JsPromptResponse> Function(InAppWebViewController controller, String message, String defaultValue) onJsPrompt;
///Event fires when the webview notifies that a loading URL has been flagged by Safe Browsing. ///Event fires when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible. ///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
@ -174,18 +174,28 @@ class InAppWebView extends StatefulWidget {
///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat]. ///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat].
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available only for Android.
final onSafeBrowsingHitCallback onSafeBrowsingHit; final Future<SafeBrowsingResponse> Function(InAppWebViewController controller, String url, SafeBrowsingThreat threatType) onSafeBrowsingHit;
///Event fires when a WebView received an HTTP authentication request. The default behavior is to cancel the request. ///Event fires when a WebView received an HTTP authentication request. The default behavior is to cancel the request.
/// ///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the auth challenge. ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the auth challenge.
final onReceivedHttpAuthRequestCallback onReceivedHttpAuthRequest; final Future<HttpAuthResponse> Function(InAppWebViewController controller, HttpAuthChallenge challenge) onReceivedHttpAuthRequest;
/// ///
final onReceivedServerTrustAuthRequestCallback onReceivedServerTrustAuthRequest; final Future<ServerTrustAuthResponse> Function(InAppWebViewController controller, ServerTrustChallenge challenge) onReceivedServerTrustAuthRequest;
/// ///
final onReceivedClientCertRequestCallback onReceivedClientCertRequest; final Future<ClientCertResponse> Function(InAppWebViewController controller, ClientCertChallenge challenge) onReceivedClientCertRequest;
///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.
final void Function(InAppWebViewController controller, int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) onFindResultReceived;
///Initial url that will be loaded. ///Initial url that will be loaded.
final String initialUrl; final String initialUrl;
@ -233,6 +243,7 @@ class InAppWebView extends StatefulWidget {
this.onReceivedHttpAuthRequest, this.onReceivedHttpAuthRequest,
this.onReceivedServerTrustAuthRequest, this.onReceivedServerTrustAuthRequest,
this.onReceivedClientCertRequest, this.onReceivedClientCertRequest,
this.onFindResultReceived,
this.gestureRecognizers, this.gestureRecognizers,
}) : super(key: key); }) : super(key: key);
@ -523,6 +534,15 @@ class InAppWebViewController {
else if (_inAppBrowser != null) else if (_inAppBrowser != null)
return (await _inAppBrowser.onReceivedClientCertRequest(challenge))?.toMap(); return (await _inAppBrowser.onReceivedClientCertRequest(challenge))?.toMap();
break; break;
case "onFindResultReceived":
int activeMatchOrdinal = call.arguments["activeMatchOrdinal"];
int numberOfMatches = call.arguments["numberOfMatches"];
bool isDoneCounting = call.arguments["isDoneCounting"];
if (_widget != null && _widget.onReceivedClientCertRequest != null)
_widget.onFindResultReceived(this, activeMatchOrdinal, numberOfMatches, isDoneCounting);
else if (_inAppBrowser != null)
_inAppBrowser.onFindResultReceived(activeMatchOrdinal, numberOfMatches, isDoneCounting);
break;
case "onCallJsHandler": case "onCallJsHandler":
String handlerName = call.arguments["handlerName"]; String handlerName = call.arguments["handlerName"];
// decode args to json // decode args to json
@ -575,21 +595,102 @@ class InAppWebViewController {
///Gets the favicon for the current page. ///Gets the favicon for the current page.
Future<List<int>> getFavicon() async { Future<List<int>> getFavicon() async {
var completer = new Completer<List<int>>(); List<Favicon> favicons = [];
var faviconData = new List<int>();
HttpClient client = new HttpClient(); HttpClient client = new HttpClient();
var url = Uri.parse(await getUrl()); var url = Uri.parse(await getUrl());
// solution found here: https://stackoverflow.com/a/15750809/4637638
var faviconUrl = Uri.parse("https://plus.google.com/_/favicon?domain_url=" + url.scheme + "://" + url.host);
client.getUrl(faviconUrl).then((HttpClientRequest request) { var htmlRequest = await client.getUrl(url);
var html = await (await htmlRequest.close()).transform(Utf8Decoder()).join();
/// TODO: parse HTML instead of using javascript code
try {
List<dynamic> faviconsJs = json.decode(await injectScriptCode("""
function flutter_inappbrowser_ger_favicons() {
var favicons = [];
var links = document.getElementsByTagName('link');
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.rel.indexOf("icon") >= 0) {
favicons.push({
rel: link.rel,
href: link.href,
sizes: link.sizes
});
}
}
return favicons;
}
flutter_inappbrowser_ger_favicons();
"""));
for(Map<String, dynamic> favicon in faviconsJs) {
String sizes = favicon["sizes"];
if (sizes != null && sizes != "any") {
List<String> sizesSplitted = sizes.split(" ");
for (String size in sizesSplitted) {
int width = int.parse(size.split("x")[0]);
int height = int.parse(size.split("x")[1]);
favicons.add(Favicon(url: favicon["href"], rel: favicon["rel"], width: width, height: height));
}
} else {
favicons.add(Favicon(url: favicon["href"], rel: favicon["rel"], width: null, height: null));
}
}
} catch (e) {}
var completer = new Completer<List<int>>();
var faviconData = new List<int>();
try {
var faviconUrl = url.scheme + "://" + url.host + "/favicon.ico";
await client.headUrl(Uri.parse(faviconUrl));
favicons.add(Favicon(url: faviconUrl, rel: "shortcut icon"));
} catch(e) {}
var manifestRequest;
try {
var manifestJsonUrl = url.scheme + "://" + url.host + "/manifest.json";
manifestRequest = await client.getUrl(Uri.parse(manifestJsonUrl));
} catch(e) {
/// TODO: find manifest throught rel="manifest"
}
if (manifestRequest) {
Map<String, dynamic> manifest = json.decode(await (await manifestRequest.close()).transform(Utf8Decoder()).join());
if (manifest.containsKey("icons")) {
for(Map<String, dynamic> icon in manifest["icons"]) {
String url = icon["src"];
List<String> urlSplitted = url.split("/");
String sizes = icon["sizes"];
String rel = (sizes != null) ? urlSplitted[urlSplitted.length - 1].replaceFirst("-" + sizes, "").split(" ")[0].split(".")[0] : null;
if (sizes != null && sizes != "any") {
List<String> sizesSplitted = sizes.split(" ");
for (String size in sizesSplitted) {
int width = int.parse(size.split("x")[0]);
int height = int.parse(size.split("x")[1]);
favicons.add(Favicon(url: url, rel: rel, width: width, height: height));
}
} else {
favicons.add(Favicon(url: url, rel: rel, width: null, height: null));
}
}
}
}
//print(favicons);
// solution found here: https://stackoverflow.com/a/15750809/4637638
var googleFaviconUrl = Uri.parse("https://plus.google.com/_/favicon?domain_url=" + url.scheme + "://" + url.host);
client.getUrl(googleFaviconUrl).then((HttpClientRequest request) {
return request.close(); return request.close();
}).then((HttpClientResponse response) { }).then((HttpClientResponse response) {
response.listen((List<int> data) { response.listen((List<int> data) {
faviconData = data; faviconData = data;
}, onDone: () => completer.complete(faviconData)); }, onDone: () => completer.complete(faviconData));
}).catchError((error) {
completer.completeError(error);
}); });
return completer.future; return completer.future;
} }
@ -1037,6 +1138,52 @@ class InAppWebViewController {
await _channel.invokeMethod('clearClientCertPreferences', args); await _channel.invokeMethod('clearClientCertPreferences', args);
} }
///Finds all instances of find on the page and highlights them. Notifies [onFindResultReceived] listener.
///
///[find] represents the string to find.
///
///**NOTE**: on Android, it finds all instances asynchronously. Successive calls to this will cancel any pending searches.
///
///**NOTE**: on iOS, this is implemented using CSS and Javascript.
Future<void> findAllAsync(String find) async {
assert(find != null);
Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
_inAppBrowser.throwIsNotOpened();
args.putIfAbsent('uuid', () => _inAppBrowserUuid);
}
args.putIfAbsent('find', () => find);
await _channel.invokeMethod('findAllAsync', args);
}
///Highlights and scrolls to the next match found by [findAllAsync()]. Notifies [onFindResultReceived] listener.
///
///[forward] represents the direction to search.
///
///**NOTE**: on iOS, this is implemented using CSS and Javascript.
Future<void> findNext(bool forward) async {
assert(forward != null);
Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
_inAppBrowser.throwIsNotOpened();
args.putIfAbsent('uuid', () => _inAppBrowserUuid);
}
args.putIfAbsent('forward', () => forward);
await _channel.invokeMethod('findNext', args);
}
///Clears the highlighting surrounding text matches created by [findAllAsync()].
///
///**NOTE**: on iOS, this is implemented using CSS and Javascript.
Future<void> clearMatches() async {
Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
_inAppBrowser.throwIsNotOpened();
args.putIfAbsent('uuid', () => _inAppBrowserUuid);
}
await _channel.invokeMethod('clearMatches', args);
}
///Dispose/Destroy the WebView. ///Dispose/Destroy the WebView.
Future<void> _dispose() async { Future<void> _dispose() async {
await _channel.invokeMethod('dispose'); await _channel.invokeMethod('dispose');

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);