parent
67b0f2002f
commit
b6b1e0e290
|
@ -1,6 +1,7 @@
|
|||
## 3.1.1
|
||||
|
||||
- Fixed `Confirmation dialog (onbeforeunload) displayed after popped from webview page` [#337](https://github.com/pichillilorenzo/flutter_inappwebview/issues/337)
|
||||
- Fixed `CookieManager.setCookie` `expiresDate` option
|
||||
|
||||
## 3.1.0
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.pichillilorenzo.flutter_inappwebview;
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.ValueCallback;
|
||||
|
@ -10,6 +11,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
@ -43,6 +45,8 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler {
|
|||
String path = (String) call.argument("path");
|
||||
String expiresDateString = (String) call.argument("expiresDate");
|
||||
Long expiresDate = (expiresDateString != null ? new Long(expiresDateString) : null);
|
||||
Log.d(LOG_TAG, expiresDateString + "");
|
||||
Log.d(LOG_TAG, expiresDate + "");
|
||||
Integer maxAge = (Integer) call.argument("maxAge");
|
||||
Boolean isSecure = (Boolean) call.argument("isSecure");
|
||||
MyCookieManager.setCookie(url, name, value, domain, path, expiresDate, maxAge, isSecure, result);
|
||||
|
@ -99,6 +103,8 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler {
|
|||
|
||||
cookieValue += ";";
|
||||
|
||||
Log.d(LOG_TAG, cookieValue + "");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cookieManager.setCookie(url, cookieValue, new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
|
@ -217,7 +223,7 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler {
|
|||
}
|
||||
|
||||
public static String getCookieExpirationDate(Long timestamp) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy hh:mm:ss z");
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy hh:mm:ss z", Locale.US);
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return sdf.format(new Date(timestamp));
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.8+5/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-3.3.0/","dependencies":[]}],"android":[{"name":"connectivity","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.8+5/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-3.3.0/","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_macos-0.1.0+3/","dependencies":[]},{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"connectivity","dependencies":["connectivity_macos"]},{"name":"connectivity_macos","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-05-11 13:40:48.620696","version":"1.17.0"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.8+5/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-3.3.0/","dependencies":[]}],"android":[{"name":"connectivity","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.8+5/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-3.3.0/","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_macos-0.1.0+3/","dependencies":[]},{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"connectivity","dependencies":["connectivity_macos"]},{"name":"connectivity_macos","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-05-11 15:01:02.801973","version":"1.17.0"}
|
|
@ -37,8 +37,13 @@ class MyCookieManager: NSObject, FlutterPlugin {
|
|||
let value = arguments!["value"] as! String
|
||||
let domain = arguments!["domain"] as! String
|
||||
let path = arguments!["path"] as! String
|
||||
let expiresDate = arguments!["expiresDate"] as? Int
|
||||
let maxAge = arguments!["maxAge"] as? Int
|
||||
|
||||
var expiresDate: Int64?
|
||||
if let expiresDateString = arguments!["expiresDate"] as? String {
|
||||
expiresDate = Int64(expiresDateString)
|
||||
}
|
||||
|
||||
let maxAge = arguments!["maxAge"] as? Int64
|
||||
let isSecure = arguments!["isSecure"] as? Bool
|
||||
|
||||
MyCookieManager.setCookie(url: url, name: name, value: value, domain: domain, path: path, expiresDate: expiresDate, maxAge: maxAge, isSecure: isSecure, result: result)
|
||||
|
@ -74,8 +79,8 @@ class MyCookieManager: NSObject, FlutterPlugin {
|
|||
value: String,
|
||||
domain: String,
|
||||
path: String,
|
||||
expiresDate: Int?,
|
||||
maxAge: Int?,
|
||||
expiresDate: Int64?,
|
||||
maxAge: Int64?,
|
||||
isSecure: Bool?,
|
||||
result: @escaping FlutterResult) {
|
||||
var properties: [HTTPCookiePropertyKey: Any] = [:]
|
||||
|
@ -85,7 +90,7 @@ class MyCookieManager: NSObject, FlutterPlugin {
|
|||
properties[.domain] = domain
|
||||
properties[.path] = path
|
||||
if expiresDate != nil {
|
||||
properties[.expires] = NSDate(timeIntervalSince1970: Double(expiresDate!))
|
||||
properties[.expires] = Date(timeIntervalSince1970: TimeInterval(Double(expiresDate!)/1000))
|
||||
}
|
||||
if maxAge != nil {
|
||||
properties[.maximumAge] = String(maxAge!)
|
||||
|
|
Loading…
Reference in New Issue