react-native-iap 14.3.4 → 14.3.5
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/NitroIap.podspec +1 -1
- package/README.md +1 -1
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +2 -2
- package/android/src/main/cpp/cpp-adapter.cpp +8 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +93 -51
- package/ios/HybridRnIap.swift +38 -30
- package/lib/module/hooks/useIAP.js +4 -4
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +54 -53
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -59
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +44 -33
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +4 -4
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +2 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +159 -204
- 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/NitroIap+autolinking.cmake +9 -4
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -5
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JIapPlatform.hpp +59 -0
- package/nitrogen/generated/android/c++/JPurchase.cpp +26 -0
- package/nitrogen/generated/android/c++/JPurchase.hpp +80 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +140 -0
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +194 -0
- package/nitrogen/generated/android/c++/JPurchaseOfferIOS.hpp +61 -0
- package/nitrogen/generated/android/c++/JPurchaseState.hpp +71 -0
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +89 -0
- package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapPlatform.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Purchase.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +116 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseOfferIOS.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseState.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +42 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +13 -5
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +186 -25
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +20 -2
- package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +7 -7
- package/nitrogen/generated/ios/swift/IapPlatform.swift +40 -0
- package/nitrogen/generated/ios/swift/Purchase.swift +18 -0
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +399 -0
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +768 -0
- package/nitrogen/generated/ios/swift/PurchaseOfferIOS.swift +57 -0
- package/nitrogen/generated/ios/swift/PurchaseState.swift +56 -0
- package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +148 -0
- package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +18 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -1
- package/nitrogen/generated/shared/c++/IapPlatform.hpp +76 -0
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +138 -0
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +193 -0
- package/nitrogen/generated/shared/c++/PurchaseOfferIOS.hpp +75 -0
- package/nitrogen/generated/shared/c++/PurchaseState.hpp +92 -0
- package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +78 -0
- package/package.json +5 -4
- package/plugin/build/withIAP.js +1 -1
- package/plugin/src/withIAP.ts +1 -1
- package/src/hooks/useIAP.ts +14 -8
- package/src/index.ts +73 -74
- package/src/specs/RnIap.nitro.ts +4 -1
- package/src/types.ts +183 -216
- package/src/utils/type-bridge.ts +55 -43
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PurchaseAndroid.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "PurchaseAndroid".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class PurchaseAndroid
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val autoRenewingAndroid: Boolean?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val dataAndroid: String?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val developerPayloadAndroid: String?,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val id: String,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val ids: Array<String>?,
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
val isAcknowledgedAndroid: Boolean?,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
val isAutoRenewing: Boolean,
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
val obfuscatedAccountIdAndroid: String?,
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
val obfuscatedProfileIdAndroid: String?,
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
val packageNameAndroid: String?,
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
@Keep
|
|
56
|
+
val platform: IapPlatform,
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
val productId: String,
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
val purchaseState: PurchaseState,
|
|
63
|
+
@DoNotStrip
|
|
64
|
+
@Keep
|
|
65
|
+
val purchaseToken: String?,
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
val quantity: Double,
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
val signatureAndroid: String?,
|
|
72
|
+
@DoNotStrip
|
|
73
|
+
@Keep
|
|
74
|
+
val transactionDate: Double
|
|
75
|
+
) {
|
|
76
|
+
/* main constructor */
|
|
77
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PurchaseIOS.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "PurchaseIOS".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class PurchaseIOS
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val appAccountToken: String?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val appBundleIdIOS: String?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val countryCodeIOS: String?,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val currencyCodeIOS: String?,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val currencySymbolIOS: String?,
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
val environmentIOS: String?,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
val expirationDateIOS: Double?,
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
val id: String,
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
val ids: Array<String>?,
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
val isAutoRenewing: Boolean,
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
@Keep
|
|
56
|
+
val isUpgradedIOS: Boolean?,
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
val offerIOS: PurchaseOfferIOS?,
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
val originalTransactionDateIOS: Double?,
|
|
63
|
+
@DoNotStrip
|
|
64
|
+
@Keep
|
|
65
|
+
val originalTransactionIdentifierIOS: String?,
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
val ownershipTypeIOS: String?,
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
val platform: IapPlatform,
|
|
72
|
+
@DoNotStrip
|
|
73
|
+
@Keep
|
|
74
|
+
val productId: String,
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
val purchaseState: PurchaseState,
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
val purchaseToken: String?,
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
val quantity: Double,
|
|
84
|
+
@DoNotStrip
|
|
85
|
+
@Keep
|
|
86
|
+
val quantityIOS: Double?,
|
|
87
|
+
@DoNotStrip
|
|
88
|
+
@Keep
|
|
89
|
+
val reasonIOS: String?,
|
|
90
|
+
@DoNotStrip
|
|
91
|
+
@Keep
|
|
92
|
+
val reasonStringRepresentationIOS: String?,
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
@Keep
|
|
95
|
+
val revocationDateIOS: Double?,
|
|
96
|
+
@DoNotStrip
|
|
97
|
+
@Keep
|
|
98
|
+
val revocationReasonIOS: String?,
|
|
99
|
+
@DoNotStrip
|
|
100
|
+
@Keep
|
|
101
|
+
val storefrontCountryCodeIOS: String?,
|
|
102
|
+
@DoNotStrip
|
|
103
|
+
@Keep
|
|
104
|
+
val subscriptionGroupIdIOS: String?,
|
|
105
|
+
@DoNotStrip
|
|
106
|
+
@Keep
|
|
107
|
+
val transactionDate: Double,
|
|
108
|
+
@DoNotStrip
|
|
109
|
+
@Keep
|
|
110
|
+
val transactionReasonIOS: String?,
|
|
111
|
+
@DoNotStrip
|
|
112
|
+
@Keep
|
|
113
|
+
val webOrderLineItemIdIOS: String?
|
|
114
|
+
) {
|
|
115
|
+
/* main constructor */
|
|
116
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PurchaseOfferIOS.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "PurchaseOfferIOS".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class PurchaseOfferIOS
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val id: String,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val paymentMode: String,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val type: String
|
|
33
|
+
) {
|
|
34
|
+
/* main constructor */
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PurchaseState.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "PurchaseState".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class PurchaseState(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
DEFERRED(0),
|
|
20
|
+
FAILED(1),
|
|
21
|
+
PENDING(2),
|
|
22
|
+
PURCHASED(3),
|
|
23
|
+
RESTORED(4),
|
|
24
|
+
UNKNOWN(5);
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RequestPurchaseResult.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "RequestPurchaseResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class RequestPurchaseResult
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val purchase: Variant_PurchaseAndroid_PurchaseIOS?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val purchases: Array<Purchase>?
|
|
30
|
+
) {
|
|
31
|
+
/* main constructor */
|
|
32
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_PurchaseAndroid_PurchaseIOS.kt
|
|
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
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the TypeScript variant "PurchaseAndroid|PurchaseIOS".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_PurchaseAndroid_PurchaseIOS {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: PurchaseAndroid): Variant_PurchaseAndroid_PurchaseIOS()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: PurchaseIOS): Variant_PurchaseAndroid_PurchaseIOS()
|
|
23
|
+
|
|
24
|
+
inline fun <reified T> getAs(): T? = when (this) {
|
|
25
|
+
is First -> value as? T
|
|
26
|
+
is Second -> value as? T
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
val isFirst: Boolean
|
|
30
|
+
get() = this is First
|
|
31
|
+
val isSecond: Boolean
|
|
32
|
+
get() = this is Second
|
|
33
|
+
|
|
34
|
+
companion object {
|
|
35
|
+
@JvmStatic
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
fun create(value: PurchaseAndroid): Variant_PurchaseAndroid_PurchaseIOS = First(value)
|
|
38
|
+
@JvmStatic
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
fun create(value: PurchaseIOS): Variant_PurchaseAndroid_PurchaseIOS = Second(value)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -37,11 +37,11 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// pragma MARK: std::function<void()>
|
|
41
|
-
|
|
42
|
-
auto swiftClosure = NitroIap::
|
|
43
|
-
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
44
|
-
swiftClosure.call();
|
|
40
|
+
// pragma MARK: std::function<void(const RequestPurchaseResult& /* result */)>
|
|
41
|
+
Func_void_RequestPurchaseResult create_Func_void_RequestPurchaseResult(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
42
|
+
auto swiftClosure = NitroIap::Func_void_RequestPurchaseResult::fromUnsafe(swiftClosureWrapper);
|
|
43
|
+
return [swiftClosure = std::move(swiftClosure)](const RequestPurchaseResult& result) mutable -> void {
|
|
44
|
+
swiftClosure.call(result);
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -109,6 +109,14 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
// pragma MARK: std::function<void()>
|
|
113
|
+
Func_void create_Func_void(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
114
|
+
auto swiftClosure = NitroIap::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
115
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
116
|
+
swiftClosure.call();
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
112
120
|
// pragma MARK: std::function<void(const std::optional<std::vector<NitroSubscriptionStatus>>& /* result */)>
|
|
113
121
|
Func_void_std__optional_std__vector_NitroSubscriptionStatus__ create_Func_void_std__optional_std__vector_NitroSubscriptionStatus__(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
114
122
|
auto swiftClosure = NitroIap::Func_void_std__optional_std__vector_NitroSubscriptionStatus__::fromUnsafe(swiftClosureWrapper);
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `HybridRnIapSpec` to properly resolve imports.
|
|
12
12
|
namespace margelo::nitro::iap { class HybridRnIapSpec; }
|
|
13
|
+
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
13
15
|
// Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
|
|
15
17
|
// Forward declaration of `NitroAvailablePurchasesIosOptions` to properly resolve imports.
|
|
@@ -42,6 +44,16 @@ namespace margelo::nitro::iap { struct NitroSubscriptionOffer; }
|
|
|
42
44
|
namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
43
45
|
// Forward declaration of `NitroSubscriptionStatus` to properly resolve imports.
|
|
44
46
|
namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
|
|
47
|
+
// Forward declaration of `PurchaseAndroid` to properly resolve imports.
|
|
48
|
+
namespace margelo::nitro::iap { struct PurchaseAndroid; }
|
|
49
|
+
// Forward declaration of `PurchaseIOS` to properly resolve imports.
|
|
50
|
+
namespace margelo::nitro::iap { struct PurchaseIOS; }
|
|
51
|
+
// Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
|
|
52
|
+
namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
|
|
53
|
+
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
54
|
+
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
55
|
+
// Forward declaration of `RequestPurchaseResult` to properly resolve imports.
|
|
56
|
+
namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
45
57
|
|
|
46
58
|
// Forward declarations of Swift defined types
|
|
47
59
|
// Forward declaration of `HybridRnIapSpec_cxx` to properly resolve imports.
|
|
@@ -49,6 +61,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
49
61
|
|
|
50
62
|
// Include C++ defined types
|
|
51
63
|
#include "HybridRnIapSpec.hpp"
|
|
64
|
+
#include "IapPlatform.hpp"
|
|
52
65
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
53
66
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
54
67
|
#include "NitroAvailablePurchasesOptions.hpp"
|
|
@@ -65,6 +78,11 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
65
78
|
#include "NitroSubscriptionOffer.hpp"
|
|
66
79
|
#include "NitroSubscriptionRenewalInfo.hpp"
|
|
67
80
|
#include "NitroSubscriptionStatus.hpp"
|
|
81
|
+
#include "PurchaseAndroid.hpp"
|
|
82
|
+
#include "PurchaseIOS.hpp"
|
|
83
|
+
#include "PurchaseOfferIOS.hpp"
|
|
84
|
+
#include "PurchaseState.hpp"
|
|
85
|
+
#include "RequestPurchaseResult.hpp"
|
|
68
86
|
#include <NitroModules/Promise.hpp>
|
|
69
87
|
#include <NitroModules/PromiseHolder.hpp>
|
|
70
88
|
#include <NitroModules/Result.hpp>
|
|
@@ -240,38 +258,138 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
240
258
|
return vector;
|
|
241
259
|
}
|
|
242
260
|
|
|
243
|
-
// pragma MARK: std::
|
|
261
|
+
// pragma MARK: std::optional<std::vector<std::string>>
|
|
244
262
|
/**
|
|
245
|
-
* Specialized version of `std::
|
|
263
|
+
* Specialized version of `std::optional<std::vector<std::string>>`.
|
|
246
264
|
*/
|
|
247
|
-
using
|
|
248
|
-
inline std::
|
|
249
|
-
return
|
|
265
|
+
using std__optional_std__vector_std__string__ = std::optional<std::vector<std::string>>;
|
|
266
|
+
inline std::optional<std::vector<std::string>> create_std__optional_std__vector_std__string__(const std::vector<std::string>& value) noexcept {
|
|
267
|
+
return std::optional<std::vector<std::string>>(value);
|
|
250
268
|
}
|
|
251
|
-
inline
|
|
252
|
-
return
|
|
269
|
+
inline bool has_value_std__optional_std__vector_std__string__(const std::optional<std::vector<std::string>>& optional) noexcept {
|
|
270
|
+
return optional.has_value();
|
|
271
|
+
}
|
|
272
|
+
inline std::vector<std::string> get_std__optional_std__vector_std__string__(const std::optional<std::vector<std::string>>& optional) noexcept {
|
|
273
|
+
return *optional;
|
|
253
274
|
}
|
|
254
275
|
|
|
255
|
-
// pragma MARK: std::
|
|
276
|
+
// pragma MARK: std::optional<PurchaseOfferIOS>
|
|
256
277
|
/**
|
|
257
|
-
* Specialized version of `std::
|
|
278
|
+
* Specialized version of `std::optional<PurchaseOfferIOS>`.
|
|
258
279
|
*/
|
|
259
|
-
using
|
|
280
|
+
using std__optional_PurchaseOfferIOS_ = std::optional<PurchaseOfferIOS>;
|
|
281
|
+
inline std::optional<PurchaseOfferIOS> create_std__optional_PurchaseOfferIOS_(const PurchaseOfferIOS& value) noexcept {
|
|
282
|
+
return std::optional<PurchaseOfferIOS>(value);
|
|
283
|
+
}
|
|
284
|
+
inline bool has_value_std__optional_PurchaseOfferIOS_(const std::optional<PurchaseOfferIOS>& optional) noexcept {
|
|
285
|
+
return optional.has_value();
|
|
286
|
+
}
|
|
287
|
+
inline PurchaseOfferIOS get_std__optional_PurchaseOfferIOS_(const std::optional<PurchaseOfferIOS>& optional) noexcept {
|
|
288
|
+
return *optional;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// pragma MARK: std::variant<PurchaseAndroid, PurchaseIOS>
|
|
260
292
|
/**
|
|
261
|
-
* Wrapper
|
|
293
|
+
* Wrapper struct for `std::variant<PurchaseAndroid, PurchaseIOS>`.
|
|
294
|
+
* std::variant cannot be used in Swift because of a Swift bug.
|
|
295
|
+
* Not even specializing it works. So we create a wrapper struct.
|
|
262
296
|
*/
|
|
263
|
-
|
|
297
|
+
struct std__variant_PurchaseAndroid__PurchaseIOS_ {
|
|
298
|
+
std::variant<PurchaseAndroid, PurchaseIOS> variant;
|
|
299
|
+
std__variant_PurchaseAndroid__PurchaseIOS_(std::variant<PurchaseAndroid, PurchaseIOS> variant): variant(variant) { }
|
|
300
|
+
operator std::variant<PurchaseAndroid, PurchaseIOS>() const noexcept {
|
|
301
|
+
return variant;
|
|
302
|
+
}
|
|
303
|
+
inline size_t index() const noexcept {
|
|
304
|
+
return variant.index();
|
|
305
|
+
}
|
|
306
|
+
inline PurchaseAndroid get_0() const noexcept {
|
|
307
|
+
return std::get<0>(variant);
|
|
308
|
+
}
|
|
309
|
+
inline PurchaseIOS get_1() const noexcept {
|
|
310
|
+
return std::get<1>(variant);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
inline std__variant_PurchaseAndroid__PurchaseIOS_ create_std__variant_PurchaseAndroid__PurchaseIOS_(const PurchaseAndroid& value) noexcept {
|
|
314
|
+
return std__variant_PurchaseAndroid__PurchaseIOS_(value);
|
|
315
|
+
}
|
|
316
|
+
inline std__variant_PurchaseAndroid__PurchaseIOS_ create_std__variant_PurchaseAndroid__PurchaseIOS_(const PurchaseIOS& value) noexcept {
|
|
317
|
+
return std__variant_PurchaseAndroid__PurchaseIOS_(value);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// pragma MARK: std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>
|
|
321
|
+
/**
|
|
322
|
+
* Specialized version of `std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>`.
|
|
323
|
+
*/
|
|
324
|
+
using std__optional_std__variant_PurchaseAndroid__PurchaseIOS__ = std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>;
|
|
325
|
+
inline std::optional<std::variant<PurchaseAndroid, PurchaseIOS>> create_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__(const std::variant<PurchaseAndroid, PurchaseIOS>& value) noexcept {
|
|
326
|
+
return std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>(value);
|
|
327
|
+
}
|
|
328
|
+
inline bool has_value_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>& optional) noexcept {
|
|
329
|
+
return optional.has_value();
|
|
330
|
+
}
|
|
331
|
+
inline std::variant<PurchaseAndroid, PurchaseIOS> get_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS>>& optional) noexcept {
|
|
332
|
+
return *optional;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// pragma MARK: std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>
|
|
336
|
+
/**
|
|
337
|
+
* Specialized version of `std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>`.
|
|
338
|
+
*/
|
|
339
|
+
using std__vector_std__variant_PurchaseAndroid__PurchaseIOS__ = std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>;
|
|
340
|
+
inline std::vector<std::variant<PurchaseAndroid, PurchaseIOS>> create_std__vector_std__variant_PurchaseAndroid__PurchaseIOS__(size_t size) noexcept {
|
|
341
|
+
std::vector<std::variant<PurchaseAndroid, PurchaseIOS>> vector;
|
|
342
|
+
vector.reserve(size);
|
|
343
|
+
return vector;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// pragma MARK: std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>
|
|
347
|
+
/**
|
|
348
|
+
* Specialized version of `std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>`.
|
|
349
|
+
*/
|
|
350
|
+
using std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ = std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>;
|
|
351
|
+
inline std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>> create_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>& value) noexcept {
|
|
352
|
+
return std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>(value);
|
|
353
|
+
}
|
|
354
|
+
inline bool has_value_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>& optional) noexcept {
|
|
355
|
+
return optional.has_value();
|
|
356
|
+
}
|
|
357
|
+
inline std::vector<std::variant<PurchaseAndroid, PurchaseIOS>> get_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const std::optional<std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>& optional) noexcept {
|
|
358
|
+
return *optional;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// pragma MARK: std::shared_ptr<Promise<RequestPurchaseResult>>
|
|
362
|
+
/**
|
|
363
|
+
* Specialized version of `std::shared_ptr<Promise<RequestPurchaseResult>>`.
|
|
364
|
+
*/
|
|
365
|
+
using std__shared_ptr_Promise_RequestPurchaseResult__ = std::shared_ptr<Promise<RequestPurchaseResult>>;
|
|
366
|
+
inline std::shared_ptr<Promise<RequestPurchaseResult>> create_std__shared_ptr_Promise_RequestPurchaseResult__() noexcept {
|
|
367
|
+
return Promise<RequestPurchaseResult>::create();
|
|
368
|
+
}
|
|
369
|
+
inline PromiseHolder<RequestPurchaseResult> wrap_std__shared_ptr_Promise_RequestPurchaseResult__(std::shared_ptr<Promise<RequestPurchaseResult>> promise) noexcept {
|
|
370
|
+
return PromiseHolder<RequestPurchaseResult>(std::move(promise));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// pragma MARK: std::function<void(const RequestPurchaseResult& /* result */)>
|
|
374
|
+
/**
|
|
375
|
+
* Specialized version of `std::function<void(const RequestPurchaseResult&)>`.
|
|
376
|
+
*/
|
|
377
|
+
using Func_void_RequestPurchaseResult = std::function<void(const RequestPurchaseResult& /* result */)>;
|
|
378
|
+
/**
|
|
379
|
+
* Wrapper class for a `std::function<void(const RequestPurchaseResult& / * result * /)>`, this can be used from Swift.
|
|
380
|
+
*/
|
|
381
|
+
class Func_void_RequestPurchaseResult_Wrapper final {
|
|
264
382
|
public:
|
|
265
|
-
explicit
|
|
266
|
-
inline void call() const noexcept {
|
|
267
|
-
_function->operator()();
|
|
383
|
+
explicit Func_void_RequestPurchaseResult_Wrapper(std::function<void(const RequestPurchaseResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const RequestPurchaseResult& /* result */)>>(std::move(func))) {}
|
|
384
|
+
inline void call(RequestPurchaseResult result) const noexcept {
|
|
385
|
+
_function->operator()(result);
|
|
268
386
|
}
|
|
269
387
|
private:
|
|
270
|
-
std::unique_ptr<std::function<void()>> _function;
|
|
388
|
+
std::unique_ptr<std::function<void(const RequestPurchaseResult& /* result */)>> _function;
|
|
271
389
|
} SWIFT_NONCOPYABLE;
|
|
272
|
-
|
|
273
|
-
inline
|
|
274
|
-
return
|
|
390
|
+
Func_void_RequestPurchaseResult create_Func_void_RequestPurchaseResult(void* _Nonnull swiftClosureWrapper) noexcept;
|
|
391
|
+
inline Func_void_RequestPurchaseResult_Wrapper wrap_Func_void_RequestPurchaseResult(Func_void_RequestPurchaseResult value) noexcept {
|
|
392
|
+
return Func_void_RequestPurchaseResult_Wrapper(std::move(value));
|
|
275
393
|
}
|
|
276
394
|
|
|
277
395
|
// pragma MARK: std::unordered_map<std::string, std::string>
|
|
@@ -736,6 +854,40 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
736
854
|
return Func_void_std__optional_NitroProduct__Wrapper(std::move(value));
|
|
737
855
|
}
|
|
738
856
|
|
|
857
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
858
|
+
/**
|
|
859
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
860
|
+
*/
|
|
861
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
862
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
863
|
+
return Promise<void>::create();
|
|
864
|
+
}
|
|
865
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
866
|
+
return PromiseHolder<void>(std::move(promise));
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// pragma MARK: std::function<void()>
|
|
870
|
+
/**
|
|
871
|
+
* Specialized version of `std::function<void()>`.
|
|
872
|
+
*/
|
|
873
|
+
using Func_void = std::function<void()>;
|
|
874
|
+
/**
|
|
875
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
876
|
+
*/
|
|
877
|
+
class Func_void_Wrapper final {
|
|
878
|
+
public:
|
|
879
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
880
|
+
inline void call() const noexcept {
|
|
881
|
+
_function->operator()();
|
|
882
|
+
}
|
|
883
|
+
private:
|
|
884
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
885
|
+
} SWIFT_NONCOPYABLE;
|
|
886
|
+
Func_void create_Func_void(void* _Nonnull swiftClosureWrapper) noexcept;
|
|
887
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
888
|
+
return Func_void_Wrapper(std::move(value));
|
|
889
|
+
}
|
|
890
|
+
|
|
739
891
|
// pragma MARK: std::optional<NitroSubscriptionRenewalInfo>
|
|
740
892
|
/**
|
|
741
893
|
* Specialized version of `std::optional<NitroSubscriptionRenewalInfo>`.
|
|
@@ -968,13 +1120,13 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
968
1120
|
return Result<std::shared_ptr<Promise<std::vector<NitroProduct>>>>::withError(error);
|
|
969
1121
|
}
|
|
970
1122
|
|
|
971
|
-
// pragma MARK: Result<std::shared_ptr<Promise<
|
|
972
|
-
using
|
|
973
|
-
inline
|
|
974
|
-
return Result<std::shared_ptr<Promise<
|
|
1123
|
+
// pragma MARK: Result<std::shared_ptr<Promise<RequestPurchaseResult>>>
|
|
1124
|
+
using Result_std__shared_ptr_Promise_RequestPurchaseResult___ = Result<std::shared_ptr<Promise<RequestPurchaseResult>>>;
|
|
1125
|
+
inline Result_std__shared_ptr_Promise_RequestPurchaseResult___ create_Result_std__shared_ptr_Promise_RequestPurchaseResult___(const std::shared_ptr<Promise<RequestPurchaseResult>>& value) noexcept {
|
|
1126
|
+
return Result<std::shared_ptr<Promise<RequestPurchaseResult>>>::withValue(value);
|
|
975
1127
|
}
|
|
976
|
-
inline
|
|
977
|
-
return Result<std::shared_ptr<Promise<
|
|
1128
|
+
inline Result_std__shared_ptr_Promise_RequestPurchaseResult___ create_Result_std__shared_ptr_Promise_RequestPurchaseResult___(const std::exception_ptr& error) noexcept {
|
|
1129
|
+
return Result<std::shared_ptr<Promise<RequestPurchaseResult>>>::withError(error);
|
|
978
1130
|
}
|
|
979
1131
|
|
|
980
1132
|
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<NitroPurchase>>>>
|
|
@@ -1031,6 +1183,15 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
1031
1183
|
return Result<std::shared_ptr<Promise<std::optional<NitroProduct>>>>::withError(error);
|
|
1032
1184
|
}
|
|
1033
1185
|
|
|
1186
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
1187
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
1188
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
1189
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
1190
|
+
}
|
|
1191
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
1192
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1034
1195
|
// pragma MARK: Result<std::shared_ptr<Promise<std::optional<std::vector<NitroSubscriptionStatus>>>>>
|
|
1035
1196
|
using Result_std__shared_ptr_Promise_std__optional_std__vector_NitroSubscriptionStatus_____ = Result<std::shared_ptr<Promise<std::optional<std::vector<NitroSubscriptionStatus>>>>>;
|
|
1036
1197
|
inline Result_std__shared_ptr_Promise_std__optional_std__vector_NitroSubscriptionStatus_____ create_Result_std__shared_ptr_Promise_std__optional_std__vector_NitroSubscriptionStatus_____(const std::shared_ptr<Promise<std::optional<std::vector<NitroSubscriptionStatus>>>>& value) noexcept {
|