react-native-iap 14.3.5-rc.1 → 14.3.6
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 +6 -39
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +54 -55
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +4 -8
- 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 +141 -146
- 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/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/hooks/useIAP.ts +17 -59
- package/src/index.ts +73 -77
- package/src/specs/RnIap.nitro.ts +4 -1
- package/src/types.ts +168 -178
- package/src/utils/type-bridge.ts +3 -1
- package/lib/index.d.ts +0 -8
- package/lib/index.js +0 -36
- package/lib/specs/RnIap.nitro.d.ts +0 -7
- package/lib/specs/RnIap.nitro.js +0 -1
|
@@ -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 {
|
|
@@ -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.
|
|
@@ -50,9 +52,20 @@ namespace margelo::nitro::iap { struct NitroSubscriptionOffer; }
|
|
|
50
52
|
namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
51
53
|
// Forward declaration of `NitroSubscriptionStatus` to properly resolve imports.
|
|
52
54
|
namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
|
|
55
|
+
// Forward declaration of `PurchaseAndroid` to properly resolve imports.
|
|
56
|
+
namespace margelo::nitro::iap { struct PurchaseAndroid; }
|
|
57
|
+
// Forward declaration of `PurchaseIOS` to properly resolve imports.
|
|
58
|
+
namespace margelo::nitro::iap { struct PurchaseIOS; }
|
|
59
|
+
// Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
|
|
60
|
+
namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
|
|
61
|
+
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
62
|
+
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
63
|
+
// Forward declaration of `RequestPurchaseResult` to properly resolve imports.
|
|
64
|
+
namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
53
65
|
|
|
54
66
|
// Include C++ defined types
|
|
55
67
|
#include "HybridRnIapSpec.hpp"
|
|
68
|
+
#include "IapPlatform.hpp"
|
|
56
69
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
57
70
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
58
71
|
#include "NitroAvailablePurchasesOptions.hpp"
|
|
@@ -73,6 +86,11 @@ namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
|
|
|
73
86
|
#include "NitroSubscriptionOffer.hpp"
|
|
74
87
|
#include "NitroSubscriptionRenewalInfo.hpp"
|
|
75
88
|
#include "NitroSubscriptionStatus.hpp"
|
|
89
|
+
#include "PurchaseAndroid.hpp"
|
|
90
|
+
#include "PurchaseIOS.hpp"
|
|
91
|
+
#include "PurchaseOfferIOS.hpp"
|
|
92
|
+
#include "PurchaseState.hpp"
|
|
93
|
+
#include "RequestPurchaseResult.hpp"
|
|
76
94
|
#include <NitroModules/Promise.hpp>
|
|
77
95
|
#include <NitroModules/Result.hpp>
|
|
78
96
|
#include <exception>
|
|
@@ -14,6 +14,18 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
14
14
|
|
|
15
15
|
// Forward declaration of `NitroProduct` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::iap { struct NitroProduct; }
|
|
17
|
+
// Forward declaration of `RequestPurchaseResult` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
19
|
+
// Forward declaration of `PurchaseAndroid` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::iap { struct PurchaseAndroid; }
|
|
21
|
+
// Forward declaration of `PurchaseIOS` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::iap { struct PurchaseIOS; }
|
|
23
|
+
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
25
|
+
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
27
|
+
// Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
|
|
17
29
|
// Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
|
|
18
30
|
namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
|
|
19
31
|
// Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
|
|
@@ -58,6 +70,13 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
58
70
|
#include <vector>
|
|
59
71
|
#include <string>
|
|
60
72
|
#include <optional>
|
|
73
|
+
#include "RequestPurchaseResult.hpp"
|
|
74
|
+
#include "PurchaseAndroid.hpp"
|
|
75
|
+
#include "PurchaseIOS.hpp"
|
|
76
|
+
#include <variant>
|
|
77
|
+
#include "IapPlatform.hpp"
|
|
78
|
+
#include "PurchaseState.hpp"
|
|
79
|
+
#include "PurchaseOfferIOS.hpp"
|
|
61
80
|
#include "NitroPurchaseRequest.hpp"
|
|
62
81
|
#include "NitroRequestPurchaseIos.hpp"
|
|
63
82
|
#include <unordered_map>
|
|
@@ -68,7 +87,6 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
68
87
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
69
88
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
70
89
|
#include "NitroPurchaseResult.hpp"
|
|
71
|
-
#include <variant>
|
|
72
90
|
#include "NitroFinishTransactionParams.hpp"
|
|
73
91
|
#include "NitroFinishTransactionIosParams.hpp"
|
|
74
92
|
#include "NitroFinishTransactionAndroidParams.hpp"
|
|
@@ -146,7 +164,7 @@ namespace margelo::nitro::iap {
|
|
|
146
164
|
auto __value = std::move(__result.value());
|
|
147
165
|
return __value;
|
|
148
166
|
}
|
|
149
|
-
inline std::shared_ptr<Promise<
|
|
167
|
+
inline std::shared_ptr<Promise<RequestPurchaseResult>> requestPurchase(const NitroPurchaseRequest& request) override {
|
|
150
168
|
auto __result = _swiftPart.requestPurchase(request);
|
|
151
169
|
if (__result.hasError()) [[unlikely]] {
|
|
152
170
|
std::rethrow_exception(__result.error());
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_RequestPurchaseResult.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: RequestPurchaseResult) -> 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_RequestPurchaseResult {
|
|
16
|
+
public typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: RequestPurchaseResult) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: RequestPurchaseResult) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: RequestPurchaseResult) -> 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_RequestPurchaseResult`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_RequestPurchaseResult>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_RequestPurchaseResult {
|
|
45
|
+
return Unmanaged<Func_void_RequestPurchaseResult>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -17,7 +17,7 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
|
|
|
17
17
|
func initConnection() throws -> Promise<Bool>
|
|
18
18
|
func endConnection() throws -> Promise<Bool>
|
|
19
19
|
func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
|
|
20
|
-
func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<
|
|
20
|
+
func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<RequestPurchaseResult>
|
|
21
21
|
func getAvailablePurchases(options: NitroAvailablePurchasesOptions?) throws -> Promise<[NitroPurchase]>
|
|
22
22
|
func finishTransaction(params: NitroFinishTransactionParams) throws -> Promise<Variant_Bool_NitroPurchaseResult>
|
|
23
23
|
func addPurchaseUpdatedListener(listener: @escaping (_ purchase: NitroPurchase) -> Void) throws -> Void
|
|
@@ -173,21 +173,21 @@ open class HybridRnIapSpec_cxx {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
@inline(__always)
|
|
176
|
-
public final func requestPurchase(request: NitroPurchaseRequest) -> bridge.
|
|
176
|
+
public final func requestPurchase(request: NitroPurchaseRequest) -> bridge.Result_std__shared_ptr_Promise_RequestPurchaseResult___ {
|
|
177
177
|
do {
|
|
178
178
|
let __result = try self.__implementation.requestPurchase(request: request)
|
|
179
|
-
let __resultCpp = { () -> bridge.
|
|
180
|
-
let __promise = bridge.
|
|
181
|
-
let __promiseHolder = bridge.
|
|
179
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_RequestPurchaseResult__ in
|
|
180
|
+
let __promise = bridge.create_std__shared_ptr_Promise_RequestPurchaseResult__()
|
|
181
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_RequestPurchaseResult__(__promise)
|
|
182
182
|
__result
|
|
183
|
-
.then({ __result in __promiseHolder.resolve() })
|
|
183
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
184
184
|
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
185
185
|
return __promise
|
|
186
186
|
}()
|
|
187
|
-
return bridge.
|
|
187
|
+
return bridge.create_Result_std__shared_ptr_Promise_RequestPurchaseResult___(__resultCpp)
|
|
188
188
|
} catch (let __error) {
|
|
189
189
|
let __exceptionPtr = __error.toCpp()
|
|
190
|
-
return bridge.
|
|
190
|
+
return bridge.create_Result_std__shared_ptr_Promise_RequestPurchaseResult___(__exceptionPtr)
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IapPlatform.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
|
+
/**
|
|
9
|
+
* Represents the JS union `IapPlatform`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias IapPlatform = margelo.nitro.iap.IapPlatform
|
|
12
|
+
|
|
13
|
+
public extension IapPlatform {
|
|
14
|
+
/**
|
|
15
|
+
* Get a IapPlatform for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "android":
|
|
21
|
+
self = .android
|
|
22
|
+
case "ios":
|
|
23
|
+
self = .ios
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this IapPlatform represents.
|
|
31
|
+
*/
|
|
32
|
+
var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .android:
|
|
35
|
+
return "android"
|
|
36
|
+
case .ios:
|
|
37
|
+
return "ios"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Purchase.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
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `struct | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Purchase {
|
|
16
|
+
case first(PurchaseAndroid)
|
|
17
|
+
case second(PurchaseIOS)
|
|
18
|
+
}
|