react-native-iap 14.4.47 → 14.5.1-rc.1
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 +76 -16
- package/ios/HybridRnIap.swift +17 -5
- package/ios/RnIapHelper.swift +8 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +35 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +21 -1
- 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 +71 -4
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +155 -10
- 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_NitroProduct.hpp +13 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -4
- package/nitrogen/generated/android/c++/{JIapkitStore.hpp → JIapStore.hpp} +19 -13
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +70 -3
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +35 -5
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +13 -3
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +11 -3
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +61 -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 +11 -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/NitroDiscountAmountAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +30 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +39 -0
- 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 +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +178 -26
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +24 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +24 -3
- package/nitrogen/generated/ios/swift/{IapkitStore.swift → IapStore.swift} +14 -6
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +70 -0
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +211 -2
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +26 -7
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +43 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +47 -1
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +46 -0
- 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 +44 -3
- 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++/NitroDiscountAmountAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +55 -3
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -5
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +13 -2
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +10 -2
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +79 -0
- 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 +12 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +8 -5
- package/src/specs/RnIap.nitro.ts +79 -4
- package/src/types.ts +163 -11
- package/src/utils/type-bridge.ts +23 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroValidTimeWindowAndroid.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 `NitroValidTimeWindowAndroid`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroValidTimeWindowAndroid = margelo.nitro.iap.NitroValidTimeWindowAndroid
|
|
14
|
+
|
|
15
|
+
public extension NitroValidTimeWindowAndroid {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroValidTimeWindowAndroid`.
|
|
20
|
+
*/
|
|
21
|
+
init(endTimeMillis: String, startTimeMillis: String) {
|
|
22
|
+
self.init(std.string(endTimeMillis), std.string(startTimeMillis))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var endTimeMillis: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__endTimeMillis)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__endTimeMillis = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var startTimeMillis: String {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return String(self.__startTimeMillis)
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__startTimeMillis = std.string(newValue)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -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, isSuspendedAndroid: 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)
|
|
@@ -61,7 +61,13 @@ public extension PurchaseAndroid {
|
|
|
61
61
|
} else {
|
|
62
62
|
return .init()
|
|
63
63
|
}
|
|
64
|
-
}(), isAutoRenewing, { () -> bridge.
|
|
64
|
+
}(), isAutoRenewing, { () -> bridge.std__optional_bool_ in
|
|
65
|
+
if let __unwrappedValue = isSuspendedAndroid {
|
|
66
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
67
|
+
} else {
|
|
68
|
+
return .init()
|
|
69
|
+
}
|
|
70
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
65
71
|
if let __unwrappedValue = obfuscatedAccountIdAndroid {
|
|
66
72
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
67
73
|
} else {
|
|
@@ -91,7 +97,7 @@ public extension PurchaseAndroid {
|
|
|
91
97
|
} else {
|
|
92
98
|
return .init()
|
|
93
99
|
}
|
|
94
|
-
}(), transactionDate, { () -> bridge.std__optional_std__string_ in
|
|
100
|
+
}(), store, transactionDate, { () -> bridge.std__optional_std__string_ in
|
|
95
101
|
if let __unwrappedValue = transactionId {
|
|
96
102
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
97
103
|
} else {
|
|
@@ -272,6 +278,30 @@ public extension PurchaseAndroid {
|
|
|
272
278
|
}
|
|
273
279
|
}
|
|
274
280
|
|
|
281
|
+
var isSuspendedAndroid: Bool? {
|
|
282
|
+
@inline(__always)
|
|
283
|
+
get {
|
|
284
|
+
return { () -> Bool? in
|
|
285
|
+
if bridge.has_value_std__optional_bool_(self.__isSuspendedAndroid) {
|
|
286
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__isSuspendedAndroid)
|
|
287
|
+
return __unwrapped
|
|
288
|
+
} else {
|
|
289
|
+
return nil
|
|
290
|
+
}
|
|
291
|
+
}()
|
|
292
|
+
}
|
|
293
|
+
@inline(__always)
|
|
294
|
+
set {
|
|
295
|
+
self.__isSuspendedAndroid = { () -> bridge.std__optional_bool_ in
|
|
296
|
+
if let __unwrappedValue = newValue {
|
|
297
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
298
|
+
} else {
|
|
299
|
+
return .init()
|
|
300
|
+
}
|
|
301
|
+
}()
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
275
305
|
var obfuscatedAccountIdAndroid: String? {
|
|
276
306
|
@inline(__always)
|
|
277
307
|
get {
|
|
@@ -436,6 +466,17 @@ public extension PurchaseAndroid {
|
|
|
436
466
|
}
|
|
437
467
|
}
|
|
438
468
|
|
|
469
|
+
var store: IapStore {
|
|
470
|
+
@inline(__always)
|
|
471
|
+
get {
|
|
472
|
+
return self.__store
|
|
473
|
+
}
|
|
474
|
+
@inline(__always)
|
|
475
|
+
set {
|
|
476
|
+
self.__store = newValue
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
439
480
|
var transactionDate: Double {
|
|
440
481
|
@inline(__always)
|
|
441
482
|
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;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroDiscountAmountAndroid.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (NitroDiscountAmountAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct NitroDiscountAmountAndroid {
|
|
36
|
+
public:
|
|
37
|
+
std::string discountAmountMicros SWIFT_PRIVATE;
|
|
38
|
+
std::string formattedDiscountAmount SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroDiscountAmountAndroid() = default;
|
|
42
|
+
explicit NitroDiscountAmountAndroid(std::string discountAmountMicros, std::string formattedDiscountAmount): discountAmountMicros(discountAmountMicros), formattedDiscountAmount(formattedDiscountAmount) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroDiscountAmountAndroid <> JS NitroDiscountAmountAndroid (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroDiscountAmountAndroid> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroDiscountAmountAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroDiscountAmountAndroid(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "discountAmountMicros")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "formattedDiscountAmount"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroDiscountAmountAndroid& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "discountAmountMicros", JSIConverter<std::string>::toJSI(runtime, arg.discountAmountMicros));
|
|
62
|
+
obj.setProperty(runtime, "formattedDiscountAmount", JSIConverter<std::string>::toJSI(runtime, arg.formattedDiscountAmount));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "discountAmountMicros"))) return false;
|
|
74
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "formattedDiscountAmount"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroDiscountDisplayInfoAndroid.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `NitroDiscountAmountAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { struct NitroDiscountAmountAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "NitroDiscountAmountAndroid.hpp"
|
|
30
|
+
#include <optional>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::iap {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (NitroDiscountDisplayInfoAndroid).
|
|
36
|
+
*/
|
|
37
|
+
struct NitroDiscountDisplayInfoAndroid {
|
|
38
|
+
public:
|
|
39
|
+
std::optional<NitroDiscountAmountAndroid> discountAmount SWIFT_PRIVATE;
|
|
40
|
+
std::optional<double> percentageDiscount SWIFT_PRIVATE;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
NitroDiscountDisplayInfoAndroid() = default;
|
|
44
|
+
explicit NitroDiscountDisplayInfoAndroid(std::optional<NitroDiscountAmountAndroid> discountAmount, std::optional<double> percentageDiscount): discountAmount(discountAmount), percentageDiscount(percentageDiscount) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace margelo::nitro::iap
|
|
48
|
+
|
|
49
|
+
namespace margelo::nitro {
|
|
50
|
+
|
|
51
|
+
// C++ NitroDiscountDisplayInfoAndroid <> JS NitroDiscountDisplayInfoAndroid (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<margelo::nitro::iap::NitroDiscountDisplayInfoAndroid> final {
|
|
54
|
+
static inline margelo::nitro::iap::NitroDiscountDisplayInfoAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return margelo::nitro::iap::NitroDiscountDisplayInfoAndroid(
|
|
57
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "discountAmount")),
|
|
58
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "percentageDiscount"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroDiscountDisplayInfoAndroid& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "discountAmount", JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::toJSI(runtime, arg.discountAmount));
|
|
64
|
+
obj.setProperty(runtime, "percentageDiscount", JSIConverter<std::optional<double>>::toJSI(runtime, arg.percentageDiscount));
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isObject()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
jsi::Object obj = value.getObject(runtime);
|
|
72
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::canConvert(runtime, obj.getProperty(runtime, "discountAmount"))) return false;
|
|
76
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "percentageDiscount"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLimitedQuantityInfoAndroid.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (NitroLimitedQuantityInfoAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct NitroLimitedQuantityInfoAndroid {
|
|
36
|
+
public:
|
|
37
|
+
double maximumQuantity SWIFT_PRIVATE;
|
|
38
|
+
double remainingQuantity SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroLimitedQuantityInfoAndroid() = default;
|
|
42
|
+
explicit NitroLimitedQuantityInfoAndroid(double maximumQuantity, double remainingQuantity): maximumQuantity(maximumQuantity), remainingQuantity(remainingQuantity) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroLimitedQuantityInfoAndroid <> JS NitroLimitedQuantityInfoAndroid (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroLimitedQuantityInfoAndroid> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroLimitedQuantityInfoAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroLimitedQuantityInfoAndroid(
|
|
55
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "maximumQuantity")),
|
|
56
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "remainingQuantity"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroLimitedQuantityInfoAndroid& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "maximumQuantity", JSIConverter<double>::toJSI(runtime, arg.maximumQuantity));
|
|
62
|
+
obj.setProperty(runtime, "remainingQuantity", JSIConverter<double>::toJSI(runtime, arg.remainingQuantity));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "maximumQuantity"))) return false;
|
|
74
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "remainingQuantity"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|