react-native-nitro-cookies 1.0.1 → 1.0.3
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/NitroCookies.podspec +8 -0
- package/android/src/main/java/com/margelo/nitro/nitrocookies/NitroCookies.kt +26 -15
- package/ios/NitroCookies.swift +65 -36
- package/lib/typescript/src/NitroCookies.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JCookie.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.cpp +9 -1
- package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.hpp +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/Cookie.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/HybridNitroCookiesSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/nitrocookiesOnLoad.kt +1 -1
- package/nitrogen/generated/android/nitrocookies+autolinking.cmake +1 -1
- package/nitrogen/generated/android/nitrocookies+autolinking.gradle +1 -1
- package/nitrogen/generated/android/nitrocookiesOnLoad.cpp +1 -1
- package/nitrogen/generated/android/nitrocookiesOnLoad.hpp +1 -1
- package/nitrogen/generated/ios/NitroCookies+autolinking.rb +2 -2
- package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.cpp +2 -1
- package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.hpp +3 -3
- package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/NitroCookiesAutolinking.mm +1 -1
- package/nitrogen/generated/ios/NitroCookiesAutolinking.swift +9 -8
- package/nitrogen/generated/ios/c++/HybridNitroCookiesSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNitroCookiesSpecSwift.hpp +7 -1
- package/nitrogen/generated/ios/swift/Cookie.swift +59 -143
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__vector_Cookie_.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec.swift +3 -5
- package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec_cxx.swift +9 -3
- package/nitrogen/generated/shared/c++/Cookie.hpp +34 -26
- package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.hpp +1 -1
- package/package.json +13 -13
- package/src/NitroCookies.nitro.ts +4 -2
package/NitroCookies.podspec
CHANGED
|
@@ -20,6 +20,14 @@ Pod::Spec.new do |s|
|
|
|
20
20
|
"cpp/**/*.{hpp,cpp}",
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
+
s.pod_target_xcconfig = {
|
|
24
|
+
"HEADER_SEARCH_PATHS" => [
|
|
25
|
+
"${PODS_ROOT}/RCT-Folly",
|
|
26
|
+
],
|
|
27
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES",
|
|
28
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
s.dependency 'React-jsi'
|
|
24
32
|
s.dependency 'React-callinvoker'
|
|
25
33
|
|
|
@@ -36,9 +36,9 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
36
36
|
} else {
|
|
37
37
|
expiresISO
|
|
38
38
|
}
|
|
39
|
-
val date = iso8601Formatter.parse(normalizedISO)
|
|
39
|
+
val date = iso8601Formatter.get()!!.parse(normalizedISO)
|
|
40
40
|
date?.let {
|
|
41
|
-
val expiresRFC = rfc1123Formatter.format(it)
|
|
41
|
+
val expiresRFC = rfc1123Formatter.get()!!.format(it)
|
|
42
42
|
parts.add("Expires=$expiresRFC")
|
|
43
43
|
}
|
|
44
44
|
} catch (e: Exception) {
|
|
@@ -92,8 +92,8 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
92
92
|
part.startsWith("Expires=", ignoreCase = true) -> {
|
|
93
93
|
val expiresRFC = part.substring(8).trim()
|
|
94
94
|
try {
|
|
95
|
-
val date = rfc1123Formatter.parse(expiresRFC)
|
|
96
|
-
date?.let { expires = iso8601Formatter.format(it) }
|
|
95
|
+
val date = rfc1123Formatter.get()!!.parse(expiresRFC)
|
|
96
|
+
date?.let { expires = iso8601Formatter.get()!!.format(it) }
|
|
97
97
|
} catch (e: Exception) {
|
|
98
98
|
// Invalid date, skip
|
|
99
99
|
}
|
|
@@ -135,7 +135,7 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
135
135
|
// Wildcard match (.example.com matches api.example.com)
|
|
136
136
|
if (cookieDomain.startsWith(".")) {
|
|
137
137
|
val domain = cookieDomain.substring(1)
|
|
138
|
-
return urlHost.endsWith(domain) || urlHost == domain
|
|
138
|
+
return urlHost.endsWith(".$domain") || urlHost == domain
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// Subdomain match (example.com matches api.example.com)
|
|
@@ -331,8 +331,12 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
331
331
|
override fun clearAll(useWebKit: Boolean?): Promise<Boolean> {
|
|
332
332
|
val promise = Promise<Boolean>()
|
|
333
333
|
Handler(Looper.getMainLooper()).post {
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
try {
|
|
335
|
+
val cookieManager = CookieManager.getInstance()
|
|
336
|
+
cookieManager.removeAllCookies { removed -> promise.resolve(removed) }
|
|
337
|
+
} catch (e: Exception) {
|
|
338
|
+
promise.reject(e)
|
|
339
|
+
}
|
|
336
340
|
}
|
|
337
341
|
return promise
|
|
338
342
|
}
|
|
@@ -359,9 +363,9 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
359
363
|
/** Make HTTP request and get cookies from response */
|
|
360
364
|
override fun getFromResponse(url: String): Promise<Array<Cookie>> {
|
|
361
365
|
return Promise.async {
|
|
366
|
+
val urlObj = validateURL(url)
|
|
367
|
+
val connection = urlObj.openConnection() as HttpURLConnection
|
|
362
368
|
try {
|
|
363
|
-
val urlObj = validateURL(url)
|
|
364
|
-
val connection = urlObj.openConnection() as HttpURLConnection
|
|
365
369
|
connection.requestMethod = "GET"
|
|
366
370
|
connection.connect()
|
|
367
371
|
|
|
@@ -373,10 +377,11 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
373
377
|
cookie?.let { cookies.add(it) }
|
|
374
378
|
}
|
|
375
379
|
|
|
376
|
-
connection.disconnect()
|
|
377
380
|
cookies.toTypedArray()
|
|
378
381
|
} catch (e: Exception) {
|
|
379
|
-
throw Exception("NETWORK_ERROR: ${e.message}")
|
|
382
|
+
throw Exception("NETWORK_ERROR: ${e.message}", e)
|
|
383
|
+
} finally {
|
|
384
|
+
connection.disconnect()
|
|
380
385
|
}
|
|
381
386
|
}
|
|
382
387
|
}
|
|
@@ -425,23 +430,29 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
425
430
|
override fun removeSessionCookies(): Promise<Boolean> {
|
|
426
431
|
val promise = Promise<Boolean>()
|
|
427
432
|
Handler(Looper.getMainLooper()).post {
|
|
428
|
-
|
|
429
|
-
|
|
433
|
+
try {
|
|
434
|
+
val cookieManager = CookieManager.getInstance()
|
|
435
|
+
cookieManager.removeSessionCookies { removed -> promise.resolve(removed) }
|
|
436
|
+
} catch (e: Exception) {
|
|
437
|
+
promise.reject(e)
|
|
438
|
+
}
|
|
430
439
|
}
|
|
431
440
|
return promise
|
|
432
441
|
}
|
|
433
442
|
|
|
434
443
|
companion object {
|
|
435
444
|
/** ISO 8601 date formatter for cookie expires (yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ) */
|
|
436
|
-
private val iso8601Formatter =
|
|
445
|
+
private val iso8601Formatter = ThreadLocal.withInitial {
|
|
437
446
|
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", Locale.US).apply {
|
|
438
447
|
timeZone = TimeZone.getTimeZone("UTC")
|
|
439
448
|
}
|
|
449
|
+
}
|
|
440
450
|
|
|
441
451
|
/** RFC 1123 date formatter for Set-Cookie headers (EEE, dd MMM yyyy HH:mm:ss z) */
|
|
442
|
-
private val rfc1123Formatter =
|
|
452
|
+
private val rfc1123Formatter = ThreadLocal.withInitial {
|
|
443
453
|
SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US).apply {
|
|
444
454
|
timeZone = TimeZone.getTimeZone("GMT")
|
|
445
455
|
}
|
|
456
|
+
}
|
|
446
457
|
}
|
|
447
458
|
}
|
package/ios/NitroCookies.swift
CHANGED
|
@@ -25,6 +25,27 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
25
25
|
return formatter
|
|
26
26
|
}()
|
|
27
27
|
|
|
28
|
+
/// RFC 1123 date formatter for Set-Cookie Expires attribute
|
|
29
|
+
private static let rfc1123Formatter: DateFormatter = {
|
|
30
|
+
let formatter = DateFormatter()
|
|
31
|
+
formatter.locale = Locale(identifier: "en_US_POSIX")
|
|
32
|
+
formatter.timeZone = TimeZone(abbreviation: "GMT")
|
|
33
|
+
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss zzz"
|
|
34
|
+
return formatter
|
|
35
|
+
}()
|
|
36
|
+
|
|
37
|
+
/// Remove CR, LF, and NUL characters that could enable header injection
|
|
38
|
+
private static func sanitizeCookieToken(_ value: String) -> String {
|
|
39
|
+
var result = ""
|
|
40
|
+
result.reserveCapacity(value.count)
|
|
41
|
+
for scalar in value.unicodeScalars {
|
|
42
|
+
if scalar != "\r" && scalar != "\n" && scalar != "\0" {
|
|
43
|
+
result.append(String(scalar))
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result
|
|
47
|
+
}
|
|
48
|
+
|
|
28
49
|
// MARK: - Helper Functions
|
|
29
50
|
|
|
30
51
|
/**
|
|
@@ -42,24 +63,49 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
42
63
|
.path: cookiePath
|
|
43
64
|
]
|
|
44
65
|
|
|
45
|
-
// Add expires if provided
|
|
46
66
|
if let expiresString = cookie.expires,
|
|
47
67
|
let expiresDate = Self.iso8601Formatter.date(from: expiresString) {
|
|
48
68
|
properties[.expires] = expiresDate
|
|
49
69
|
}
|
|
50
70
|
|
|
51
|
-
// Add secure flag
|
|
52
71
|
if cookie.secure == true {
|
|
53
72
|
properties[.secure] = "TRUE"
|
|
54
73
|
}
|
|
55
74
|
|
|
56
|
-
// Note: HttpOnly is handled via the isHTTPOnly property, not in properties dict
|
|
57
|
-
|
|
58
75
|
guard let httpCookie = HTTPCookie(properties: properties) else {
|
|
59
76
|
throw NSError(domain: "NitroCookies", code: 1,
|
|
60
77
|
userInfo: [NSLocalizedDescriptionKey: "Failed to create HTTPCookie"])
|
|
61
78
|
}
|
|
62
79
|
|
|
80
|
+
// HTTPCookie(properties:) ignores httpOnly — there is no property key for it.
|
|
81
|
+
// When httpOnly is requested, rebuild via Set-Cookie header parsing which
|
|
82
|
+
// correctly handles the HttpOnly attribute, while preserving the original domain.
|
|
83
|
+
if cookie.httpOnly == true {
|
|
84
|
+
let originalDomain = httpCookie.domain
|
|
85
|
+
let safeName = Self.sanitizeCookieToken(httpCookie.name)
|
|
86
|
+
let safeValue = Self.sanitizeCookieToken(httpCookie.value)
|
|
87
|
+
var parts: [String] = ["\(safeName)=\(safeValue)"]
|
|
88
|
+
parts.append("Domain=\(originalDomain)")
|
|
89
|
+
parts.append("Path=\(httpCookie.path)")
|
|
90
|
+
if let expires = httpCookie.expiresDate {
|
|
91
|
+
parts.append("Expires=\(Self.rfc1123Formatter.string(from: expires))")
|
|
92
|
+
}
|
|
93
|
+
if httpCookie.isSecure {
|
|
94
|
+
parts.append("Secure")
|
|
95
|
+
}
|
|
96
|
+
parts.append("HttpOnly")
|
|
97
|
+
|
|
98
|
+
let setCookieHeader = parts.joined(separator: "; ")
|
|
99
|
+
let headerFields = ["Set-Cookie": setCookieHeader]
|
|
100
|
+
let parsed = HTTPCookie.cookies(withResponseHeaderFields: headerFields, for: url)
|
|
101
|
+
|
|
102
|
+
guard let httpOnlyCookie = parsed.first else {
|
|
103
|
+
throw NSError(domain: "NitroCookies", code: 1,
|
|
104
|
+
userInfo: [NSLocalizedDescriptionKey: "Failed to create HTTPCookie with HttpOnly"])
|
|
105
|
+
}
|
|
106
|
+
return httpOnlyCookie
|
|
107
|
+
}
|
|
108
|
+
|
|
63
109
|
return httpCookie
|
|
64
110
|
}
|
|
65
111
|
|
|
@@ -71,11 +117,18 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
71
117
|
Self.iso8601Formatter.string(from: $0)
|
|
72
118
|
}
|
|
73
119
|
|
|
120
|
+
// Strip leading dot from domain — NSHTTPCookieStorage and Set-Cookie
|
|
121
|
+
// parsing add a dot prefix per RFC 6265, but callers expect the bare domain.
|
|
122
|
+
var domain = httpCookie.domain
|
|
123
|
+
if domain.hasPrefix(".") {
|
|
124
|
+
domain = String(domain.dropFirst())
|
|
125
|
+
}
|
|
126
|
+
|
|
74
127
|
return Cookie(
|
|
75
128
|
name: httpCookie.name,
|
|
76
129
|
value: httpCookie.value,
|
|
77
130
|
path: httpCookie.path,
|
|
78
|
-
domain:
|
|
131
|
+
domain: domain,
|
|
79
132
|
version: String(httpCookie.version),
|
|
80
133
|
expires: expiresString,
|
|
81
134
|
secure: httpCookie.isSecure,
|
|
@@ -95,7 +148,7 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
95
148
|
// Wildcard match (.example.com matches api.example.com)
|
|
96
149
|
if cookieDomain.hasPrefix(".") {
|
|
97
150
|
let domain = String(cookieDomain.dropFirst())
|
|
98
|
-
return urlHost.hasSuffix(domain) || urlHost == domain
|
|
151
|
+
return urlHost.hasSuffix("." + domain) || urlHost == domain
|
|
99
152
|
}
|
|
100
153
|
|
|
101
154
|
// Subdomain match (example.com matches api.example.com)
|
|
@@ -158,16 +211,7 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
158
211
|
let url = try validateURL(urlString)
|
|
159
212
|
try validateDomain(cookie: cookie, url: url)
|
|
160
213
|
|
|
161
|
-
|
|
162
|
-
var cookieWithDefaults = cookie
|
|
163
|
-
if cookieWithDefaults.path == nil {
|
|
164
|
-
cookieWithDefaults.path = "/"
|
|
165
|
-
}
|
|
166
|
-
if cookieWithDefaults.domain == nil {
|
|
167
|
-
cookieWithDefaults.domain = url.host
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let httpCookie = try makeHTTPCookie(from: cookieWithDefaults, url: url)
|
|
214
|
+
let httpCookie = try makeHTTPCookie(from: cookie, url: url)
|
|
171
215
|
HTTPCookieStorage.shared.setCookie(httpCookie)
|
|
172
216
|
return true
|
|
173
217
|
}
|
|
@@ -218,16 +262,7 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
218
262
|
let url = try self.validateURL(urlString)
|
|
219
263
|
try self.validateDomain(cookie: cookie, url: url)
|
|
220
264
|
|
|
221
|
-
|
|
222
|
-
var cookieWithDefaults = cookie
|
|
223
|
-
if cookieWithDefaults.path == nil {
|
|
224
|
-
cookieWithDefaults.path = "/"
|
|
225
|
-
}
|
|
226
|
-
if cookieWithDefaults.domain == nil {
|
|
227
|
-
cookieWithDefaults.domain = url.host
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
let httpCookie = try self.makeHTTPCookie(from: cookieWithDefaults, url: url)
|
|
265
|
+
let httpCookie = try self.makeHTTPCookie(from: cookie, url: url)
|
|
231
266
|
|
|
232
267
|
if useWebKit == true {
|
|
233
268
|
// Use WKHTTPCookieStore
|
|
@@ -367,10 +402,8 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
367
402
|
userInfo: [NSLocalizedDescriptionKey: "Not HTTP response"])
|
|
368
403
|
}
|
|
369
404
|
|
|
370
|
-
let
|
|
371
|
-
|
|
372
|
-
for: url
|
|
373
|
-
)
|
|
405
|
+
let headerFields = httpResponse.allHeaderFields as? [String: String] ?? [:]
|
|
406
|
+
let cookies = HTTPCookie.cookies(withResponseHeaderFields: headerFields, for: url)
|
|
374
407
|
|
|
375
408
|
return cookies.map { self.createCookieData(from: $0) }
|
|
376
409
|
}
|
|
@@ -466,9 +499,7 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
466
499
|
*/
|
|
467
500
|
public func flush() throws -> Promise<Void> {
|
|
468
501
|
return Promise.async {
|
|
469
|
-
|
|
470
|
-
userInfo: [NSLocalizedDescriptionKey:
|
|
471
|
-
"flush() is only available on Android"])
|
|
502
|
+
// No-op on iOS - cookies are automatically persisted
|
|
472
503
|
}
|
|
473
504
|
}
|
|
474
505
|
|
|
@@ -477,9 +508,7 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
477
508
|
*/
|
|
478
509
|
public func removeSessionCookies() throws -> Promise<Bool> {
|
|
479
510
|
return Promise.async {
|
|
480
|
-
|
|
481
|
-
userInfo: [NSLocalizedDescriptionKey:
|
|
482
|
-
"removeSessionCookies() is only available on Android"])
|
|
511
|
+
return false
|
|
483
512
|
}
|
|
484
513
|
}
|
|
485
514
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroCookies.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroCookies.nitro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"NitroCookies.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroCookies.nitro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY,CAAC;IACjD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IAKA;;;;;;;;;OASG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9C;;;;;;;OAOG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzD;;;;;;;OAOG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAMpD;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzD;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE/C;;;;;;;OAOG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JHybridNitroCookiesSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "JHybridNitroCookiesSpec.hpp"
|
|
@@ -17,6 +17,7 @@ namespace margelo::nitro::nitrocookies { struct Cookie; }
|
|
|
17
17
|
#include <optional>
|
|
18
18
|
#include <NitroModules/Promise.hpp>
|
|
19
19
|
#include <NitroModules/JPromise.hpp>
|
|
20
|
+
#include <NitroModules/JUnit.hpp>
|
|
20
21
|
|
|
21
22
|
namespace margelo::nitro::nitrocookies {
|
|
22
23
|
|
|
@@ -35,6 +36,13 @@ namespace margelo::nitro::nitrocookies {
|
|
|
35
36
|
return method(_javaPart);
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
bool JHybridNitroCookiesSpec::equals(const std::shared_ptr<HybridObject>& other) {
|
|
40
|
+
if (auto otherCast = std::dynamic_pointer_cast<JHybridNitroCookiesSpec>(other)) {
|
|
41
|
+
return _javaPart == otherCast->_javaPart;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
void JHybridNitroCookiesSpec::dispose() noexcept {
|
|
39
47
|
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
40
48
|
method(_javaPart);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -40,6 +40,7 @@ namespace margelo::nitro::nitrocookies {
|
|
|
40
40
|
|
|
41
41
|
public:
|
|
42
42
|
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override;
|
|
43
44
|
void dispose() noexcept override;
|
|
44
45
|
std::string toString() override;
|
|
45
46
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Cookie.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.nitrocookies
|
|
@@ -44,7 +44,7 @@ data class Cookie(
|
|
|
44
44
|
) {
|
|
45
45
|
/* primary constructor */
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
companion object {
|
|
48
48
|
/**
|
|
49
49
|
* Constructor called from C++
|
|
50
50
|
*/
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/HybridNitroCookiesSpec.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.nitrocookies
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/nitrocookiesOnLoad.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// nitrocookiesOnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.nitrocookies
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# nitrocookies+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// nitrocookies+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// nitrocookiesOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_NITROCOOKIES_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# NitroCookies+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
|
|
|
52
52
|
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
53
|
# Use C++ 20
|
|
54
54
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
-
# Enables C++ <-> Swift interop (by default it's only
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroCookies-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "NitroCookies-Swift-Cxx-Bridge.hpp"
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "HybridNitroCookiesSpecSwift.hpp"
|
|
12
12
|
#include "NitroCookies-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
13
14
|
|
|
14
15
|
namespace margelo::nitro::nitrocookies::bridge::swift {
|
|
15
16
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroCookies-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -48,7 +48,7 @@ namespace margelo::nitro::nitrocookies::bridge::swift {
|
|
|
48
48
|
return optional.has_value();
|
|
49
49
|
}
|
|
50
50
|
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
51
|
-
return
|
|
51
|
+
return optional.value();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// pragma MARK: std::optional<bool>
|
|
@@ -63,7 +63,7 @@ namespace margelo::nitro::nitrocookies::bridge::swift {
|
|
|
63
63
|
return optional.has_value();
|
|
64
64
|
}
|
|
65
65
|
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
66
|
-
return
|
|
66
|
+
return optional.value();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// pragma MARK: std::vector<Cookie>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroCookiesAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
/// NitroCookiesAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
8
12
|
public final class NitroCookiesAutolinking {
|
|
9
13
|
public typealias bridge = margelo.nitro.nitrocookies.bridge.swift
|
|
10
14
|
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of a Swift class that implements `HybridNitroCookiesSpec`,
|
|
13
|
-
* and wraps it in a Swift class that can directly interop with C++ (`HybridNitroCookiesSpec_cxx`)
|
|
14
|
-
*
|
|
15
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `HybridNitroCookies`).
|
|
17
|
-
*/
|
|
18
15
|
public static func createNitroCookies() -> bridge.std__shared_ptr_HybridNitroCookiesSpec_ {
|
|
19
16
|
let hybridObject = HybridNitroCookies()
|
|
20
17
|
return { () -> bridge.std__shared_ptr_HybridNitroCookiesSpec_ in
|
|
@@ -22,4 +19,8 @@ public final class NitroCookiesAutolinking {
|
|
|
22
19
|
return __cxxWrapped.getCxxPart()
|
|
23
20
|
}()
|
|
24
21
|
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroCookiesRecyclable() -> Bool {
|
|
24
|
+
return HybridNitroCookies.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
25
26
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNitroCookiesSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -52,6 +52,12 @@ namespace margelo::nitro::nitrocookies {
|
|
|
52
52
|
inline size_t getExternalMemorySize() noexcept override {
|
|
53
53
|
return _swiftPart.getMemorySize();
|
|
54
54
|
}
|
|
55
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
56
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroCookiesSpecSwift>(other)) {
|
|
57
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
55
61
|
void dispose() noexcept override {
|
|
56
62
|
_swiftPart.dispose();
|
|
57
63
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Cookie.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -58,169 +58,85 @@ public extension Cookie {
|
|
|
58
58
|
}())
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
@inline(__always)
|
|
61
62
|
var name: String {
|
|
62
|
-
|
|
63
|
-
get {
|
|
64
|
-
return String(self.__name)
|
|
65
|
-
}
|
|
66
|
-
@inline(__always)
|
|
67
|
-
set {
|
|
68
|
-
self.__name = std.string(newValue)
|
|
69
|
-
}
|
|
63
|
+
return String(self.__name)
|
|
70
64
|
}
|
|
71
65
|
|
|
66
|
+
@inline(__always)
|
|
72
67
|
var value: String {
|
|
73
|
-
|
|
74
|
-
get {
|
|
75
|
-
return String(self.__value)
|
|
76
|
-
}
|
|
77
|
-
@inline(__always)
|
|
78
|
-
set {
|
|
79
|
-
self.__value = std.string(newValue)
|
|
80
|
-
}
|
|
68
|
+
return String(self.__value)
|
|
81
69
|
}
|
|
82
70
|
|
|
71
|
+
@inline(__always)
|
|
83
72
|
var path: String? {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}()
|
|
94
|
-
}
|
|
95
|
-
@inline(__always)
|
|
96
|
-
set {
|
|
97
|
-
self.__path = { () -> bridge.std__optional_std__string_ in
|
|
98
|
-
if let __unwrappedValue = newValue {
|
|
99
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
100
|
-
} else {
|
|
101
|
-
return .init()
|
|
102
|
-
}
|
|
103
|
-
}()
|
|
104
|
-
}
|
|
73
|
+
return { () -> String? in
|
|
74
|
+
if bridge.has_value_std__optional_std__string_(self.__path) {
|
|
75
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__path)
|
|
76
|
+
return String(__unwrapped)
|
|
77
|
+
} else {
|
|
78
|
+
return nil
|
|
79
|
+
}
|
|
80
|
+
}()
|
|
105
81
|
}
|
|
106
82
|
|
|
83
|
+
@inline(__always)
|
|
107
84
|
var domain: String? {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}()
|
|
118
|
-
}
|
|
119
|
-
@inline(__always)
|
|
120
|
-
set {
|
|
121
|
-
self.__domain = { () -> bridge.std__optional_std__string_ in
|
|
122
|
-
if let __unwrappedValue = newValue {
|
|
123
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
124
|
-
} else {
|
|
125
|
-
return .init()
|
|
126
|
-
}
|
|
127
|
-
}()
|
|
128
|
-
}
|
|
85
|
+
return { () -> String? in
|
|
86
|
+
if bridge.has_value_std__optional_std__string_(self.__domain) {
|
|
87
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__domain)
|
|
88
|
+
return String(__unwrapped)
|
|
89
|
+
} else {
|
|
90
|
+
return nil
|
|
91
|
+
}
|
|
92
|
+
}()
|
|
129
93
|
}
|
|
130
94
|
|
|
95
|
+
@inline(__always)
|
|
131
96
|
var version: String? {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}()
|
|
142
|
-
}
|
|
143
|
-
@inline(__always)
|
|
144
|
-
set {
|
|
145
|
-
self.__version = { () -> bridge.std__optional_std__string_ in
|
|
146
|
-
if let __unwrappedValue = newValue {
|
|
147
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
148
|
-
} else {
|
|
149
|
-
return .init()
|
|
150
|
-
}
|
|
151
|
-
}()
|
|
152
|
-
}
|
|
97
|
+
return { () -> String? in
|
|
98
|
+
if bridge.has_value_std__optional_std__string_(self.__version) {
|
|
99
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__version)
|
|
100
|
+
return String(__unwrapped)
|
|
101
|
+
} else {
|
|
102
|
+
return nil
|
|
103
|
+
}
|
|
104
|
+
}()
|
|
153
105
|
}
|
|
154
106
|
|
|
107
|
+
@inline(__always)
|
|
155
108
|
var expires: String? {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
}()
|
|
166
|
-
}
|
|
167
|
-
@inline(__always)
|
|
168
|
-
set {
|
|
169
|
-
self.__expires = { () -> bridge.std__optional_std__string_ in
|
|
170
|
-
if let __unwrappedValue = newValue {
|
|
171
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
172
|
-
} else {
|
|
173
|
-
return .init()
|
|
174
|
-
}
|
|
175
|
-
}()
|
|
176
|
-
}
|
|
109
|
+
return { () -> String? in
|
|
110
|
+
if bridge.has_value_std__optional_std__string_(self.__expires) {
|
|
111
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__expires)
|
|
112
|
+
return String(__unwrapped)
|
|
113
|
+
} else {
|
|
114
|
+
return nil
|
|
115
|
+
}
|
|
116
|
+
}()
|
|
177
117
|
}
|
|
178
118
|
|
|
119
|
+
@inline(__always)
|
|
179
120
|
var secure: Bool? {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
}()
|
|
190
|
-
}
|
|
191
|
-
@inline(__always)
|
|
192
|
-
set {
|
|
193
|
-
self.__secure = { () -> bridge.std__optional_bool_ in
|
|
194
|
-
if let __unwrappedValue = newValue {
|
|
195
|
-
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
196
|
-
} else {
|
|
197
|
-
return .init()
|
|
198
|
-
}
|
|
199
|
-
}()
|
|
200
|
-
}
|
|
121
|
+
return { () -> Bool? in
|
|
122
|
+
if bridge.has_value_std__optional_bool_(self.__secure) {
|
|
123
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__secure)
|
|
124
|
+
return __unwrapped
|
|
125
|
+
} else {
|
|
126
|
+
return nil
|
|
127
|
+
}
|
|
128
|
+
}()
|
|
201
129
|
}
|
|
202
130
|
|
|
131
|
+
@inline(__always)
|
|
203
132
|
var httpOnly: Bool? {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
}()
|
|
214
|
-
}
|
|
215
|
-
@inline(__always)
|
|
216
|
-
set {
|
|
217
|
-
self.__httpOnly = { () -> bridge.std__optional_bool_ in
|
|
218
|
-
if let __unwrappedValue = newValue {
|
|
219
|
-
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
220
|
-
} else {
|
|
221
|
-
return .init()
|
|
222
|
-
}
|
|
223
|
-
}()
|
|
224
|
-
}
|
|
133
|
+
return { () -> Bool? in
|
|
134
|
+
if bridge.has_value_std__optional_bool_(self.__httpOnly) {
|
|
135
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__httpOnly)
|
|
136
|
+
return __unwrapped
|
|
137
|
+
} else {
|
|
138
|
+
return nil
|
|
139
|
+
}
|
|
140
|
+
}()
|
|
225
141
|
}
|
|
226
142
|
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `() -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void_bool.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void_std__exception_ptr.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void_std__vector_Cookie_.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `(_ value: [Cookie]) -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpec.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
8
|
import NitroModules
|
|
11
9
|
|
|
12
10
|
/// See ``HybridNitroCookiesSpec``
|
|
@@ -43,14 +41,14 @@ open class HybridNitroCookiesSpec_base {
|
|
|
43
41
|
public init() { }
|
|
44
42
|
public func getCxxWrapper() -> HybridNitroCookiesSpec_cxx {
|
|
45
43
|
#if DEBUG
|
|
46
|
-
guard self is HybridNitroCookiesSpec else {
|
|
44
|
+
guard self is any HybridNitroCookiesSpec else {
|
|
47
45
|
fatalError("`self` is not a `HybridNitroCookiesSpec`! Did you accidentally inherit from `HybridNitroCookiesSpec_base` instead of `HybridNitroCookiesSpec`?")
|
|
48
46
|
}
|
|
49
47
|
#endif
|
|
50
48
|
if let cxxWrapper = self.cxxWrapper {
|
|
51
49
|
return cxxWrapper
|
|
52
50
|
} else {
|
|
53
|
-
let cxxWrapper = HybridNitroCookiesSpec_cxx(self as! HybridNitroCookiesSpec)
|
|
51
|
+
let cxxWrapper = HybridNitroCookiesSpec_cxx(self as! any HybridNitroCookiesSpec)
|
|
54
52
|
self.cxxWrapper = cxxWrapper
|
|
55
53
|
return cxxWrapper
|
|
56
54
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
8
|
import NitroModules
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -97,6 +95,14 @@ open class HybridNitroCookiesSpec_cxx {
|
|
|
97
95
|
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
98
96
|
}
|
|
99
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridNitroCookiesSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
100
106
|
/**
|
|
101
107
|
* Call dispose() on the Swift class.
|
|
102
108
|
* This _may_ be called manually from JS.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Cookie.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
|
|
@@ -33,7 +38,7 @@ namespace margelo::nitro::nitrocookies {
|
|
|
33
38
|
/**
|
|
34
39
|
* A struct which can be represented as a JavaScript object (Cookie).
|
|
35
40
|
*/
|
|
36
|
-
struct Cookie {
|
|
41
|
+
struct Cookie final {
|
|
37
42
|
public:
|
|
38
43
|
std::string name SWIFT_PRIVATE;
|
|
39
44
|
std::string value SWIFT_PRIVATE;
|
|
@@ -47,6 +52,9 @@ namespace margelo::nitro::nitrocookies {
|
|
|
47
52
|
public:
|
|
48
53
|
Cookie() = default;
|
|
49
54
|
explicit Cookie(std::string name, std::string value, std::optional<std::string> path, std::optional<std::string> domain, std::optional<std::string> version, std::optional<std::string> expires, std::optional<bool> secure, std::optional<bool> httpOnly): name(name), value(value), path(path), domain(domain), version(version), expires(expires), secure(secure), httpOnly(httpOnly) {}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
friend bool operator==(const Cookie& lhs, const Cookie& rhs) = default;
|
|
50
58
|
};
|
|
51
59
|
|
|
52
60
|
} // namespace margelo::nitro::nitrocookies
|
|
@@ -59,26 +67,26 @@ namespace margelo::nitro {
|
|
|
59
67
|
static inline margelo::nitro::nitrocookies::Cookie fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
60
68
|
jsi::Object obj = arg.asObject(runtime);
|
|
61
69
|
return margelo::nitro::nitrocookies::Cookie(
|
|
62
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "name")),
|
|
63
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "value")),
|
|
64
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "path")),
|
|
65
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "domain")),
|
|
66
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "version")),
|
|
67
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "expires")),
|
|
68
|
-
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "secure")),
|
|
69
|
-
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "httpOnly"))
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
71
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value"))),
|
|
72
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
|
|
73
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "domain"))),
|
|
74
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version"))),
|
|
75
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expires"))),
|
|
76
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "secure"))),
|
|
77
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "httpOnly")))
|
|
70
78
|
);
|
|
71
79
|
}
|
|
72
80
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrocookies::Cookie& arg) {
|
|
73
81
|
jsi::Object obj(runtime);
|
|
74
|
-
obj.setProperty(runtime, "name", JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
75
|
-
obj.setProperty(runtime, "value", JSIConverter<std::string>::toJSI(runtime, arg.value));
|
|
76
|
-
obj.setProperty(runtime, "path", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.path));
|
|
77
|
-
obj.setProperty(runtime, "domain", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.domain));
|
|
78
|
-
obj.setProperty(runtime, "version", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.version));
|
|
79
|
-
obj.setProperty(runtime, "expires", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.expires));
|
|
80
|
-
obj.setProperty(runtime, "secure", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.secure));
|
|
81
|
-
obj.setProperty(runtime, "httpOnly", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.httpOnly));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<std::string>::toJSI(runtime, arg.value));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.path));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "domain"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.domain));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "version"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.version));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "expires"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.expires));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "secure"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.secure));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "httpOnly"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.httpOnly));
|
|
82
90
|
return obj;
|
|
83
91
|
}
|
|
84
92
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -89,14 +97,14 @@ namespace margelo::nitro {
|
|
|
89
97
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
90
98
|
return false;
|
|
91
99
|
}
|
|
92
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "name"))) return false;
|
|
93
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "value"))) return false;
|
|
94
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "path"))) return false;
|
|
95
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "domain"))) return false;
|
|
96
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "version"))) return false;
|
|
97
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "expires"))) return false;
|
|
98
|
-
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "secure"))) return false;
|
|
99
|
-
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "httpOnly"))) return false;
|
|
100
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
101
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
|
|
102
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
|
|
103
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "domain")))) return false;
|
|
104
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version")))) return false;
|
|
105
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expires")))) return false;
|
|
106
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "secure")))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "httpOnly")))) return false;
|
|
100
108
|
return true;
|
|
101
109
|
}
|
|
102
110
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroCookiesSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNitroCookiesSpec.hpp"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-cookies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Fetch, Get Cookies 🍪 at the Speed of Nitro",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -72,22 +72,22 @@
|
|
|
72
72
|
"registry": "https://registry.npmjs.org/"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@react-native/babel-preset": "0.
|
|
76
|
-
"@types/jest": "
|
|
77
|
-
"@types/react": "
|
|
78
|
-
"del-cli": "
|
|
79
|
-
"jest": "
|
|
80
|
-
"nitrogen": "
|
|
81
|
-
"react": "19.
|
|
82
|
-
"react-native": "0.
|
|
83
|
-
"react-native-builder-bob": "
|
|
84
|
-
"react-native-nitro-modules": "
|
|
85
|
-
"typescript": "
|
|
75
|
+
"@react-native/babel-preset": "0.84.0",
|
|
76
|
+
"@types/jest": "30.0.0",
|
|
77
|
+
"@types/react": "19.2.14",
|
|
78
|
+
"del-cli": "6.0.0",
|
|
79
|
+
"jest": "30.2.0",
|
|
80
|
+
"nitrogen": "0.33.9",
|
|
81
|
+
"react": "19.2.3",
|
|
82
|
+
"react-native": "0.84.0",
|
|
83
|
+
"react-native-builder-bob": "0.40.18",
|
|
84
|
+
"react-native-nitro-modules": "0.33.9",
|
|
85
|
+
"typescript": "5.9.3"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*",
|
|
90
|
-
"react-native-nitro-modules": "
|
|
90
|
+
"react-native-nitro-modules": "~0.33.9"
|
|
91
91
|
},
|
|
92
92
|
"prettier": {
|
|
93
93
|
"quoteProps": "consistent",
|
|
@@ -22,8 +22,10 @@ import type { Cookie } from './types';
|
|
|
22
22
|
* - Synchronous methods (xxxSync): Direct return values, no Promise wrapping
|
|
23
23
|
* - Asynchronous methods: Return Promise for operations requiring callbacks/network
|
|
24
24
|
*/
|
|
25
|
-
export interface NitroCookies
|
|
26
|
-
|
|
25
|
+
export interface NitroCookies extends HybridObject<{
|
|
26
|
+
ios: 'swift';
|
|
27
|
+
android: 'kotlin';
|
|
28
|
+
}> {
|
|
27
29
|
// ========================================
|
|
28
30
|
// SYNCHRONOUS METHODS
|
|
29
31
|
// ========================================
|