@capgo/inappbrowser 6.0.44 → 6.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -228,7 +228,7 @@ public class InAppBrowserPlugin
228
228
 
229
229
  @PluginMethod
230
230
  public void clearCookies(PluginCall call) {
231
- String url = call.getString("url");
231
+ String url = call.getString("url", currentUrl);
232
232
  Boolean clearCache = call.getBoolean("cache", false);
233
233
  if (url == null || TextUtils.isEmpty(url)) {
234
234
  call.reject("Invalid URL");
@@ -51,12 +51,17 @@ public class InAppBrowserPlugin: CAPPlugin {
51
51
 
52
52
  @objc func clearCookies(_ call: CAPPluginCall) {
53
53
  let dataStore = WKWebsiteDataStore.default()
54
- let urlString = call.getString("url") ?? ""
55
- let clearCache = call.getBool("cache") ?? false
54
+ let urlString = call.getString("url", "")
55
+ let clearCache = call.getBool("cache", false)
56
56
 
57
57
  if clearCache {
58
58
  URLCache.shared.removeAllCachedResponses()
59
59
  }
60
+ if (urlString.isEmpty) {
61
+ HTTPCookieStorage.shared.cookies?.forEach(HTTPCookieStorage.shared.deleteCookie)
62
+ call.resolve()
63
+ return
64
+ }
60
65
 
61
66
  guard let url = URL(string: urlString), let hostName = url.host else {
62
67
  call.reject("Invalid URL")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "6.0.44",
3
+ "version": "6.0.47",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",