updated README.md, v0.5.3

This commit is contained in:
pichillilorenzo 2018-10-28 01:16:03 +02:00
parent e2b091b22c
commit 098adfc1dd
4 changed files with 151 additions and 45 deletions

View File

@ -16,6 +16,7 @@
<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$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
@ -36,8 +37,8 @@
<file leaf-file-name="flutter_inappbrowser.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="337">
<caret line="1225" column="66" lean-forward="true" selection-start-line="1225" selection-start-column="66" selection-end-line="1225" selection-end-column="66" />
<state relative-caret-position="428">
<caret line="1154" column="46" lean-forward="true" selection-start-line="1154" selection-start-column="46" selection-end-line="1154" selection-end-column="46" />
<folding>
<element signature="e#814#831#0" expanded="true" />
</folding>
@ -45,11 +46,29 @@
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-4">
<caret line="1114" lean-forward="true" selection-start-line="1114" selection-end-line="1114" />
</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="text-editor">
<state relative-caret-position="240">
<caret line="16" column="10" lean-forward="true" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
</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="226">
<caret line="294" lean-forward="true" selection-start-line="294" selection-end-line="294" />
<state relative-caret-position="170">
<caret line="69" selection-start-line="69" selection-end-line="86" selection-end-column="16" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -139,18 +158,18 @@
<option value="$PROJECT_DIR$/example/assets/index.html" />
<option value="$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig" />
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="1921" />
<option name="x" value="2040" />
<option name="y" value="23" />
<option name="width" value="1749" />
<option name="width" value="1623" />
<option name="height" value="1027" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
@ -345,7 +364,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="1921" y="23" width="1749" height="1027" extended-state="0" />
<frame x="2040" y="23" width="1623" height="1027" extended-state="0" />
<editor active="true" />
<layout>
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
@ -359,13 +378,13 @@
<window_info anchor="bottom" id="Dart Analysis" order="14" weight="0.3276414" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49644473" weight="0.34068358" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49560633" visible="true" weight="0.30650496" />
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49560633" visible="true" weight="0.30650496" />
<window_info anchor="right" id="Flutter Outline" order="6" weight="0.32922077" />
<window_info anchor="bottom" id="Logcat" order="11" />
<window_info id="Captures" order="4" weight="0.32936507" />
<window_info id="Capture Tool" order="6" />
<window_info id="Designer" order="2" />
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.49724367" visible="true" weight="0.14059754" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49724367" visible="true" weight="0.15180266" />
<window_info id="Structure" order="1" sideWeight="0.50275636" side_tool="true" weight="0.1910871" />
<window_info anchor="right" id="Device File Explorer" order="5" side_tool="true" />
<window_info anchor="right" id="Theme Preview" order="7" />
@ -632,30 +651,34 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3761" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="226">
<caret line="294" lean-forward="true" selection-start-line="294" selection-end-line="294" />
<state relative-caret-position="170">
<caret line="69" selection-start-line="69" selection-end-line="86" selection-end-column="16" />
<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="240">
<caret line="16" column="10" lean-forward="true" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-4">
<caret line="1114" lean-forward="true" selection-start-line="1114" selection-end-line="1114" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="337">
<caret line="1225" column="66" lean-forward="true" selection-start-line="1225" selection-start-column="66" selection-end-line="1225" selection-end-column="66" />
<state relative-caret-position="428">
<caret line="1154" column="46" lean-forward="true" selection-start-line="1154" selection-start-column="46" selection-end-line="1154" selection-end-column="46" />
<folding>
<element signature="e#814#831#0" expanded="true" />
</folding>

View File

@ -33,6 +33,7 @@ Classes:
- [InAppBrowser](#inappbrowser-class): In-App Browser using native WebView.
- [ChromeSafariBrowser](#chromesafaribrowser-class): In-App Browser using [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.
- [InAppLocalhostServer](#inapplocalhostserver-class): This class allows you to create a simple server on `http://localhost:[port]/`. The default `port` value is `8080`.
- [CookieManager](#cookiemanager-class): Manages the cookies used by WebView instances. **NOTE for iOS**: available from iOS 11.0+.
### `InAppWebView` class
Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
@ -1111,3 +1112,72 @@ Closes the server.
```dart
localhostServer.close();
```
### `CookieManager` class
Manages the cookies used by WebView instances.
**NOTE for iOS**: available from iOS 11.0+.
Example:
```dart
var url = "https://flutter.io/";
await CookieManager.setCookie(url, "myCookie", "cookieValue", domain: "flutter.io", expiresDate: 1540838864611);
print(await CookieManager.getCookies(url));
print(await CookieManager.getCookie(url, "myCookie"));
await CookieManager.deleteCookie(url, "myCookie");
await CookieManager.deleteCookie(url, "_gid", domain: ".googleblog.com");
await CookieManager.deleteCookies(url);
await CookieManager.deleteAllCookies();
```
#### static Future\<void\> CookieManager.setCookie
Sets a cookie for the given `url`. Any existing cookie with the same `host`, `path` and `name` will be replaced with the new cookie.
The cookie being set will be ignored if it is expired.
The default value of `path` is `"/"`.
If `domain` is `null`, its default value will be the domain name of `url`.
```dart
CookieManager.setCookie(String url, String name, String value, { String domain, String path = "/", int expiresDate, int maxAge, bool isSecure });
```
#### static Future\<void\> CookieManager.getCookies
Gets all the cookies for the given `url`.
```dart
CookieManager.getCookies(String url);
```
#### static Future\<void\> CookieManager.getCookie
Gets a cookie by its `name` for the given `url`.
```dart
CookieManager.getCookie(String url, String name);
```
#### static Future\<void\> CookieManager.deleteCookie
Removes a cookie by its `name` for the given `url`, `domain` and `path`.
The default value of `path` is `"/"`.
If `domain` is `null` or empty, its default value will be the domain name of `url`.
```dart
CookieManager.deleteCookie(String url, String name, {String domain = "", String path = "/"});
```
#### static Future\<void\> CookieManager.deleteCookies
Removes all cookies for the given `url`, `domain` and `path`.
The default value of `path` is `"/"`.
If `domain` is `null` or empty, its default value will be the domain name of `url`.
```dart
CookieManager.deleteCookies(String url, {String domain = "", String path = "/"});
```
#### static Future\<void\> CookieManager.deleteAllCookies
Removes all cookies.
```dart
CookieManager.deleteAllCookies();
```

View File

@ -67,24 +67,24 @@ class MyInAppBrowser extends InAppBrowser {
//
// print(await this.webViewController.injectScriptCode("document.cookie"));
//
// print("");
// print(await CookieManager.getCookies(url));
// print("");
// print(await CookieManager.getCookie(url, "my_cookie2"));
// print("");
// await CookieManager.deleteCookie(url, "my_cookie2");
// await CookieManager.deleteCookie(url, "_gid", domain: ".googleblog.com");
// print("");
// print(await CookieManager.getCookies(url));
// print("");
// await CookieManager.deleteCookies(url);
// print("");
// print(await CookieManager.getCookies(url));
// print("");
// await CookieManager.deleteAllCookies();
// print("");
// print(await CookieManager.getCookies(url));
// print("");
print("");
print(await CookieManager.getCookies(url));
print("");
print(await CookieManager.getCookie(url, "my_cookie2"));
print("");
await CookieManager.deleteCookie(url, "my_cookie2");
await CookieManager.deleteCookie(url, "_gid", domain: ".googleblog.com");
print("");
print(await CookieManager.getCookies(url));
print("");
await CookieManager.deleteCookies(url);
print("");
print(await CookieManager.getCookies(url));
print("");
await CookieManager.deleteAllCookies();
print("");
print(await CookieManager.getCookies(url));
print("");
//
// print(await this.webViewController.injectScriptCode("null"));
// print(await this.webViewController.injectScriptCode("undefined"));
@ -290,8 +290,8 @@ class _MyAppState extends State<MyApp> {
// //"toolbarBottom": false
// });
//
// await CookieManager.setCookie("https://flutter.io/", "my_cookie2", "cookieValue2", domain: "flutter.io", expiresDate: 1540838864611);
// await CookieManager.setCookie("https://flutter.io/", "my_cookie", "cookieValue", domain: "flutter.io", expiresDate: 1540838864611);
await CookieManager.setCookie("https://flutter.io/", "my_cookie2", "cookieValue2", domain: "flutter.io", expiresDate: 1540838864611);
await CookieManager.setCookie("https://flutter.io/", "my_cookie", "cookieValue", domain: "flutter.io", expiresDate: 1540838864611);
await inAppBrowserFallback.open(url: "https://flutter.io/", options: {
//"useOnLoadResource": true,

View File

@ -1119,7 +1119,7 @@ class InAppLocalhostServer {
}
///Manages the cookies used by an application's [InAppWebView] instances.
///Manages the cookies used by WebView instances.
///
///**NOTE for iOS**: available from iOS 11.0+.
class CookieManager {
@ -1171,6 +1171,9 @@ class CookieManager {
///Gets all the cookies for the given [url].
static Future<List<Map<String, dynamic>>> getCookies(String url) async {
if (!_initialized)
_init();
assert(url != null && url.isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{};
@ -1186,6 +1189,9 @@ class CookieManager {
///Gets a cookie by its [name] for the given [url].
static Future<Map<String, dynamic>> getCookie(String url, String name) async {
if (!_initialized)
_init();
assert(url != null && url.isNotEmpty);
assert(name != null && name.isNotEmpty);
@ -1206,6 +1212,8 @@ class CookieManager {
///The default value of [path] is `"/"`.
///If [domain] is `null` or empty, its default value will be the domain name of [url].
static Future<void> deleteCookie(String url, String name, {String domain = "", String path = "/"}) async {
if (!_initialized)
_init();
if (domain == null || domain.isEmpty)
domain = _getDomainName(url);
@ -1228,6 +1236,8 @@ class CookieManager {
///The default value of [path] is `"/"`.
///If [domain] is `null` or empty, its default value will be the domain name of [url].
static Future<void> deleteCookies(String url, {String domain = "", String path = "/"}) async {
if (!_initialized)
_init();
if (domain == null || domain.isEmpty)
domain = _getDomainName(url);
@ -1245,6 +1255,9 @@ class CookieManager {
///Removes all cookies.
static Future<void> deleteAllCookies() async {
if (!_initialized)
_init();
Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('deleteAllCookies', args);
}