v0.4.1
This commit is contained in:
parent
ea6134d1f6
commit
99ff84c617
|
@ -15,7 +15,21 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" 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/WebViewActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/WebViewActivity.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/chrome_custom_tabs/ChromeCustomTabsActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/chrome_custom_tabs/ChromeCustomTabsActivity.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/res/layout/activity_web_view.xml" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/res/layout/activity_web_view.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/flutter_inappbrowser.iml" beforeDir="false" afterPath="$PROJECT_DIR$/flutter_inappbrowser.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppBrowserWebViewController.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppBrowserWebViewController.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/Options.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/Options.swift" 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$/ios/Storyboards/WebView.storyboard" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Storyboards/WebView.storyboard" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||
|
@ -32,63 +46,11 @@
|
|||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="flutter_inappbrowser.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="128">
|
||||
<caret line="82" column="21" selection-start-line="82" selection-start-column="6" selection-end-line="82" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="203">
|
||||
<caret line="246" column="318" selection-start-line="246" selection-start-column="318" selection-end-line="246" selection-end-column="318" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="14" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="30">
|
||||
<caret line="2" selection-start-line="2" selection-end-line="8" selection-end-column="38" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="165" column="42" selection-start-line="165" selection-start-column="42" selection-end-line="165" selection-end-column="42" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="405">
|
||||
<caret line="27" column="15" selection-start-line="27" selection-start-column="15" selection-end-line="27" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -104,11 +66,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>getPre</find>
|
||||
<find>client</find>
|
||||
<find>webView</find>
|
||||
<find>result.s</find>
|
||||
<find>result</find>
|
||||
<find>Client</find>
|
||||
<find>LOAD_START_EVENT</find>
|
||||
<find>loadstop</find>
|
||||
|
@ -134,6 +91,11 @@
|
|||
<find>_blank</find>
|
||||
<find>.html</find>
|
||||
<find>close(</find>
|
||||
<find>isOpened</find>
|
||||
<find>javascript</find>
|
||||
<find>header</find>
|
||||
<find>localhost</find>
|
||||
<find>/main.dart</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -171,21 +133,22 @@
|
|||
<option value="$PROJECT_DIR$/android/build.gradle" />
|
||||
<option value="$PROJECT_DIR$/example/html/css/style.css" />
|
||||
<option value="$PROJECT_DIR$/example/html/index.html" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/example/assets/css/style.css" />
|
||||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/example/lib/main.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="-1920" />
|
||||
<option name="y" value="-21" />
|
||||
<option name="width" value="1711" />
|
||||
<option name="x" value="116" />
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1695" />
|
||||
<option name="height" value="1057" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
|
@ -194,18 +157,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -213,28 +164,11 @@
|
|||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="android" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="assets" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
|
@ -245,7 +179,19 @@
|
|||
</subPane>
|
||||
<option name="show-excluded-files" value="false" />
|
||||
</pane>
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="AndroidView" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -402,33 +348,34 @@
|
|||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-1920" y="-21" width="1711" height="1057" extended-state="0" />
|
||||
<frame x="116" y="23" width="1695" height="1057" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette	" order="3" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Build Variants" order="2" side_tool="true" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="3" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5035553" side_tool="true" weight="0.25689086" />
|
||||
<window_info anchor="bottom" id="Dart Analysis" order="14" weight="0.32855567" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49644473" weight="0.3628602" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49644473" visible="true" weight="0.2529349" />
|
||||
<window_info anchor="right" id="Flutter Outline" order="3" weight="0.32922077" />
|
||||
<window_info anchor="bottom" id="Logcat" order="11" />
|
||||
<window_info id="Captures" order="2" weight="0.32936507" />
|
||||
<window_info id="Capture Tool" order="2" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.49724367" visible="true" weight="0.16956261" />
|
||||
<window_info id="Structure" order="1" sideWeight="0.50275636" side_tool="true" weight="0.1910871" />
|
||||
<window_info anchor="right" id="Device File Explorer" order="3" side_tool="true" />
|
||||
<window_info anchor="right" id="Theme Preview" order="3" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="right" id="Flutter Inspector" order="3" weight="0.32987013" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.34364995" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" weight="0.23692636" />
|
||||
<window_info anchor="right" id="Palette	" order="3" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="3" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49644473" visible="true" weight="0.36179295" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49644473" weight="0.25080043" />
|
||||
<window_info id="Captures" order="2" weight="0.32936507" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49724367" visible="true" weight="0.25771326" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.3276414" />
|
||||
<window_info anchor="right" id="Theme Preview" order="3" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="right" id="Flutter Inspector" order="3" weight="0.32938388" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Assistant" order="4" visible="true" weight="0.32987013" />
|
||||
|
@ -437,7 +384,6 @@
|
|||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Dependency Viewer" order="13" weight="0.32800853" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.3276414" />
|
||||
</layout>
|
||||
<layout-to-restore>
|
||||
<window_info id="Designer" order="4" />
|
||||
|
@ -482,45 +428,10 @@
|
|||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="9" />
|
||||
<option name="time" value="14" />
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/example/android/app/src/main/java/com/pichillilorenzo/flutterwebviewexample/MainActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="19" selection-end-line="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/ios/Classes/SwiftFlutterWebviewPlugin.swift" />
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Podfile.lock">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Manifest.lock">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
<caret line="22" selection-start-line="22" selection-end-line="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Runner/GeneratedPluginRegistrant.m">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Runner/AppDelegate.swift">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/pubspec.lock">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
|
@ -606,13 +517,6 @@
|
|||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Podfile">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="539">
|
||||
<caret line="65" column="52" selection-start-line="65" selection-start-column="52" selection-end-line="65" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1560">
|
||||
|
@ -622,16 +526,6 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/android/gradlew" />
|
||||
<entry file="file://$PROJECT_DIR$/android/gradlew.bat" />
|
||||
<entry file="file://$PROJECT_DIR$/example/flutter_webview_example.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/flutter_webview_example_android.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_android.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="420">
|
||||
|
@ -669,13 +563,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
<caret line="22" column="9" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/ios/flutter_inappbrowser.podspec">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
|
@ -709,71 +596,134 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="60">
|
||||
<caret line="4" column="21" selection-start-line="4" selection-start-column="21" selection-end-line="4" selection-end-column="21" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="69" lean-forward="true" selection-start-line="2" selection-start-column="2" selection-end-line="2" selection-end-column="73" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="622">
|
||||
<caret line="524" column="3" selection-start-line="524" selection-start-column="3" selection-end-line="524" selection-end-column="3" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="19" column="15" selection-start-line="19" selection-start-column="3" selection-end-line="19" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="405">
|
||||
<caret line="27" column="13" selection-start-line="27" selection-start-column="13" selection-end-line="27" selection-end-column="13" />
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="14" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="165" column="42" selection-start-line="165" selection-start-column="42" selection-end-line="165" selection-end-column="42" />
|
||||
<state relative-caret-position="495">
|
||||
<caret line="33" column="11" selection-start-line="23" selection-start-column="30" selection-end-line="33" selection-end-column="11" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
<caret line="22" column="9" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/ServiceDefinitions.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Podfile">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="975">
|
||||
<caret line="65" column="52" selection-start-line="65" selection-start-column="52" selection-end-line="65" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/flutter_webview_example.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/flutter_webview_example_android.iml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Target Support Files/flutter_inappbrowser/flutter_inappbrowser-prefix.pch">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Target Support Files/flutter_inappbrowser/flutter_inappbrowser-dummy.m">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Target Support Files/flutter_inappbrowser/flutter_inappbrowser.xcconfig">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Target Support Files/flutter_inappbrowser/flutter_inappbrowser-umbrella.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Pods/Target Support Files/flutter_inappbrowser/Info.plist">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="17" column="24" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="128">
|
||||
<caret line="82" column="21" selection-start-line="82" selection-start-column="6" selection-end-line="82" selection-end-column="21" />
|
||||
<state relative-caret-position="407">
|
||||
<caret line="404" selection-start-line="404" selection-end-line="404" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="69" lean-forward="true" selection-start-line="2" selection-start-column="2" selection-end-line="2" selection-end-column="73" />
|
||||
</state>
|
||||
</provider>
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="30">
|
||||
<caret line="2" selection-start-line="2" selection-end-line="8" selection-end-column="38" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||
<entry file="file://$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="14" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="69" selection-start-line="7" selection-start-column="69" selection-end-line="7" selection-end-column="69" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="19" column="15" selection-start-line="19" selection-start-column="3" selection-end-line="19" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="203">
|
||||
<caret line="246" column="318" selection-start-line="246" selection-start-column="318" selection-end-line="246" selection-end-column="318" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<markdownNavigatorState />
|
||||
</second_editor>
|
||||
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="405">
|
||||
<caret line="27" column="15" selection-start-line="27" selection-start-column="15" selection-end-line="27" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
## 0.4.1
|
||||
|
||||
- added `InAppBrowser.takeScreenshot()`
|
||||
- added `InAppBrowser.setOptions()`
|
||||
- added `InAppBrowser.getOptions()`
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- removed `target` parameter to `InAppBrowser.open()` method. To open the url on the system browser, use the `openWithSystemBrowser: true` option
|
||||
|
@ -7,6 +13,7 @@
|
|||
- added `InAppBrowser.openWithSystemBrowser` method
|
||||
- added `InAppBrowser.openOnLocalhost` method
|
||||
- added `InAppBrowser.loadFile` method
|
||||
- added `InAppBrowser.isOpened` method
|
||||
|
||||
## 0.3.2
|
||||
|
||||
|
|
39
README.md
39
README.md
|
@ -9,6 +9,14 @@
|
|||
A Flutter plugin that allows you to open an in-app browser window.
|
||||
This plugin is inspired by the popular [cordova-plugin-inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser)!
|
||||
|
||||
### IMPORTANT Note for iOS
|
||||
To be able to use this plugin on iOS, you need to create the Flutter App with `flutter create -i swift` (see [flutter/flutter#13422 (comment)](https://github.com/flutter/flutter/issues/13422#issuecomment-392133780)), otherwise, you will get this message:
|
||||
```
|
||||
=== BUILD TARGET flutter_inappbrowser OF PROJECT Pods WITH CONFIGURATION Debug ===
|
||||
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
|
||||
```
|
||||
that is not true! The Swift version that I have used is already a supported value: 4.0.
|
||||
|
||||
## Getting Started
|
||||
|
||||
For help getting started with Flutter, view our online
|
||||
|
@ -334,7 +342,7 @@ inAppBrowser.loadUrl(String url, {Map<String, String> headers = const {}});
|
|||
|
||||
Loads the given `assetFilePath` with optional `headers` specified as a map from name to value.
|
||||
|
||||
To be able to load your local files (assets, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found!
|
||||
To be able to load your local files (html, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found!
|
||||
|
||||
Example of a `pubspec.yaml` file:
|
||||
```yaml
|
||||
|
@ -493,6 +501,35 @@ Returns `true` if the callback is removed, otherwise `false`.
|
|||
inAppBrowser.removeJavaScriptHandler(String handlerName, int index);
|
||||
```
|
||||
|
||||
#### Future\<Uint8List\> InAppBrowser.takeScreenshot
|
||||
|
||||
Takes a screenshot (in PNG format) of the view's visible viewport and returns a `Uint8List`. Returns `null` if it wasn't be able to take it.
|
||||
|
||||
**NOTE for iOS**: available from iOS 11.0+.
|
||||
```dart
|
||||
inAppBrowser.takeScreenshot();
|
||||
```
|
||||
|
||||
#### Future\<void\> InAppBrowser.setOptions
|
||||
|
||||
Sets the InAppBrowser options with the new `options` and evaluates them.
|
||||
```dart
|
||||
inAppBrowser.setOptions(Map<String, dynamic> options);
|
||||
```
|
||||
|
||||
#### Future\<Map\<String, dynamic\>\> InAppBrowser.getOptions
|
||||
|
||||
Gets the current InAppBrowser options. Returns `null` if the options are not setted yet.
|
||||
```dart
|
||||
inAppBrowser.getOptions();
|
||||
```
|
||||
|
||||
#### bool InAppBrowser.isOpened
|
||||
|
||||
Returns `true` if the `InAppBrowser` instance is opened, otherwise `false`.
|
||||
```dart
|
||||
inAppBrowser.isOpened();
|
||||
```
|
||||
|
||||
### `ChromeSafariBrowser` class
|
||||
[Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android / [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.provider.Browser;
|
|||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonToken;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
@ -247,6 +248,28 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
|
|||
case "isHidden":
|
||||
result.success(isHidden(uuid));
|
||||
break;
|
||||
case "takeScreenshot":
|
||||
result.success(takeScreenshot(uuid));
|
||||
break;
|
||||
case "setOptions":
|
||||
{
|
||||
String optionsType = (String) call.argument("optionsType");
|
||||
switch (optionsType){
|
||||
case "InAppBrowserOptions":
|
||||
InAppBrowserOptions inAppBrowserOptions = new InAppBrowserOptions();
|
||||
HashMap<String, Object> inAppBroeserOptionsMap = (HashMap<String, Object>) call.argument("options");
|
||||
inAppBrowserOptions.parse(inAppBroeserOptionsMap);
|
||||
setOptions(uuid, inAppBrowserOptions, inAppBroeserOptionsMap);
|
||||
break;
|
||||
default:
|
||||
result.error(LOG_TAG, "Options " + optionsType + " not available.", null);
|
||||
}
|
||||
}
|
||||
result.success(true);
|
||||
break;
|
||||
case "getOptions":
|
||||
result.success(getOptions(uuid));
|
||||
break;
|
||||
default:
|
||||
result.notImplemented();
|
||||
}
|
||||
|
@ -580,4 +603,25 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
|
|||
result.success(true);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] takeScreenshot(String uuid) {
|
||||
WebViewActivity webViewActivity = webViewActivities.get(uuid);
|
||||
if (webViewActivity != null)
|
||||
return webViewActivity.takeScreenshot();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOptions(String uuid, InAppBrowserOptions options, HashMap<String, Object> optionsMap) {
|
||||
WebViewActivity webViewActivity = webViewActivities.get(uuid);
|
||||
if (webViewActivity != null)
|
||||
webViewActivity.setOptions(options, optionsMap);
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getOptions(String uuid) {
|
||||
WebViewActivity webViewActivity = webViewActivities.get(uuid);
|
||||
if (webViewActivity != null)
|
||||
return webViewActivity.getOptions();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.pichillilorenzo.flutter_inappbrowser;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Picture;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.v7.app.ActionBar;
|
||||
|
@ -12,6 +15,7 @@ import android.view.Menu;
|
|||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebSettings;
|
||||
|
@ -19,6 +23,10 @@ import android.webkit.WebView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.SearchView;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -31,6 +39,7 @@ public class WebViewActivity extends AppCompatActivity {
|
|||
String uuid;
|
||||
WebView webView;
|
||||
ActionBar actionBar;
|
||||
Menu menu;
|
||||
InAppBrowserWebViewClient inAppBrowserWebViewClient;
|
||||
InAppBrowserWebChromeClient inAppBrowserWebChromeClient;
|
||||
SearchView searchView;
|
||||
|
@ -182,8 +191,12 @@ public class WebViewActivity extends AppCompatActivity {
|
|||
else
|
||||
settings.setTextZoom(100);
|
||||
|
||||
if (options.progressBar)
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
if (!options.progressBar)
|
||||
progressBar.setMax(0);
|
||||
else
|
||||
progressBar.setMax(100);
|
||||
|
||||
actionBar.setDisplayShowTitleEnabled(!options.hideTitleBar);
|
||||
|
||||
|
@ -199,7 +212,9 @@ public class WebViewActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
menu = m;
|
||||
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
// Inflate menu to add items to action bar if it is present.
|
||||
inflater.inflate(R.menu.menu_main, menu);
|
||||
|
@ -366,9 +381,11 @@ public class WebViewActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void clearCache() {
|
||||
webView.clearCache(true);
|
||||
clearCookies();
|
||||
webView.clearFormData();
|
||||
if (webView != null) {
|
||||
webView.clearCache(true);
|
||||
clearCookies();
|
||||
webView.clearFormData();
|
||||
}
|
||||
}
|
||||
|
||||
public void goBackButtonClicked(MenuItem item) {
|
||||
|
@ -394,4 +411,107 @@ public class WebViewActivity extends AppCompatActivity {
|
|||
InAppBrowserFlutterPlugin.close(uuid, null);
|
||||
}
|
||||
|
||||
public byte[] takeScreenshot() {
|
||||
if (webView != null) {
|
||||
Picture picture = webView.capturePicture();
|
||||
Bitmap b = Bitmap.createBitmap( webView.getWidth(),
|
||||
webView.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas c = new Canvas(b);
|
||||
|
||||
picture.draw(c);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
b.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOptions(InAppBrowserOptions newOptions, HashMap<String, Object> newOptionsMap) {
|
||||
|
||||
WebSettings settings = webView.getSettings();
|
||||
|
||||
if (newOptionsMap.get("hidden") != null && options.hidden != newOptions.hidden) {
|
||||
if (newOptions.hidden)
|
||||
hide();
|
||||
else
|
||||
show();
|
||||
}
|
||||
|
||||
if (newOptionsMap.get("javaScriptEnabled") != null && options.javaScriptEnabled != newOptions.javaScriptEnabled)
|
||||
settings.setJavaScriptEnabled(newOptions.javaScriptEnabled);
|
||||
|
||||
if (newOptionsMap.get("javaScriptCanOpenWindowsAutomatically") != null && options.javaScriptCanOpenWindowsAutomatically != newOptions.javaScriptCanOpenWindowsAutomatically)
|
||||
settings.setJavaScriptCanOpenWindowsAutomatically(newOptions.javaScriptCanOpenWindowsAutomatically);
|
||||
|
||||
if (newOptionsMap.get("builtInZoomControls") != null && options.builtInZoomControls != newOptions.builtInZoomControls)
|
||||
settings.setBuiltInZoomControls(newOptions.builtInZoomControls);
|
||||
|
||||
if (newOptionsMap.get("safeBrowsingEnabled") != null && options.safeBrowsingEnabled != newOptions.safeBrowsingEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
settings.setSafeBrowsingEnabled(newOptions.safeBrowsingEnabled);
|
||||
|
||||
if (newOptionsMap.get("mediaPlaybackRequiresUserGesture") != null && options.mediaPlaybackRequiresUserGesture != newOptions.mediaPlaybackRequiresUserGesture)
|
||||
settings.setMediaPlaybackRequiresUserGesture(newOptions.mediaPlaybackRequiresUserGesture);
|
||||
|
||||
if (newOptionsMap.get("databaseEnabled") != null && options.databaseEnabled != newOptions.databaseEnabled)
|
||||
settings.setDatabaseEnabled(newOptions.databaseEnabled);
|
||||
|
||||
if (newOptionsMap.get("domStorageEnabled") != null && options.domStorageEnabled != newOptions.domStorageEnabled)
|
||||
settings.setDomStorageEnabled(newOptions.domStorageEnabled);
|
||||
|
||||
if (newOptionsMap.get("userAgent") != null && options.userAgent != newOptions.userAgent && !newOptions.userAgent.isEmpty())
|
||||
settings.setUserAgentString(newOptions.userAgent);
|
||||
|
||||
if (newOptionsMap.get("clearCache") != null && newOptions.clearCache)
|
||||
clearCache();
|
||||
else if (newOptionsMap.get("clearSessionCache") != null && newOptions.clearSessionCache)
|
||||
CookieManager.getInstance().removeSessionCookie();
|
||||
|
||||
if (newOptionsMap.get("useWideViewPort") != null && options.useWideViewPort != newOptions.useWideViewPort)
|
||||
settings.setUseWideViewPort(newOptions.useWideViewPort);
|
||||
|
||||
if (newOptionsMap.get("supportZoom") != null && options.supportZoom != newOptions.supportZoom)
|
||||
settings.setSupportZoom(newOptions.supportZoom);
|
||||
|
||||
if (newOptionsMap.get("progressBar") != null && options.progressBar != newOptions.progressBar && progressBar != null) {
|
||||
if (newOptions.progressBar)
|
||||
progressBar.setMax(0);
|
||||
else
|
||||
progressBar.setMax(100);
|
||||
}
|
||||
|
||||
if (newOptionsMap.get("hideTitleBar") != null && options.hideTitleBar != newOptions.hideTitleBar)
|
||||
actionBar.setDisplayShowTitleEnabled(!newOptions.hideTitleBar);
|
||||
|
||||
if (newOptionsMap.get("toolbarTop") != null && options.toolbarTop != newOptions.toolbarTop) {
|
||||
if (!newOptions.toolbarTop)
|
||||
actionBar.hide();
|
||||
else
|
||||
actionBar.show();
|
||||
}
|
||||
|
||||
if (newOptionsMap.get("toolbarTopBackgroundColor") != null && options.toolbarTopBackgroundColor != newOptions.toolbarTopBackgroundColor && !newOptions.toolbarTopBackgroundColor.isEmpty())
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(newOptions.toolbarTopBackgroundColor)));
|
||||
|
||||
if (newOptionsMap.get("toolbarTopFixedTitle") != null && options.toolbarTopFixedTitle != newOptions.toolbarTopFixedTitle && !newOptions.toolbarTopFixedTitle.isEmpty())
|
||||
actionBar.setTitle(newOptions.toolbarTopFixedTitle);
|
||||
|
||||
if (newOptionsMap.get("hideUrlBar") != null && options.hideUrlBar != newOptions.hideUrlBar) {
|
||||
if (newOptions.hideUrlBar)
|
||||
menu.findItem(R.id.menu_search).setVisible(false);
|
||||
else
|
||||
menu.findItem(R.id.menu_search).setVisible(true);
|
||||
}
|
||||
|
||||
options = newOptions;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getOptions() {
|
||||
return (options != null) ? options.getHashMap() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -91,4 +91,5 @@ public class ChromeCustomTabsActivity extends Activity {
|
|||
InAppBrowserFlutterPlugin.channel.invokeMethod("onChromeSafariBrowserClosed", obj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
|
|
|
@ -25,7 +25,7 @@ dev_dependencies:
|
|||
sdk: flutter
|
||||
|
||||
flutter_inappbrowser:
|
||||
path: ../
|
||||
path: ../
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://www.dartlang.org/tools/pub/pubspec
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/.dart_tool" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/.pub" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/build" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/ios/Flutter/flutter_assets/packages" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/example/ios/Flutter/flutter_assets/packages" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
|
|
@ -150,6 +150,11 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
@IBOutlet var toolbarBottom: UIToolbar!
|
||||
@IBOutlet var urlField: UITextField!
|
||||
|
||||
@IBOutlet var toolbarTop_BottomToWebViewTopConstraint: NSLayoutConstraint!
|
||||
@IBOutlet var toolbarBottom_TopToWebViewBottomConstraint: NSLayoutConstraint!
|
||||
@IBOutlet var webView_BottomFullScreenConstraint: NSLayoutConstraint!
|
||||
@IBOutlet var webView_TopFullScreenConstraint: NSLayoutConstraint!
|
||||
|
||||
weak var navigationDelegate: SwiftFlutterPlugin?
|
||||
var currentURL: URL?
|
||||
var tmpWindow: UIWindow?
|
||||
|
@ -159,20 +164,24 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
var uuid: String = ""
|
||||
var WKNavigationMap: [String: [String: Any]] = [:]
|
||||
var startPageTime = 0
|
||||
var viewPrepared = false
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)!
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
prepareWebView()
|
||||
if !viewPrepared {
|
||||
prepareConstraints()
|
||||
prepareWebView()
|
||||
}
|
||||
viewPrepared = true
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
//MyURLProtocol.wkWebViewDelegateMap[uuid] = self
|
||||
|
||||
webView.uiDelegate = self
|
||||
webView.navigationDelegate = self
|
||||
|
@ -214,6 +223,11 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
super.viewWillDisappear(animated)
|
||||
}
|
||||
|
||||
func prepareConstraints () {
|
||||
webView_BottomFullScreenConstraint = NSLayoutConstraint(item: self.webView, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: 0)
|
||||
webView_TopFullScreenConstraint = NSLayoutConstraint(item: self.webView, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.top, multiplier: 1, constant: 0)
|
||||
}
|
||||
|
||||
func prepareWebView() {
|
||||
//UIApplication.shared.statusBarStyle = preferredStatusBarStyle
|
||||
|
||||
|
@ -231,13 +245,9 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
}
|
||||
}
|
||||
else {
|
||||
self.toolbarTop.removeFromSuperview()
|
||||
self.webView.bounds.size.height += self.toolbarTop.bounds.height
|
||||
|
||||
if #available(iOS 9.0, *) {
|
||||
let topConstraint = webView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: CGFloat(getStatusBarOffset()))
|
||||
NSLayoutConstraint.activate([topConstraint])
|
||||
}
|
||||
self.toolbarTop.isHidden = true
|
||||
self.toolbarTop_BottomToWebViewTopConstraint.isActive = false
|
||||
self.webView_TopFullScreenConstraint.isActive = true
|
||||
}
|
||||
|
||||
if (browserOptions?.toolbarBottom)! {
|
||||
|
@ -247,13 +257,9 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
self.toolbarBottom.isTranslucent = (browserOptions?.toolbarBottomTranslucent)!
|
||||
}
|
||||
else {
|
||||
self.toolbarBottom.removeFromSuperview()
|
||||
self.webView.bounds.size.height += self.toolbarBottom.bounds.height
|
||||
|
||||
if #available(iOS 9.0, *) {
|
||||
let bottomConstraint = webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
|
||||
NSLayoutConstraint.activate([bottomConstraint])
|
||||
}
|
||||
self.toolbarBottom.isHidden = true
|
||||
self.toolbarBottom_TopToWebViewBottomConstraint.isActive = false
|
||||
self.webView_BottomFullScreenConstraint.isActive = true
|
||||
}
|
||||
|
||||
if browserOptions?.closeButtonCaption != "" {
|
||||
|
@ -303,19 +309,12 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
self.webView.configuration.userContentController.addUserScript(javaScriptBridgeJSScript)
|
||||
self.webView.configuration.userContentController.add(self, name: "callHandler")
|
||||
|
||||
if (browserOptions?.useOnLoadResource)! {
|
||||
let resourceObserverJSScript = WKUserScript(source: resourceObserverJS, injectionTime: .atDocumentStart, forMainFrameOnly: false)
|
||||
self.webView.configuration.userContentController.addUserScript(resourceObserverJSScript)
|
||||
self.webView.configuration.userContentController.add(self, name: "resourceLoaded")
|
||||
}
|
||||
let resourceObserverJSScript = WKUserScript(source: resourceObserverJS, injectionTime: .atDocumentStart, forMainFrameOnly: false)
|
||||
self.webView.configuration.userContentController.addUserScript(resourceObserverJSScript)
|
||||
self.webView.configuration.userContentController.add(self, name: "resourceLoaded")
|
||||
|
||||
if #available(iOS 10.0, *) {
|
||||
if (browserOptions?.mediaPlaybackRequiresUserGesture)! {
|
||||
self.webView.configuration.mediaTypesRequiringUserActionForPlayback = .all
|
||||
}
|
||||
else {
|
||||
self.webView.configuration.mediaTypesRequiringUserActionForPlayback = []
|
||||
}
|
||||
self.webView.configuration.mediaTypesRequiringUserActionForPlayback = ((browserOptions?.mediaPlaybackRequiresUserGesture)!) ? .all : []
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
self.webView.configuration.mediaPlaybackRequiresUserAction = (browserOptions?.mediaPlaybackRequiresUserGesture)!
|
||||
|
@ -330,21 +329,20 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
self.webView.allowsBackForwardNavigationGestures = (browserOptions?.allowsBackForwardNavigationGestures)!
|
||||
if #available(iOS 9.0, *) {
|
||||
self.webView.allowsLinkPreview = (browserOptions?.allowsLinkPreview)!
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
if #available(iOS 10.0, *) {
|
||||
self.webView.configuration.ignoresViewportScaleLimits = (browserOptions?.ignoresViewportScaleLimits)!
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
self.webView.configuration.allowsInlineMediaPlayback = (browserOptions?.allowsInlineMediaPlayback)!
|
||||
|
||||
if #available(iOS 9.0, *) {
|
||||
self.webView.configuration.allowsPictureInPictureMediaPlayback = (browserOptions?.allowsPictureInPictureMediaPlayback)!
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
self.webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = (browserOptions?.javaScriptCanOpenWindowsAutomatically)!
|
||||
|
||||
self.webView.configuration.preferences.javaScriptEnabled = (browserOptions?.javaScriptEnabled)!
|
||||
|
||||
if ((browserOptions?.userAgent)! != "") {
|
||||
|
@ -680,7 +678,7 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
navigationDelegate?.onConsoleMessage(uuid: self.uuid, sourceURL: "", lineNumber: 1, message: message.body as! String, messageLevel: messageLevel)
|
||||
}
|
||||
}
|
||||
else if message.name == "resourceLoaded" {
|
||||
else if message.name == "resourceLoaded" && (browserOptions?.useOnLoadResource)! {
|
||||
if let resource = convertToDictionary(text: message.body as! String) {
|
||||
let url = URL(string: resource["name"] as! String)!
|
||||
if !UIApplication.shared.canOpenURL(url) {
|
||||
|
@ -715,4 +713,164 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func takeScreenshot (completionHandler: @escaping (_ screenshot: Data?) -> Void) {
|
||||
if #available(iOS 11.0, *) {
|
||||
self.webView.takeSnapshot(with: nil, completionHandler: {(image, error) -> Void in
|
||||
var imageData: Data? = nil
|
||||
if let screenshot = image {
|
||||
imageData = UIImagePNGRepresentation(screenshot)!
|
||||
}
|
||||
completionHandler(imageData)
|
||||
})
|
||||
} else {
|
||||
completionHandler(nil)
|
||||
}
|
||||
}
|
||||
|
||||
func setOptions(newOptions: InAppBrowserOptions, newOptionsMap: [String: Any]) {
|
||||
|
||||
if newOptionsMap["hidden"] != nil && browserOptions?.hidden != newOptions.hidden {
|
||||
if newOptions.hidden {
|
||||
self.navigationDelegate?.hide(uuid: self.uuid)
|
||||
}
|
||||
else {
|
||||
self.navigationDelegate?.show(uuid: self.uuid)
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["hideUrlBar"] != nil && browserOptions?.hideUrlBar != newOptions.hideUrlBar {
|
||||
self.urlField.isHidden = newOptions.hideUrlBar
|
||||
self.urlField.isEnabled = !newOptions.hideUrlBar
|
||||
}
|
||||
|
||||
if newOptionsMap["toolbarTop"] != nil && browserOptions?.toolbarTop != newOptions.toolbarTop {
|
||||
self.webView_TopFullScreenConstraint.isActive = !newOptions.toolbarTop
|
||||
self.toolbarTop.isHidden = !newOptions.toolbarTop
|
||||
self.toolbarTop_BottomToWebViewTopConstraint.isActive = newOptions.toolbarTop
|
||||
}
|
||||
|
||||
if newOptionsMap["toolbarTopBackgroundColor"] != nil && browserOptions?.toolbarTopBackgroundColor != newOptions.toolbarTopBackgroundColor && newOptions.toolbarTopBackgroundColor != "" {
|
||||
self.toolbarTop.backgroundColor = color(fromHexString: newOptions.toolbarTopBackgroundColor)
|
||||
}
|
||||
|
||||
if newOptionsMap["toolbarBottom"] != nil && browserOptions?.toolbarBottom != newOptions.toolbarBottom {
|
||||
self.webView_BottomFullScreenConstraint.isActive = !newOptions.toolbarBottom
|
||||
self.toolbarBottom.isHidden = !newOptions.toolbarBottom
|
||||
self.toolbarBottom_TopToWebViewBottomConstraint.isActive = newOptions.toolbarBottom
|
||||
}
|
||||
|
||||
if newOptionsMap["toolbarBottomBackgroundColor"] != nil && browserOptions?.toolbarBottomBackgroundColor != newOptions.toolbarBottomBackgroundColor && newOptions.toolbarBottomBackgroundColor != "" {
|
||||
self.toolbarBottom.backgroundColor = color(fromHexString: newOptions.toolbarBottomBackgroundColor)
|
||||
}
|
||||
|
||||
if newOptionsMap["toolbarBottomTranslucent"] != nil && browserOptions?.toolbarBottomTranslucent != newOptions.toolbarBottomTranslucent {
|
||||
self.toolbarBottom.isTranslucent = newOptions.toolbarBottomTranslucent
|
||||
}
|
||||
|
||||
if newOptionsMap["closeButtonCaption"] != nil && browserOptions?.closeButtonCaption != newOptions.closeButtonCaption && newOptions.closeButtonCaption != "" {
|
||||
closeButton.setTitle(newOptions.closeButtonCaption, for: .normal)
|
||||
}
|
||||
|
||||
if newOptionsMap["closeButtonColor"] != nil && browserOptions?.closeButtonColor != newOptions.closeButtonColor && newOptions.closeButtonColor != "" {
|
||||
closeButton.tintColor = color(fromHexString: newOptions.closeButtonColor)
|
||||
}
|
||||
|
||||
if newOptionsMap["presentationStyle"] != nil && browserOptions?.presentationStyle != newOptions.presentationStyle {
|
||||
self.modalPresentationStyle = UIModalPresentationStyle(rawValue: newOptions.presentationStyle)!
|
||||
}
|
||||
|
||||
if newOptionsMap["transitionStyle"] != nil && browserOptions?.transitionStyle != newOptions.transitionStyle {
|
||||
self.modalTransitionStyle = UIModalTransitionStyle(rawValue: newOptions.transitionStyle)!
|
||||
}
|
||||
|
||||
if newOptionsMap["disallowOverScroll"] != nil && browserOptions?.disallowOverScroll != newOptions.disallowOverScroll {
|
||||
if self.webView.responds(to: #selector(getter: self.webView.scrollView)) {
|
||||
self.webView.scrollView.bounces = !newOptions.disallowOverScroll
|
||||
}
|
||||
else {
|
||||
for subview: UIView in self.webView.subviews {
|
||||
if subview is UIScrollView {
|
||||
(subview as! UIScrollView).bounces = !newOptions.disallowOverScroll
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["enableViewportScale"] != nil && browserOptions?.enableViewportScale != newOptions.enableViewportScale && newOptions.enableViewportScale {
|
||||
let jscript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);"
|
||||
self.webView.evaluateJavaScript(jscript, completionHandler: nil)
|
||||
}
|
||||
|
||||
if newOptionsMap["mediaPlaybackRequiresUserGesture"] != nil && browserOptions?.mediaPlaybackRequiresUserGesture != newOptions.mediaPlaybackRequiresUserGesture {
|
||||
if #available(iOS 10.0, *) {
|
||||
self.webView.configuration.mediaTypesRequiringUserActionForPlayback = (newOptions.mediaPlaybackRequiresUserGesture) ? .all : []
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
self.webView.configuration.mediaPlaybackRequiresUserAction = newOptions.mediaPlaybackRequiresUserGesture
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["allowsInlineMediaPlayback"] != nil && browserOptions?.allowsInlineMediaPlayback != newOptions.allowsInlineMediaPlayback {
|
||||
self.webView.configuration.allowsInlineMediaPlayback = newOptions.allowsInlineMediaPlayback
|
||||
}
|
||||
|
||||
// if newOptionsMap["keyboardDisplayRequiresUserAction"] != nil && browserOptions?.keyboardDisplayRequiresUserAction != newOptions.keyboardDisplayRequiresUserAction {
|
||||
// self.webView.keyboardDisplayRequiresUserAction = newOptions.keyboardDisplayRequiresUserAction
|
||||
// }
|
||||
|
||||
if newOptionsMap["suppressesIncrementalRendering"] != nil && browserOptions?.suppressesIncrementalRendering != newOptions.suppressesIncrementalRendering {
|
||||
self.webView.configuration.suppressesIncrementalRendering = newOptions.suppressesIncrementalRendering
|
||||
}
|
||||
|
||||
if newOptionsMap["allowsBackForwardNavigationGestures"] != nil && browserOptions?.allowsBackForwardNavigationGestures != newOptions.allowsBackForwardNavigationGestures {
|
||||
self.webView.allowsBackForwardNavigationGestures = newOptions.allowsBackForwardNavigationGestures
|
||||
}
|
||||
|
||||
if newOptionsMap["allowsLinkPreview"] != nil && browserOptions?.allowsLinkPreview != newOptions.allowsLinkPreview {
|
||||
if #available(iOS 9.0, *) {
|
||||
self.webView.allowsLinkPreview = newOptions.allowsLinkPreview
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["ignoresViewportScaleLimits"] != nil && browserOptions?.ignoresViewportScaleLimits != newOptions.ignoresViewportScaleLimits {
|
||||
if #available(iOS 10.0, *) {
|
||||
self.webView.configuration.ignoresViewportScaleLimits = newOptions.ignoresViewportScaleLimits
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["allowsInlineMediaPlayback"] != nil && browserOptions?.allowsInlineMediaPlayback != newOptions.allowsInlineMediaPlayback {
|
||||
self.webView.configuration.allowsInlineMediaPlayback = newOptions.allowsInlineMediaPlayback
|
||||
}
|
||||
|
||||
if newOptionsMap["allowsPictureInPictureMediaPlayback"] != nil && browserOptions?.allowsPictureInPictureMediaPlayback != newOptions.allowsPictureInPictureMediaPlayback {
|
||||
if #available(iOS 9.0, *) {
|
||||
self.webView.configuration.allowsPictureInPictureMediaPlayback = newOptions.allowsPictureInPictureMediaPlayback
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["javaScriptCanOpenWindowsAutomatically"] != nil && browserOptions?.javaScriptCanOpenWindowsAutomatically != newOptions.javaScriptCanOpenWindowsAutomatically {
|
||||
self.webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = newOptions.javaScriptCanOpenWindowsAutomatically
|
||||
}
|
||||
|
||||
if newOptionsMap["javaScriptEnabled"] != nil && browserOptions?.javaScriptEnabled != newOptions.javaScriptEnabled {
|
||||
self.webView.configuration.preferences.javaScriptEnabled = newOptions.javaScriptEnabled
|
||||
}
|
||||
|
||||
if newOptionsMap["userAgent"] != nil && browserOptions?.userAgent != newOptions.userAgent && (newOptions.userAgent != "") {
|
||||
if #available(iOS 9.0, *) {
|
||||
self.webView.customUserAgent = newOptions.userAgent
|
||||
}
|
||||
}
|
||||
|
||||
if newOptionsMap["clearCache"] != nil && newOptions.clearCache {
|
||||
clearCache()
|
||||
}
|
||||
|
||||
self.browserOptions = newOptions
|
||||
}
|
||||
|
||||
func getOptions() -> [String: Any]? {
|
||||
return (self.browserOptions != nil) ? self.browserOptions?.getHashMap() : nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class Options: NSObject {
|
|||
super.init()
|
||||
}
|
||||
|
||||
public func parse(options: [String: Any]) -> Options {
|
||||
func parse(options: [String: Any]) -> Options {
|
||||
for (key, value) in options {
|
||||
if self.responds(to: Selector(key)) {
|
||||
self.setValue(value, forKey: key)
|
||||
|
@ -22,5 +22,20 @@ public class Options: NSObject {
|
|||
}
|
||||
return self
|
||||
}
|
||||
|
||||
func getHashMap() -> [String: Any] {
|
||||
var options: [String: Any] = [:]
|
||||
var counts = UInt32();
|
||||
let properties = class_copyPropertyList(object_getClass(self), &counts);
|
||||
for i in 0..<counts {
|
||||
let property = properties?.advanced(by: Int(i)).pointee;
|
||||
|
||||
let cName = property_getName(property!);
|
||||
let name = String(cString: cName)
|
||||
|
||||
options[name] = self.value(forKey: name)
|
||||
}
|
||||
free(properties)
|
||||
return options
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
|
|||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
let arguments = call.arguments as? NSDictionary
|
||||
let uuid: String = (arguments!["uuid"] as? String)!
|
||||
let uuid: String = arguments!["uuid"] as! String
|
||||
|
||||
switch call.method {
|
||||
case "open":
|
||||
|
@ -151,6 +151,33 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
|
|||
self.injectStyleFile(uuid: uuid, arguments: arguments!, result: nil)
|
||||
result(true)
|
||||
break
|
||||
case "takeScreenshot":
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
webViewController?.takeScreenshot(completionHandler: { (screenshot) -> Void in
|
||||
result(screenshot)
|
||||
})
|
||||
}
|
||||
else {
|
||||
result(nil)
|
||||
}
|
||||
break
|
||||
case "setOptions":
|
||||
let optionsType = arguments!["optionsType"] as! String;
|
||||
switch (optionsType){
|
||||
case "InAppBrowserOptions":
|
||||
let inAppBrowserOptions = InAppBrowserOptions();
|
||||
let inAppBroeserOptionsMap = arguments!["options"] as! [String: Any];
|
||||
inAppBrowserOptions.parse(options: inAppBroeserOptionsMap);
|
||||
self.setOptions(uuid: uuid, options: inAppBrowserOptions, optionsMap: inAppBroeserOptionsMap);
|
||||
break;
|
||||
default:
|
||||
result(FlutterError(code: "InAppBrowserFlutterPlugin", message: "Options " + optionsType + " not available.", details: nil))
|
||||
}
|
||||
result(true)
|
||||
break
|
||||
case "getOptions":
|
||||
result(self.getOptions(uuid: uuid))
|
||||
break
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
break
|
||||
|
@ -594,4 +621,17 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
func setOptions(uuid: String, options: InAppBrowserOptions, optionsMap: [String: Any]) {
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
webViewController!.setOptions(newOptions: options, newOptionsMap: optionsMap)
|
||||
}
|
||||
}
|
||||
|
||||
func getOptions(uuid: String) -> [String: Any]? {
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
return webViewController!.getOptions()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,9 @@
|
|||
<outlet property="shareButton" destination="skL-Lw-jYB" id="8hu-WC-OM0"/>
|
||||
<outlet property="spinner" destination="HWt-17-FMf" id="c2Y-Tb-XfA"/>
|
||||
<outlet property="toolbarBottom" destination="8Pf-5R-cFf" id="Og7-Xw-2sq"/>
|
||||
<outlet property="toolbarBottom_TopToWebViewBottomConstraint" destination="KeI-jL-Qoi" id="jKQ-OC-jpD"/>
|
||||
<outlet property="toolbarTop" destination="vlz-kT-71x" id="WgC-80-Z28"/>
|
||||
<outlet property="toolbarTop_BottomToWebViewTopConstraint" destination="Sjd-dV-din" id="vkO-Yu-xaE"/>
|
||||
<outlet property="urlField" destination="sy2-Vx-Cxd" id="MCW-lJ-Ehl"/>
|
||||
<outlet property="webView" destination="gA9-n8-qaQ" id="7JE-lp-bwe"/>
|
||||
</connections>
|
||||
|
|
|
@ -579,7 +579,38 @@ class InAppBrowser {
|
|||
|
||||
}
|
||||
|
||||
///Returns `true` if the browser is opened, otherwise `false`.
|
||||
///Takes a screenshot (in PNG format) of the WebView's visible viewport and returns a `Uint8List`. Returns `null` if it wasn't be able to take it.
|
||||
///
|
||||
///**NOTE for iOS**: available from iOS 11.0+.
|
||||
Future<Uint8List> takeScreenshot() async {
|
||||
this._throwIsNotOpened();
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('uuid', () => uuid);
|
||||
return await _ChannelManager.channel.invokeMethod('takeScreenshot', args);
|
||||
}
|
||||
|
||||
///Sets the [InAppBrowser] options with the new [options] and evaluates them.
|
||||
Future<void> setOptions(Map<String, dynamic> options) async {
|
||||
this._throwIsNotOpened();
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('uuid', () => uuid);
|
||||
args.putIfAbsent('options', () => options);
|
||||
args.putIfAbsent('optionsType', () => "InAppBrowserOptions");
|
||||
await _ChannelManager.channel.invokeMethod('setOptions', args);
|
||||
}
|
||||
|
||||
///Gets the current [InAppBrowser] options. Returns `null` if the options are not setted yet.
|
||||
Future<Map<String, dynamic>> getOptions() async {
|
||||
this._throwIsNotOpened();
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('uuid', () => uuid);
|
||||
args.putIfAbsent('optionsType', () => "InAppBrowserOptions");
|
||||
Map<dynamic, dynamic> options = await _ChannelManager.channel.invokeMethod('getOptions', args);
|
||||
options = options.cast<String, dynamic>();
|
||||
return options;
|
||||
}
|
||||
|
||||
///Returns `true` if the [InAppBrowser] instance is opened, otherwise `false`.
|
||||
bool isOpened() {
|
||||
return this._isOpened;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_inappbrowser
|
||||
description: A Flutter plugin that allows you to open an in-app browser window. (inspired by the popular cordova-plugin-inappbrowser).
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
author: Lorenzo Pichilli <pichillilorenzo@gmail.com>
|
||||
homepage: https://github.com/pichillilorenzo/flutter_inappbrowser
|
||||
|
||||
|
|
Loading…
Reference in New Issue