react-native-iap 14.4.11 → 14.4.12
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 +159 -10
- package/ios/HybridRnIap.swift +115 -2
- package/lib/module/hooks/useIAP.js +24 -3
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +275 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +18 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts +27 -0
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +6 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +133 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +72 -2
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +116 -13
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +58 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseNoticeAction.hpp +59 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +60 -0
- package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +132 -3
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +4 -0
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +4 -0
- package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +43 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +32 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +156 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +81 -3
- package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseLinkResultIOS.swift +65 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeAction.swift +40 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +65 -0
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseLinkResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseNoticeResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_UserChoiceBillingDetails.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +9 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +168 -2
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +47 -0
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +31 -1
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
- package/nitrogen/generated/ios/swift/UserChoiceBillingDetails.swift +58 -0
- package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +72 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeAction.hpp +76 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +8 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +22 -2
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +69 -0
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +5 -1
- package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +72 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/withIAP.d.ts +27 -0
- package/plugin/build/withIAP.js +91 -1
- package/plugin/src/withIAP.ts +162 -0
- package/src/hooks/useIAP.ts +47 -1
- package/src/index.ts +313 -2
- package/src/specs/RnIap.nitro.ts +99 -1
- package/src/types.ts +124 -13
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_ExternalPurchaseNoticeResultIOS.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
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: ExternalPurchaseNoticeResultIOS) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_ExternalPurchaseNoticeResultIOS {
|
|
16
|
+
public typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: ExternalPurchaseNoticeResultIOS) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: ExternalPurchaseNoticeResultIOS) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: ExternalPurchaseNoticeResultIOS) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_ExternalPurchaseNoticeResultIOS`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_ExternalPurchaseNoticeResultIOS>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_ExternalPurchaseNoticeResultIOS {
|
|
45
|
+
return Unmanaged<Func_void_ExternalPurchaseNoticeResultIOS>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_UserChoiceBillingDetails.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
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ details: UserChoiceBillingDetails) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_UserChoiceBillingDetails {
|
|
16
|
+
public typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ details: UserChoiceBillingDetails) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ details: UserChoiceBillingDetails) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(details: UserChoiceBillingDetails) -> Void {
|
|
26
|
+
self.closure(details)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_UserChoiceBillingDetails`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_UserChoiceBillingDetails>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_UserChoiceBillingDetails {
|
|
45
|
+
return Unmanaged<Func_void_UserChoiceBillingDetails>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -14,7 +14,7 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
// Methods
|
|
17
|
-
func initConnection() throws -> Promise<Bool>
|
|
17
|
+
func initConnection(config: InitConnectionConfig?) throws -> Promise<Bool>
|
|
18
18
|
func endConnection() throws -> Promise<Bool>
|
|
19
19
|
func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
|
|
20
20
|
func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<RequestPurchaseResult?>
|
|
@@ -50,6 +50,14 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
|
|
|
50
50
|
func validateReceipt(params: NitroReceiptValidationParams) throws -> Promise<Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid>
|
|
51
51
|
func getStorefront() throws -> Promise<String>
|
|
52
52
|
func deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid) throws -> Promise<Void>
|
|
53
|
+
func checkAlternativeBillingAvailabilityAndroid() throws -> Promise<Bool>
|
|
54
|
+
func showAlternativeBillingDialogAndroid() throws -> Promise<Bool>
|
|
55
|
+
func createAlternativeBillingTokenAndroid(sku: String?) throws -> Promise<String?>
|
|
56
|
+
func addUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
|
|
57
|
+
func removeUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
|
|
58
|
+
func canPresentExternalPurchaseNoticeIOS() throws -> Promise<Bool>
|
|
59
|
+
func presentExternalPurchaseNoticeSheetIOS() throws -> Promise<ExternalPurchaseNoticeResultIOS>
|
|
60
|
+
func presentExternalPurchaseLinkIOS(url: String) throws -> Promise<ExternalPurchaseLinkResultIOS>
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
/// See ``HybridRnIapSpec``
|
|
@@ -110,9 +110,16 @@ open class HybridRnIapSpec_cxx {
|
|
|
110
110
|
|
|
111
111
|
// Methods
|
|
112
112
|
@inline(__always)
|
|
113
|
-
public final func initConnection() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
113
|
+
public final func initConnection(config: bridge.std__optional_InitConnectionConfig_) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
114
114
|
do {
|
|
115
|
-
let __result = try self.__implementation.initConnection()
|
|
115
|
+
let __result = try self.__implementation.initConnection(config: { () -> InitConnectionConfig? in
|
|
116
|
+
if bridge.has_value_std__optional_InitConnectionConfig_(config) {
|
|
117
|
+
let __unwrapped = bridge.get_std__optional_InitConnectionConfig_(config)
|
|
118
|
+
return __unwrapped
|
|
119
|
+
} else {
|
|
120
|
+
return nil
|
|
121
|
+
}
|
|
122
|
+
}())
|
|
116
123
|
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
117
124
|
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
118
125
|
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
@@ -901,4 +908,163 @@ open class HybridRnIapSpec_cxx {
|
|
|
901
908
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
902
909
|
}
|
|
903
910
|
}
|
|
911
|
+
|
|
912
|
+
@inline(__always)
|
|
913
|
+
public final func checkAlternativeBillingAvailabilityAndroid() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
914
|
+
do {
|
|
915
|
+
let __result = try self.__implementation.checkAlternativeBillingAvailabilityAndroid()
|
|
916
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
917
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
918
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
919
|
+
__result
|
|
920
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
921
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
922
|
+
return __promise
|
|
923
|
+
}()
|
|
924
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
925
|
+
} catch (let __error) {
|
|
926
|
+
let __exceptionPtr = __error.toCpp()
|
|
927
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
@inline(__always)
|
|
932
|
+
public final func showAlternativeBillingDialogAndroid() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
933
|
+
do {
|
|
934
|
+
let __result = try self.__implementation.showAlternativeBillingDialogAndroid()
|
|
935
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
936
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
937
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
938
|
+
__result
|
|
939
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
940
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
941
|
+
return __promise
|
|
942
|
+
}()
|
|
943
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
944
|
+
} catch (let __error) {
|
|
945
|
+
let __exceptionPtr = __error.toCpp()
|
|
946
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
@inline(__always)
|
|
951
|
+
public final func createAlternativeBillingTokenAndroid(sku: bridge.std__optional_std__string_) -> bridge.Result_std__shared_ptr_Promise_std__optional_std__string____ {
|
|
952
|
+
do {
|
|
953
|
+
let __result = try self.__implementation.createAlternativeBillingTokenAndroid(sku: { () -> String? in
|
|
954
|
+
if bridge.has_value_std__optional_std__string_(sku) {
|
|
955
|
+
let __unwrapped = bridge.get_std__optional_std__string_(sku)
|
|
956
|
+
return String(__unwrapped)
|
|
957
|
+
} else {
|
|
958
|
+
return nil
|
|
959
|
+
}
|
|
960
|
+
}())
|
|
961
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__optional_std__string___ in
|
|
962
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__optional_std__string___()
|
|
963
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_std__string___(__promise)
|
|
964
|
+
__result
|
|
965
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_std__string_ in
|
|
966
|
+
if let __unwrappedValue = __result {
|
|
967
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
968
|
+
} else {
|
|
969
|
+
return .init()
|
|
970
|
+
}
|
|
971
|
+
}()) })
|
|
972
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
973
|
+
return __promise
|
|
974
|
+
}()
|
|
975
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__resultCpp)
|
|
976
|
+
} catch (let __error) {
|
|
977
|
+
let __exceptionPtr = __error.toCpp()
|
|
978
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__exceptionPtr)
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
@inline(__always)
|
|
983
|
+
public final func addUserChoiceBillingListenerAndroid(listener: bridge.Func_void_UserChoiceBillingDetails) -> bridge.Result_void_ {
|
|
984
|
+
do {
|
|
985
|
+
try self.__implementation.addUserChoiceBillingListenerAndroid(listener: { () -> (UserChoiceBillingDetails) -> Void in
|
|
986
|
+
let __wrappedFunction = bridge.wrap_Func_void_UserChoiceBillingDetails(listener)
|
|
987
|
+
return { (__details: UserChoiceBillingDetails) -> Void in
|
|
988
|
+
__wrappedFunction.call(__details)
|
|
989
|
+
}
|
|
990
|
+
}())
|
|
991
|
+
return bridge.create_Result_void_()
|
|
992
|
+
} catch (let __error) {
|
|
993
|
+
let __exceptionPtr = __error.toCpp()
|
|
994
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
@inline(__always)
|
|
999
|
+
public final func removeUserChoiceBillingListenerAndroid(listener: bridge.Func_void_UserChoiceBillingDetails) -> bridge.Result_void_ {
|
|
1000
|
+
do {
|
|
1001
|
+
try self.__implementation.removeUserChoiceBillingListenerAndroid(listener: { () -> (UserChoiceBillingDetails) -> Void in
|
|
1002
|
+
let __wrappedFunction = bridge.wrap_Func_void_UserChoiceBillingDetails(listener)
|
|
1003
|
+
return { (__details: UserChoiceBillingDetails) -> Void in
|
|
1004
|
+
__wrappedFunction.call(__details)
|
|
1005
|
+
}
|
|
1006
|
+
}())
|
|
1007
|
+
return bridge.create_Result_void_()
|
|
1008
|
+
} catch (let __error) {
|
|
1009
|
+
let __exceptionPtr = __error.toCpp()
|
|
1010
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
@inline(__always)
|
|
1015
|
+
public final func canPresentExternalPurchaseNoticeIOS() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
1016
|
+
do {
|
|
1017
|
+
let __result = try self.__implementation.canPresentExternalPurchaseNoticeIOS()
|
|
1018
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
1019
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
1020
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
1021
|
+
__result
|
|
1022
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1023
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1024
|
+
return __promise
|
|
1025
|
+
}()
|
|
1026
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
1027
|
+
} catch (let __error) {
|
|
1028
|
+
let __exceptionPtr = __error.toCpp()
|
|
1029
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
@inline(__always)
|
|
1034
|
+
public final func presentExternalPurchaseNoticeSheetIOS() -> bridge.Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___ {
|
|
1035
|
+
do {
|
|
1036
|
+
let __result = try self.__implementation.presentExternalPurchaseNoticeSheetIOS()
|
|
1037
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__ in
|
|
1038
|
+
let __promise = bridge.create_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__()
|
|
1039
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__(__promise)
|
|
1040
|
+
__result
|
|
1041
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1042
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1043
|
+
return __promise
|
|
1044
|
+
}()
|
|
1045
|
+
return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(__resultCpp)
|
|
1046
|
+
} catch (let __error) {
|
|
1047
|
+
let __exceptionPtr = __error.toCpp()
|
|
1048
|
+
return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(__exceptionPtr)
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
@inline(__always)
|
|
1053
|
+
public final func presentExternalPurchaseLinkIOS(url: std.string) -> bridge.Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___ {
|
|
1054
|
+
do {
|
|
1055
|
+
let __result = try self.__implementation.presentExternalPurchaseLinkIOS(url: String(url))
|
|
1056
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__ in
|
|
1057
|
+
let __promise = bridge.create_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__()
|
|
1058
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__(__promise)
|
|
1059
|
+
__result
|
|
1060
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1061
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1062
|
+
return __promise
|
|
1063
|
+
}()
|
|
1064
|
+
return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(__resultCpp)
|
|
1065
|
+
} catch (let __error) {
|
|
1066
|
+
let __exceptionPtr = __error.toCpp()
|
|
1067
|
+
return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(__exceptionPtr)
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
904
1070
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// InitConnectionConfig.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 `InitConnectionConfig`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias InitConnectionConfig = margelo.nitro.iap.InitConnectionConfig
|
|
14
|
+
|
|
15
|
+
public extension InitConnectionConfig {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `InitConnectionConfig`.
|
|
20
|
+
*/
|
|
21
|
+
init(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_AlternativeBillingModeAndroid_ in
|
|
23
|
+
if let __unwrappedValue = alternativeBillingModeAndroid {
|
|
24
|
+
return bridge.create_std__optional_AlternativeBillingModeAndroid_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var alternativeBillingModeAndroid: AlternativeBillingModeAndroid? {
|
|
32
|
+
@inline(__always)
|
|
33
|
+
get {
|
|
34
|
+
return self.__alternativeBillingModeAndroid.value
|
|
35
|
+
}
|
|
36
|
+
@inline(__always)
|
|
37
|
+
set {
|
|
38
|
+
self.__alternativeBillingModeAndroid = { () -> bridge.std__optional_AlternativeBillingModeAndroid_ in
|
|
39
|
+
if let __unwrappedValue = newValue {
|
|
40
|
+
return bridge.create_std__optional_AlternativeBillingModeAndroid_(__unwrappedValue)
|
|
41
|
+
} else {
|
|
42
|
+
return .init()
|
|
43
|
+
}
|
|
44
|
+
}()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -18,13 +18,19 @@ public extension PurchaseAndroid {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `PurchaseAndroid`.
|
|
20
20
|
*/
|
|
21
|
-
init(autoRenewingAndroid: Bool?, 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?, 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)
|
|
25
25
|
} else {
|
|
26
26
|
return .init()
|
|
27
27
|
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
29
|
+
if let __unwrappedValue = currentPlanId {
|
|
30
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
28
34
|
}(), { () -> bridge.std__optional_std__string_ in
|
|
29
35
|
if let __unwrappedValue = dataAndroid {
|
|
30
36
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -111,6 +117,30 @@ public extension PurchaseAndroid {
|
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
|
|
120
|
+
var currentPlanId: String? {
|
|
121
|
+
@inline(__always)
|
|
122
|
+
get {
|
|
123
|
+
return { () -> String? in
|
|
124
|
+
if bridge.has_value_std__optional_std__string_(self.__currentPlanId) {
|
|
125
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__currentPlanId)
|
|
126
|
+
return String(__unwrapped)
|
|
127
|
+
} else {
|
|
128
|
+
return nil
|
|
129
|
+
}
|
|
130
|
+
}()
|
|
131
|
+
}
|
|
132
|
+
@inline(__always)
|
|
133
|
+
set {
|
|
134
|
+
self.__currentPlanId = { () -> bridge.std__optional_std__string_ in
|
|
135
|
+
if let __unwrappedValue = newValue {
|
|
136
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
137
|
+
} else {
|
|
138
|
+
return .init()
|
|
139
|
+
}
|
|
140
|
+
}()
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
114
144
|
var dataAndroid: String? {
|
|
115
145
|
@inline(__always)
|
|
116
146
|
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?, 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?, 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?, revocationDateIOS: Double?, revocationReasonIOS: String?, 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))
|
|
@@ -49,6 +49,12 @@ public extension PurchaseIOS {
|
|
|
49
49
|
} else {
|
|
50
50
|
return .init()
|
|
51
51
|
}
|
|
52
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
53
|
+
if let __unwrappedValue = currentPlanId {
|
|
54
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
55
|
+
} else {
|
|
56
|
+
return .init()
|
|
57
|
+
}
|
|
52
58
|
}(), { () -> bridge.std__optional_std__string_ in
|
|
53
59
|
if let __unwrappedValue = environmentIOS {
|
|
54
60
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -286,6 +292,30 @@ public extension PurchaseIOS {
|
|
|
286
292
|
}
|
|
287
293
|
}
|
|
288
294
|
|
|
295
|
+
var currentPlanId: String? {
|
|
296
|
+
@inline(__always)
|
|
297
|
+
get {
|
|
298
|
+
return { () -> String? in
|
|
299
|
+
if bridge.has_value_std__optional_std__string_(self.__currentPlanId) {
|
|
300
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__currentPlanId)
|
|
301
|
+
return String(__unwrapped)
|
|
302
|
+
} else {
|
|
303
|
+
return nil
|
|
304
|
+
}
|
|
305
|
+
}()
|
|
306
|
+
}
|
|
307
|
+
@inline(__always)
|
|
308
|
+
set {
|
|
309
|
+
self.__currentPlanId = { () -> bridge.std__optional_std__string_ in
|
|
310
|
+
if let __unwrappedValue = newValue {
|
|
311
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
312
|
+
} else {
|
|
313
|
+
return .init()
|
|
314
|
+
}
|
|
315
|
+
}()
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
289
319
|
var environmentIOS: String? {
|
|
290
320
|
@inline(__always)
|
|
291
321
|
get {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UserChoiceBillingDetails.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 `UserChoiceBillingDetails`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias UserChoiceBillingDetails = margelo.nitro.iap.UserChoiceBillingDetails
|
|
14
|
+
|
|
15
|
+
public extension UserChoiceBillingDetails {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `UserChoiceBillingDetails`.
|
|
20
|
+
*/
|
|
21
|
+
init(externalTransactionToken: String, products: [String]) {
|
|
22
|
+
self.init(std.string(externalTransactionToken), { () -> bridge.std__vector_std__string_ in
|
|
23
|
+
var __vector = bridge.create_std__vector_std__string_(products.count)
|
|
24
|
+
for __item in products {
|
|
25
|
+
__vector.push_back(std.string(__item))
|
|
26
|
+
}
|
|
27
|
+
return __vector
|
|
28
|
+
}())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var externalTransactionToken: String {
|
|
32
|
+
@inline(__always)
|
|
33
|
+
get {
|
|
34
|
+
return String(self.__externalTransactionToken)
|
|
35
|
+
}
|
|
36
|
+
@inline(__always)
|
|
37
|
+
set {
|
|
38
|
+
self.__externalTransactionToken = std.string(newValue)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var products: [String] {
|
|
43
|
+
@inline(__always)
|
|
44
|
+
get {
|
|
45
|
+
return self.__products.map({ __item in String(__item) })
|
|
46
|
+
}
|
|
47
|
+
@inline(__always)
|
|
48
|
+
set {
|
|
49
|
+
self.__products = { () -> bridge.std__vector_std__string_ in
|
|
50
|
+
var __vector = bridge.create_std__vector_std__string_(newValue.count)
|
|
51
|
+
for __item in newValue {
|
|
52
|
+
__vector.push_back(std.string(__item))
|
|
53
|
+
}
|
|
54
|
+
return __vector
|
|
55
|
+
}()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AlternativeBillingModeAndroid.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/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (AlternativeBillingModeAndroid).
|
|
30
|
+
*/
|
|
31
|
+
enum class AlternativeBillingModeAndroid {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
USER_CHOICE SWIFT_NAME(userChoice) = 1,
|
|
34
|
+
ALTERNATIVE_ONLY SWIFT_NAME(alternativeOnly) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ AlternativeBillingModeAndroid <> JS AlternativeBillingModeAndroid (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::AlternativeBillingModeAndroid> final {
|
|
44
|
+
static inline margelo::nitro::iap::AlternativeBillingModeAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("none"): return margelo::nitro::iap::AlternativeBillingModeAndroid::NONE;
|
|
48
|
+
case hashString("user-choice"): return margelo::nitro::iap::AlternativeBillingModeAndroid::USER_CHOICE;
|
|
49
|
+
case hashString("alternative-only"): return margelo::nitro::iap::AlternativeBillingModeAndroid::ALTERNATIVE_ONLY;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AlternativeBillingModeAndroid - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::AlternativeBillingModeAndroid arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::AlternativeBillingModeAndroid::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
57
|
+
case margelo::nitro::iap::AlternativeBillingModeAndroid::USER_CHOICE: return JSIConverter<std::string>::toJSI(runtime, "user-choice");
|
|
58
|
+
case margelo::nitro::iap::AlternativeBillingModeAndroid::ALTERNATIVE_ONLY: return JSIConverter<std::string>::toJSI(runtime, "alternative-only");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert AlternativeBillingModeAndroid to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("none"):
|
|
71
|
+
case hashString("user-choice"):
|
|
72
|
+
case hashString("alternative-only"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalPurchaseLinkResultIOS.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
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <optional>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A struct which can be represented as a JavaScript object (ExternalPurchaseLinkResultIOS).
|
|
30
|
+
*/
|
|
31
|
+
struct ExternalPurchaseLinkResultIOS {
|
|
32
|
+
public:
|
|
33
|
+
std::optional<std::string> error SWIFT_PRIVATE;
|
|
34
|
+
bool success SWIFT_PRIVATE;
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
ExternalPurchaseLinkResultIOS() = default;
|
|
38
|
+
explicit ExternalPurchaseLinkResultIOS(std::optional<std::string> error, bool success): error(error), success(success) {}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace margelo::nitro::iap
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro {
|
|
44
|
+
|
|
45
|
+
// C++ ExternalPurchaseLinkResultIOS <> JS ExternalPurchaseLinkResultIOS (object)
|
|
46
|
+
template <>
|
|
47
|
+
struct JSIConverter<margelo::nitro::iap::ExternalPurchaseLinkResultIOS> final {
|
|
48
|
+
static inline margelo::nitro::iap::ExternalPurchaseLinkResultIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
+
return margelo::nitro::iap::ExternalPurchaseLinkResultIOS(
|
|
51
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "error")),
|
|
52
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "success"))
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::ExternalPurchaseLinkResultIOS& arg) {
|
|
56
|
+
jsi::Object obj(runtime);
|
|
57
|
+
obj.setProperty(runtime, "error", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
|
|
58
|
+
obj.setProperty(runtime, "success", JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
59
|
+
return obj;
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isObject()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
jsi::Object obj = value.getObject(runtime);
|
|
66
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "error"))) return false;
|
|
67
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "success"))) return false;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
} // namespace margelo::nitro
|