@capacitor/ios 4.4.1-nightly-20221115T150518.0 → 4.5.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.5.0](https://github.com/ionic-team/capacitor/compare/4.4.0...4.5.0) (2022-11-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cli/ios:** Read handleApplicationNotifications configuration option ([#6030](https://github.com/ionic-team/capacitor/issues/6030)) ([99ccf18](https://github.com/ionic-team/capacitor/commit/99ccf181f6ee8a00ed97bdbf9076e2b2ea27cd57))
12
+
13
+
14
+ ### Features
15
+
16
+ * **cookies:** add get cookies plugin method ([ba1e770](https://github.com/ionic-team/capacitor/commit/ba1e7702a3338714aee24388c0afea39706c9341))
17
+
18
+
19
+
20
+
21
+
6
22
  # [4.4.0](https://github.com/ionic-team/capacitor/compare/4.3.0...4.4.0) (2022-10-21)
7
23
 
8
24
 
@@ -46,6 +46,17 @@ public class CapacitorCookieManager {
46
46
  jar.setCookies(cookies, for: url, mainDocumentURL: url)
47
47
  }
48
48
 
49
+ public func getCookiesAsMap(_ url: URL) -> [String: String] {
50
+ var cookiesMap: [String: String] = [:]
51
+ let jar = HTTPCookieStorage.shared
52
+ if let cookies = jar.cookies(for: url) {
53
+ for cookie in cookies {
54
+ cookiesMap[cookie.name] = cookie.value
55
+ }
56
+ }
57
+ return cookiesMap
58
+ }
59
+
49
60
  public func getCookies() -> String {
50
61
  let jar = HTTPCookieStorage.shared
51
62
  guard let url = self.getServerUrl() else { return "" }
@@ -8,6 +8,11 @@ public class CAPCookiesPlugin: CAPPlugin {
8
8
  cookieManager = CapacitorCookieManager(bridge?.config)
9
9
  }
10
10
 
11
+ @objc func getCookies(_ call: CAPPluginCall) {
12
+ guard let url = cookieManager!.getServerUrl(call) else { return call.reject("Invalid URL / Server URL")}
13
+ call.resolve(cookieManager!.getCookiesAsMap(url))
14
+ }
15
+
11
16
  @objc func setCookie(_ call: CAPPluginCall) {
12
17
  guard let key = call.getString("key") else { return call.reject("Must provide key") }
13
18
  guard let value = call.getString("value") else { return call.reject("Must provide value") }
@@ -21,20 +26,9 @@ public class CAPCookiesPlugin: CAPPlugin {
21
26
 
22
27
  @objc func deleteCookie(_ call: CAPPluginCall) {
23
28
  guard let key = call.getString("key") else { return call.reject("Must provide key") }
24
- let url = cookieManager!.getServerUrl(call)
25
- if url != nil {
26
- let jar = HTTPCookieStorage.shared
27
-
28
- let cookie = jar.cookies(for: url!)?.first(where: { (cookie) -> Bool in
29
- return cookie.name == key
30
- })
31
-
32
- if cookie != nil {
33
- jar.deleteCookie(cookie!)
34
- }
35
-
36
- call.resolve()
37
- }
29
+ guard let url = cookieManager!.getServerUrl(call) else { return call.reject("Invalid URL / Server URL")}
30
+ cookieManager!.deleteCookie(url, key)
31
+ call.resolve()
38
32
  }
39
33
 
40
34
  @objc func clearCookies(_ call: CAPPluginCall) {
@@ -3,6 +3,7 @@
3
3
  #import "CAPBridgedPlugin.h"
4
4
 
5
5
  CAP_PLUGIN(CAPCookiesPlugin, "CapacitorCookies",
6
+ CAP_PLUGIN_METHOD(getCookies, CAPPluginReturnPromise);
6
7
  CAP_PLUGIN_METHOD(setCookie, CAPPluginReturnPromise);
7
8
  CAP_PLUGIN_METHOD(deleteCookie, CAPPluginReturnPromise);
8
9
  CAP_PLUGIN_METHOD(clearCookies, CAPPluginReturnPromise);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/ios",
3
- "version": "4.4.1-nightly-20221115T150518.0",
3
+ "version": "4.5.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "9f3c27d4fa22046f4bfc1e9ee4b518f577a78c88"
33
+ "gitHead": "c54a71f5a01e5228c648a1e9194849198a39cee6"
34
34
  }