Merge pull request #40 from Sense545/master

Fixed bug where passing null to expiresDate failed
This commit is contained in:
Lorenzo Pichilli 2019-03-10 21:54:08 +01:00 committed by GitHub
commit 2b600fbb6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -45,7 +45,8 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler {
String value = (String) call.argument("value");
String domain = (String) call.argument("domain");
String path = (String) call.argument("path");
Long expiresDate = new Long((String) call.argument("expiresDate"));
String expiresDateString = (String) call.argument("expiresDate");
Long expiresDate = (expiresDateString != null ? new Long(expiresDateString) : null);
Integer maxAge = (Integer) call.argument("maxAge");
Boolean isSecure = (Boolean) call.argument("isSecure");
MyCookieManager.setCookie(url, name, value, domain, path, expiresDate, maxAge, isSecure, result);

View File

@ -1393,7 +1393,7 @@ class CookieManager {
args.putIfAbsent('value', () => value);
args.putIfAbsent('domain', () => domain);
args.putIfAbsent('path', () => path);
args.putIfAbsent('expiresDate', () => expiresDate.toString());
args.putIfAbsent('expiresDate', () => expiresDate?.toString());
args.putIfAbsent('maxAge', () => maxAge);
args.putIfAbsent('isSecure', () => isSecure);