react-native-iap 14.4.47 → 14.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/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +29 -9
- package/ios/HybridRnIap.swift +17 -5
- package/ios/RnIapHelper.swift +8 -0
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +19 -0
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +17 -3
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +40 -8
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +8 -4
- package/nitrogen/generated/android/c++/{JIapkitStore.hpp → JIapStore.hpp} +19 -13
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +7 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +11 -3
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +6 -6
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderError.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +24 -16
- package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +7 -1
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +7 -1
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{IapkitStore.kt → IapStore.kt} +7 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderError.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderResult.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +41 -8
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -3
- package/nitrogen/generated/ios/swift/{IapkitStore.swift → IapStore.swift} +14 -6
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +13 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +47 -1
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +2 -2
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderError.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderResult.swift +55 -13
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +13 -2
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +13 -2
- package/nitrogen/generated/shared/c++/{IapkitStore.hpp → IapStore.hpp} +23 -15
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +8 -1
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +10 -2
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +8 -8
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderError.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderResult.hpp +13 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +8 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +8 -5
- package/src/specs/RnIap.nitro.ts +19 -3
- package/src/types.ts +42 -9
- package/src/utils/type-bridge.ts +22 -0
|
@@ -18,14 +18,14 @@ public extension NitroPurchase {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroPurchase`.
|
|
20
20
|
*/
|
|
21
|
-
init(id: String, productId: String, transactionDate: Double, purchaseToken: String?, platform: IapPlatform, quantity: Double, purchaseState: PurchaseState, isAutoRenewing: Bool, quantityIOS: Double?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, environmentIOS: String?, expirationDateIOS: Double?, isUpgradedIOS: Bool?, offerIOS: String?, ownershipTypeIOS: String?, reasonIOS: String?, reasonStringRepresentationIOS: String?, revocationDateIOS: Double?, revocationReasonIOS: String?, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?, renewalInfoIOS: NitroRenewalInfoIOS?, purchaseTokenAndroid: String?, dataAndroid: String?, signatureAndroid: String?, autoRenewingAndroid: Bool?, purchaseStateAndroid: Double?, isAcknowledgedAndroid: Bool?, packageNameAndroid: String?, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, developerPayloadAndroid: String?) {
|
|
21
|
+
init(id: String, productId: String, transactionDate: Double, purchaseToken: String?, platform: IapPlatform, store: IapStore, quantity: Double, purchaseState: PurchaseState, isAutoRenewing: Bool, quantityIOS: Double?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, environmentIOS: String?, expirationDateIOS: Double?, isUpgradedIOS: Bool?, offerIOS: String?, ownershipTypeIOS: String?, reasonIOS: String?, reasonStringRepresentationIOS: String?, revocationDateIOS: Double?, revocationReasonIOS: String?, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?, renewalInfoIOS: NitroRenewalInfoIOS?, purchaseTokenAndroid: String?, dataAndroid: String?, signatureAndroid: String?, autoRenewingAndroid: Bool?, purchaseStateAndroid: Double?, isAcknowledgedAndroid: Bool?, packageNameAndroid: String?, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, developerPayloadAndroid: String?) {
|
|
22
22
|
self.init(std.string(id), std.string(productId), transactionDate, { () -> bridge.std__optional_std__string_ in
|
|
23
23
|
if let __unwrappedValue = purchaseToken {
|
|
24
24
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
25
|
} else {
|
|
26
26
|
return .init()
|
|
27
27
|
}
|
|
28
|
-
}(), platform, quantity, purchaseState, isAutoRenewing, { () -> bridge.std__optional_double_ in
|
|
28
|
+
}(), platform, store, quantity, purchaseState, isAutoRenewing, { () -> bridge.std__optional_double_ in
|
|
29
29
|
if let __unwrappedValue = quantityIOS {
|
|
30
30
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
31
31
|
} else {
|
|
@@ -288,6 +288,17 @@ public extension NitroPurchase {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
var store: IapStore {
|
|
292
|
+
@inline(__always)
|
|
293
|
+
get {
|
|
294
|
+
return self.__store
|
|
295
|
+
}
|
|
296
|
+
@inline(__always)
|
|
297
|
+
set {
|
|
298
|
+
self.__store = newValue
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
291
302
|
var quantity: Double {
|
|
292
303
|
@inline(__always)
|
|
293
304
|
get {
|
|
@@ -18,7 +18,7 @@ public extension NitroPurchaseRequest {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroPurchaseRequest`.
|
|
20
20
|
*/
|
|
21
|
-
init(ios: NitroRequestPurchaseIos?, android: NitroRequestPurchaseAndroid?) {
|
|
21
|
+
init(ios: NitroRequestPurchaseIos?, android: NitroRequestPurchaseAndroid?, apple: NitroRequestPurchaseIos?, google: NitroRequestPurchaseAndroid?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_NitroRequestPurchaseIos_ in
|
|
23
23
|
if let __unwrappedValue = ios {
|
|
24
24
|
return bridge.create_std__optional_NitroRequestPurchaseIos_(__unwrappedValue)
|
|
@@ -31,6 +31,18 @@ public extension NitroPurchaseRequest {
|
|
|
31
31
|
} else {
|
|
32
32
|
return .init()
|
|
33
33
|
}
|
|
34
|
+
}(), { () -> bridge.std__optional_NitroRequestPurchaseIos_ in
|
|
35
|
+
if let __unwrappedValue = apple {
|
|
36
|
+
return bridge.create_std__optional_NitroRequestPurchaseIos_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_NitroRequestPurchaseAndroid_ in
|
|
41
|
+
if let __unwrappedValue = google {
|
|
42
|
+
return bridge.create_std__optional_NitroRequestPurchaseAndroid_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
34
46
|
}())
|
|
35
47
|
}
|
|
36
48
|
|
|
@@ -67,4 +79,38 @@ public extension NitroPurchaseRequest {
|
|
|
67
79
|
}()
|
|
68
80
|
}
|
|
69
81
|
}
|
|
82
|
+
|
|
83
|
+
var apple: NitroRequestPurchaseIos? {
|
|
84
|
+
@inline(__always)
|
|
85
|
+
get {
|
|
86
|
+
return self.__apple.value
|
|
87
|
+
}
|
|
88
|
+
@inline(__always)
|
|
89
|
+
set {
|
|
90
|
+
self.__apple = { () -> bridge.std__optional_NitroRequestPurchaseIos_ in
|
|
91
|
+
if let __unwrappedValue = newValue {
|
|
92
|
+
return bridge.create_std__optional_NitroRequestPurchaseIos_(__unwrappedValue)
|
|
93
|
+
} else {
|
|
94
|
+
return .init()
|
|
95
|
+
}
|
|
96
|
+
}()
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var google: NitroRequestPurchaseAndroid? {
|
|
101
|
+
@inline(__always)
|
|
102
|
+
get {
|
|
103
|
+
return self.__google.value
|
|
104
|
+
}
|
|
105
|
+
@inline(__always)
|
|
106
|
+
set {
|
|
107
|
+
self.__google = { () -> bridge.std__optional_NitroRequestPurchaseAndroid_ in
|
|
108
|
+
if let __unwrappedValue = newValue {
|
|
109
|
+
return bridge.create_std__optional_NitroRequestPurchaseAndroid_(__unwrappedValue)
|
|
110
|
+
} else {
|
|
111
|
+
return .init()
|
|
112
|
+
}
|
|
113
|
+
}()
|
|
114
|
+
}
|
|
115
|
+
}
|
|
70
116
|
}
|
|
@@ -18,7 +18,7 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithIapkitResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(isValid: Bool, state: IapkitPurchaseState, store:
|
|
21
|
+
init(isValid: Bool, state: IapkitPurchaseState, store: IapStore) {
|
|
22
22
|
self.init(isValid, state, store)
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -44,7 +44,7 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
var store:
|
|
47
|
+
var store: IapStore {
|
|
48
48
|
@inline(__always)
|
|
49
49
|
get {
|
|
50
50
|
return self.__store
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroVerifyPurchaseWithProviderError.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroVerifyPurchaseWithProviderError`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroVerifyPurchaseWithProviderError = margelo.nitro.iap.NitroVerifyPurchaseWithProviderError
|
|
14
|
+
|
|
15
|
+
public extension NitroVerifyPurchaseWithProviderError {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroVerifyPurchaseWithProviderError`.
|
|
20
|
+
*/
|
|
21
|
+
init(code: String?, message: String) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = code {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), std.string(message))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var code: String? {
|
|
32
|
+
@inline(__always)
|
|
33
|
+
get {
|
|
34
|
+
return { () -> String? in
|
|
35
|
+
if bridge.has_value_std__optional_std__string_(self.__code) {
|
|
36
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__code)
|
|
37
|
+
return String(__unwrapped)
|
|
38
|
+
} else {
|
|
39
|
+
return nil
|
|
40
|
+
}
|
|
41
|
+
}()
|
|
42
|
+
}
|
|
43
|
+
@inline(__always)
|
|
44
|
+
set {
|
|
45
|
+
self.__code = { () -> bridge.std__optional_std__string_ in
|
|
46
|
+
if let __unwrappedValue = newValue {
|
|
47
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
48
|
+
} else {
|
|
49
|
+
return .init()
|
|
50
|
+
}
|
|
51
|
+
}()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var message: String {
|
|
56
|
+
@inline(__always)
|
|
57
|
+
get {
|
|
58
|
+
return String(self.__message)
|
|
59
|
+
}
|
|
60
|
+
@inline(__always)
|
|
61
|
+
set {
|
|
62
|
+
self.__message = std.string(newValue)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -18,29 +18,71 @@ public extension NitroVerifyPurchaseWithProviderResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithProviderResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(iapkit: [
|
|
22
|
-
self.init({ () -> bridge.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
init(iapkit: NitroVerifyPurchaseWithIapkitResult?, errors: [NitroVerifyPurchaseWithProviderError]?, provider: PurchaseVerificationProvider) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_NitroVerifyPurchaseWithIapkitResult_ in
|
|
23
|
+
if let __unwrappedValue = iapkit {
|
|
24
|
+
return bridge.create_std__optional_NitroVerifyPurchaseWithIapkitResult_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__vector_NitroVerifyPurchaseWithProviderError__ in
|
|
29
|
+
if let __unwrappedValue = errors {
|
|
30
|
+
return bridge.create_std__optional_std__vector_NitroVerifyPurchaseWithProviderError__({ () -> bridge.std__vector_NitroVerifyPurchaseWithProviderError_ in
|
|
31
|
+
var __vector = bridge.create_std__vector_NitroVerifyPurchaseWithProviderError_(__unwrappedValue.count)
|
|
32
|
+
for __item in __unwrappedValue {
|
|
33
|
+
__vector.push_back(__item)
|
|
34
|
+
}
|
|
35
|
+
return __vector
|
|
36
|
+
}())
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
26
39
|
}
|
|
27
|
-
return __vector
|
|
28
40
|
}(), provider)
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
var iapkit:
|
|
43
|
+
var iapkit: NitroVerifyPurchaseWithIapkitResult? {
|
|
32
44
|
@inline(__always)
|
|
33
45
|
get {
|
|
34
|
-
return self.__iapkit.
|
|
46
|
+
return self.__iapkit.value
|
|
47
|
+
}
|
|
48
|
+
@inline(__always)
|
|
49
|
+
set {
|
|
50
|
+
self.__iapkit = { () -> bridge.std__optional_NitroVerifyPurchaseWithIapkitResult_ in
|
|
51
|
+
if let __unwrappedValue = newValue {
|
|
52
|
+
return bridge.create_std__optional_NitroVerifyPurchaseWithIapkitResult_(__unwrappedValue)
|
|
53
|
+
} else {
|
|
54
|
+
return .init()
|
|
55
|
+
}
|
|
56
|
+
}()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var errors: [NitroVerifyPurchaseWithProviderError]? {
|
|
61
|
+
@inline(__always)
|
|
62
|
+
get {
|
|
63
|
+
return { () -> [NitroVerifyPurchaseWithProviderError]? in
|
|
64
|
+
if bridge.has_value_std__optional_std__vector_NitroVerifyPurchaseWithProviderError__(self.__errors) {
|
|
65
|
+
let __unwrapped = bridge.get_std__optional_std__vector_NitroVerifyPurchaseWithProviderError__(self.__errors)
|
|
66
|
+
return __unwrapped.map({ __item in __item })
|
|
67
|
+
} else {
|
|
68
|
+
return nil
|
|
69
|
+
}
|
|
70
|
+
}()
|
|
35
71
|
}
|
|
36
72
|
@inline(__always)
|
|
37
73
|
set {
|
|
38
|
-
self.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
74
|
+
self.__errors = { () -> bridge.std__optional_std__vector_NitroVerifyPurchaseWithProviderError__ in
|
|
75
|
+
if let __unwrappedValue = newValue {
|
|
76
|
+
return bridge.create_std__optional_std__vector_NitroVerifyPurchaseWithProviderError__({ () -> bridge.std__vector_NitroVerifyPurchaseWithProviderError_ in
|
|
77
|
+
var __vector = bridge.create_std__vector_NitroVerifyPurchaseWithProviderError_(__unwrappedValue.count)
|
|
78
|
+
for __item in __unwrappedValue {
|
|
79
|
+
__vector.push_back(__item)
|
|
80
|
+
}
|
|
81
|
+
return __vector
|
|
82
|
+
}())
|
|
83
|
+
} else {
|
|
84
|
+
return .init()
|
|
42
85
|
}
|
|
43
|
-
return __vector
|
|
44
86
|
}()
|
|
45
87
|
}
|
|
46
88
|
}
|
|
@@ -18,7 +18,7 @@ public extension PurchaseAndroid {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `PurchaseAndroid`.
|
|
20
20
|
*/
|
|
21
|
-
init(autoRenewingAndroid: Bool?, currentPlanId: String?, dataAndroid: String?, developerPayloadAndroid: String?, id: String, ids: [String]?, isAcknowledgedAndroid: Bool?, isAutoRenewing: Bool, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, packageNameAndroid: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, signatureAndroid: String?, transactionDate: Double, transactionId: String?) {
|
|
21
|
+
init(autoRenewingAndroid: Bool?, currentPlanId: String?, dataAndroid: String?, developerPayloadAndroid: String?, id: String, ids: [String]?, isAcknowledgedAndroid: Bool?, isAutoRenewing: Bool, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, packageNameAndroid: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, signatureAndroid: String?, store: IapStore, transactionDate: Double, transactionId: String?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_bool_ in
|
|
23
23
|
if let __unwrappedValue = autoRenewingAndroid {
|
|
24
24
|
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
@@ -91,7 +91,7 @@ public extension PurchaseAndroid {
|
|
|
91
91
|
} else {
|
|
92
92
|
return .init()
|
|
93
93
|
}
|
|
94
|
-
}(), transactionDate, { () -> bridge.std__optional_std__string_ in
|
|
94
|
+
}(), store, transactionDate, { () -> bridge.std__optional_std__string_ in
|
|
95
95
|
if let __unwrappedValue = transactionId {
|
|
96
96
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
97
97
|
} else {
|
|
@@ -436,6 +436,17 @@ public extension PurchaseAndroid {
|
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
var store: IapStore {
|
|
440
|
+
@inline(__always)
|
|
441
|
+
get {
|
|
442
|
+
return self.__store
|
|
443
|
+
}
|
|
444
|
+
@inline(__always)
|
|
445
|
+
set {
|
|
446
|
+
self.__store = newValue
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
439
450
|
var transactionDate: Double {
|
|
440
451
|
@inline(__always)
|
|
441
452
|
get {
|
|
@@ -18,7 +18,7 @@ public extension PurchaseIOS {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `PurchaseIOS`.
|
|
20
20
|
*/
|
|
21
|
-
init(appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, currentPlanId: String?, environmentIOS: String?, expirationDateIOS: Double?, id: String, ids: [String]?, isAutoRenewing: Bool, isUpgradedIOS: Bool?, offerIOS: PurchaseOfferIOS?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, ownershipTypeIOS: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, quantityIOS: Double?, reasonIOS: String?, reasonStringRepresentationIOS: String?, renewalInfoIOS: RenewalInfoIOS?, revocationDateIOS: Double?, revocationReasonIOS: String?, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionDate: Double, transactionId: String, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?) {
|
|
21
|
+
init(appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, currentPlanId: String?, environmentIOS: String?, expirationDateIOS: Double?, id: String, ids: [String]?, isAutoRenewing: Bool, isUpgradedIOS: Bool?, offerIOS: PurchaseOfferIOS?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, ownershipTypeIOS: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, quantityIOS: Double?, reasonIOS: String?, reasonStringRepresentationIOS: String?, renewalInfoIOS: RenewalInfoIOS?, revocationDateIOS: Double?, revocationReasonIOS: String?, store: IapStore, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionDate: Double, transactionId: String, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
23
|
if let __unwrappedValue = appAccountToken {
|
|
24
24
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -151,7 +151,7 @@ public extension PurchaseIOS {
|
|
|
151
151
|
} else {
|
|
152
152
|
return .init()
|
|
153
153
|
}
|
|
154
|
-
}(), { () -> bridge.std__optional_std__string_ in
|
|
154
|
+
}(), store, { () -> bridge.std__optional_std__string_ in
|
|
155
155
|
if let __unwrappedValue = storefrontCountryCodeIOS {
|
|
156
156
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
157
157
|
} else {
|
|
@@ -712,6 +712,17 @@ public extension PurchaseIOS {
|
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
|
|
715
|
+
var store: IapStore {
|
|
716
|
+
@inline(__always)
|
|
717
|
+
get {
|
|
718
|
+
return self.__store
|
|
719
|
+
}
|
|
720
|
+
@inline(__always)
|
|
721
|
+
set {
|
|
722
|
+
self.__store = newValue
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
715
726
|
var storefrontCountryCodeIOS: String? {
|
|
716
727
|
@inline(__always)
|
|
717
728
|
get {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// IapStore.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -26,35 +26,41 @@
|
|
|
26
26
|
namespace margelo::nitro::iap {
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* An enum which can be represented as a JavaScript union (
|
|
29
|
+
* An enum which can be represented as a JavaScript union (IapStore).
|
|
30
30
|
*/
|
|
31
|
-
enum class
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
enum class IapStore {
|
|
32
|
+
UNKNOWN SWIFT_NAME(unknown) = 0,
|
|
33
|
+
APPLE SWIFT_NAME(apple) = 1,
|
|
34
|
+
GOOGLE SWIFT_NAME(google) = 2,
|
|
35
|
+
HORIZON SWIFT_NAME(horizon) = 3,
|
|
34
36
|
} CLOSED_ENUM;
|
|
35
37
|
|
|
36
38
|
} // namespace margelo::nitro::iap
|
|
37
39
|
|
|
38
40
|
namespace margelo::nitro {
|
|
39
41
|
|
|
40
|
-
// C++
|
|
42
|
+
// C++ IapStore <> JS IapStore (union)
|
|
41
43
|
template <>
|
|
42
|
-
struct JSIConverter<margelo::nitro::iap::
|
|
43
|
-
static inline margelo::nitro::iap::
|
|
44
|
+
struct JSIConverter<margelo::nitro::iap::IapStore> final {
|
|
45
|
+
static inline margelo::nitro::iap::IapStore fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
46
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
47
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
-
case hashString("
|
|
47
|
-
case hashString("
|
|
48
|
+
case hashString("unknown"): return margelo::nitro::iap::IapStore::UNKNOWN;
|
|
49
|
+
case hashString("apple"): return margelo::nitro::iap::IapStore::APPLE;
|
|
50
|
+
case hashString("google"): return margelo::nitro::iap::IapStore::GOOGLE;
|
|
51
|
+
case hashString("horizon"): return margelo::nitro::iap::IapStore::HORIZON;
|
|
48
52
|
default: [[unlikely]]
|
|
49
|
-
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IapStore - invalid value!");
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::IapStore arg) {
|
|
53
57
|
switch (arg) {
|
|
54
|
-
case margelo::nitro::iap::
|
|
55
|
-
case margelo::nitro::iap::
|
|
58
|
+
case margelo::nitro::iap::IapStore::UNKNOWN: return JSIConverter<std::string>::toJSI(runtime, "unknown");
|
|
59
|
+
case margelo::nitro::iap::IapStore::APPLE: return JSIConverter<std::string>::toJSI(runtime, "apple");
|
|
60
|
+
case margelo::nitro::iap::IapStore::GOOGLE: return JSIConverter<std::string>::toJSI(runtime, "google");
|
|
61
|
+
case margelo::nitro::iap::IapStore::HORIZON: return JSIConverter<std::string>::toJSI(runtime, "horizon");
|
|
56
62
|
default: [[unlikely]]
|
|
57
|
-
throw std::invalid_argument("Cannot convert
|
|
63
|
+
throw std::invalid_argument("Cannot convert IapStore to JS - invalid value: "
|
|
58
64
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
65
|
}
|
|
60
66
|
}
|
|
@@ -64,8 +70,10 @@ namespace margelo::nitro {
|
|
|
64
70
|
}
|
|
65
71
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
72
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("unknown"):
|
|
67
74
|
case hashString("apple"):
|
|
68
75
|
case hashString("google"):
|
|
76
|
+
case hashString("horizon"):
|
|
69
77
|
return true;
|
|
70
78
|
default:
|
|
71
79
|
return false;
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
28
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
28
30
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
29
31
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
30
32
|
// Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
|
|
@@ -33,6 +35,7 @@ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
|
|
|
33
35
|
#include <string>
|
|
34
36
|
#include <optional>
|
|
35
37
|
#include "IapPlatform.hpp"
|
|
38
|
+
#include "IapStore.hpp"
|
|
36
39
|
#include "PurchaseState.hpp"
|
|
37
40
|
#include "NitroRenewalInfoIOS.hpp"
|
|
38
41
|
|
|
@@ -48,6 +51,7 @@ namespace margelo::nitro::iap {
|
|
|
48
51
|
double transactionDate SWIFT_PRIVATE;
|
|
49
52
|
std::optional<std::string> purchaseToken SWIFT_PRIVATE;
|
|
50
53
|
IapPlatform platform SWIFT_PRIVATE;
|
|
54
|
+
IapStore store SWIFT_PRIVATE;
|
|
51
55
|
double quantity SWIFT_PRIVATE;
|
|
52
56
|
PurchaseState purchaseState SWIFT_PRIVATE;
|
|
53
57
|
bool isAutoRenewing SWIFT_PRIVATE;
|
|
@@ -86,7 +90,7 @@ namespace margelo::nitro::iap {
|
|
|
86
90
|
|
|
87
91
|
public:
|
|
88
92
|
NitroPurchase() = default;
|
|
89
|
-
explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::optional<bool> isUpgradedIOS, std::optional<std::string> offerIOS, std::optional<std::string> ownershipTypeIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS, std::optional<NitroRenewalInfoIOS> renewalInfoIOS, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> developerPayloadAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), ownershipTypeIOS(ownershipTypeIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS), renewalInfoIOS(renewalInfoIOS), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), developerPayloadAndroid(developerPayloadAndroid) {}
|
|
93
|
+
explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, IapStore store, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::optional<bool> isUpgradedIOS, std::optional<std::string> offerIOS, std::optional<std::string> ownershipTypeIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS, std::optional<NitroRenewalInfoIOS> renewalInfoIOS, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> developerPayloadAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), store(store), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), ownershipTypeIOS(ownershipTypeIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS), renewalInfoIOS(renewalInfoIOS), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), developerPayloadAndroid(developerPayloadAndroid) {}
|
|
90
94
|
};
|
|
91
95
|
|
|
92
96
|
} // namespace margelo::nitro::iap
|
|
@@ -104,6 +108,7 @@ namespace margelo::nitro {
|
|
|
104
108
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "transactionDate")),
|
|
105
109
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseToken")),
|
|
106
110
|
JSIConverter<margelo::nitro::iap::IapPlatform>::fromJSI(runtime, obj.getProperty(runtime, "platform")),
|
|
111
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store")),
|
|
107
112
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
108
113
|
JSIConverter<margelo::nitro::iap::PurchaseState>::fromJSI(runtime, obj.getProperty(runtime, "purchaseState")),
|
|
109
114
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isAutoRenewing")),
|
|
@@ -148,6 +153,7 @@ namespace margelo::nitro {
|
|
|
148
153
|
obj.setProperty(runtime, "transactionDate", JSIConverter<double>::toJSI(runtime, arg.transactionDate));
|
|
149
154
|
obj.setProperty(runtime, "purchaseToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseToken));
|
|
150
155
|
obj.setProperty(runtime, "platform", JSIConverter<margelo::nitro::iap::IapPlatform>::toJSI(runtime, arg.platform));
|
|
156
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
151
157
|
obj.setProperty(runtime, "quantity", JSIConverter<double>::toJSI(runtime, arg.quantity));
|
|
152
158
|
obj.setProperty(runtime, "purchaseState", JSIConverter<margelo::nitro::iap::PurchaseState>::toJSI(runtime, arg.purchaseState));
|
|
153
159
|
obj.setProperty(runtime, "isAutoRenewing", JSIConverter<bool>::toJSI(runtime, arg.isAutoRenewing));
|
|
@@ -198,6 +204,7 @@ namespace margelo::nitro {
|
|
|
198
204
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "transactionDate"))) return false;
|
|
199
205
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseToken"))) return false;
|
|
200
206
|
if (!JSIConverter<margelo::nitro::iap::IapPlatform>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
|
|
207
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
201
208
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
202
209
|
if (!JSIConverter<margelo::nitro::iap::PurchaseState>::canConvert(runtime, obj.getProperty(runtime, "purchaseState"))) return false;
|
|
203
210
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isAutoRenewing"))) return false;
|
|
@@ -41,10 +41,12 @@ namespace margelo::nitro::iap {
|
|
|
41
41
|
public:
|
|
42
42
|
std::optional<NitroRequestPurchaseIos> ios SWIFT_PRIVATE;
|
|
43
43
|
std::optional<NitroRequestPurchaseAndroid> android SWIFT_PRIVATE;
|
|
44
|
+
std::optional<NitroRequestPurchaseIos> apple SWIFT_PRIVATE;
|
|
45
|
+
std::optional<NitroRequestPurchaseAndroid> google SWIFT_PRIVATE;
|
|
44
46
|
|
|
45
47
|
public:
|
|
46
48
|
NitroPurchaseRequest() = default;
|
|
47
|
-
explicit NitroPurchaseRequest(std::optional<NitroRequestPurchaseIos> ios, std::optional<NitroRequestPurchaseAndroid> android): ios(ios), android(android) {}
|
|
49
|
+
explicit NitroPurchaseRequest(std::optional<NitroRequestPurchaseIos> ios, std::optional<NitroRequestPurchaseAndroid> android, std::optional<NitroRequestPurchaseIos> apple, std::optional<NitroRequestPurchaseAndroid> google): ios(ios), android(android), apple(apple), google(google) {}
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
} // namespace margelo::nitro::iap
|
|
@@ -58,13 +60,17 @@ namespace margelo::nitro {
|
|
|
58
60
|
jsi::Object obj = arg.asObject(runtime);
|
|
59
61
|
return margelo::nitro::iap::NitroPurchaseRequest(
|
|
60
62
|
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::fromJSI(runtime, obj.getProperty(runtime, "ios")),
|
|
61
|
-
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "android"))
|
|
63
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "android")),
|
|
64
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::fromJSI(runtime, obj.getProperty(runtime, "apple")),
|
|
65
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "google"))
|
|
62
66
|
);
|
|
63
67
|
}
|
|
64
68
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchaseRequest& arg) {
|
|
65
69
|
jsi::Object obj(runtime);
|
|
66
70
|
obj.setProperty(runtime, "ios", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::toJSI(runtime, arg.ios));
|
|
67
71
|
obj.setProperty(runtime, "android", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::toJSI(runtime, arg.android));
|
|
72
|
+
obj.setProperty(runtime, "apple", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::toJSI(runtime, arg.apple));
|
|
73
|
+
obj.setProperty(runtime, "google", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::toJSI(runtime, arg.google));
|
|
68
74
|
return obj;
|
|
69
75
|
}
|
|
70
76
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -77,6 +83,8 @@ namespace margelo::nitro {
|
|
|
77
83
|
}
|
|
78
84
|
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::canConvert(runtime, obj.getProperty(runtime, "ios"))) return false;
|
|
79
85
|
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::canConvert(runtime, obj.getProperty(runtime, "android"))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::canConvert(runtime, obj.getProperty(runtime, "apple"))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::canConvert(runtime, obj.getProperty(runtime, "google"))) return false;
|
|
80
88
|
return true;
|
|
81
89
|
}
|
|
82
90
|
};
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
28
|
-
// Forward declaration of `
|
|
29
|
-
namespace margelo::nitro::iap { enum class
|
|
28
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
30
30
|
|
|
31
31
|
#include "IapkitPurchaseState.hpp"
|
|
32
|
-
#include "
|
|
32
|
+
#include "IapStore.hpp"
|
|
33
33
|
|
|
34
34
|
namespace margelo::nitro::iap {
|
|
35
35
|
|
|
@@ -40,11 +40,11 @@ namespace margelo::nitro::iap {
|
|
|
40
40
|
public:
|
|
41
41
|
bool isValid SWIFT_PRIVATE;
|
|
42
42
|
IapkitPurchaseState state SWIFT_PRIVATE;
|
|
43
|
-
|
|
43
|
+
IapStore store SWIFT_PRIVATE;
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
46
|
NitroVerifyPurchaseWithIapkitResult() = default;
|
|
47
|
-
explicit NitroVerifyPurchaseWithIapkitResult(bool isValid, IapkitPurchaseState state,
|
|
47
|
+
explicit NitroVerifyPurchaseWithIapkitResult(bool isValid, IapkitPurchaseState state, IapStore store): isValid(isValid), state(state), store(store) {}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
} // namespace margelo::nitro::iap
|
|
@@ -59,14 +59,14 @@ namespace margelo::nitro {
|
|
|
59
59
|
return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult(
|
|
60
60
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isValid")),
|
|
61
61
|
JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::fromJSI(runtime, obj.getProperty(runtime, "state")),
|
|
62
|
-
JSIConverter<margelo::nitro::iap::
|
|
62
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store"))
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult& arg) {
|
|
66
66
|
jsi::Object obj(runtime);
|
|
67
67
|
obj.setProperty(runtime, "isValid", JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
68
68
|
obj.setProperty(runtime, "state", JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::toJSI(runtime, arg.state));
|
|
69
|
-
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::
|
|
69
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
70
70
|
return obj;
|
|
71
71
|
}
|
|
72
72
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -79,7 +79,7 @@ namespace margelo::nitro {
|
|
|
79
79
|
}
|
|
80
80
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isValid"))) return false;
|
|
81
81
|
if (!JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
|
|
82
|
-
if (!JSIConverter<margelo::nitro::iap::
|
|
82
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
85
|
};
|