react-native-iap 14.3.7 → 14.3.9
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/README.md +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +74 -14
- package/ios/HybridRnIap.swift +47 -12
- package/lib/module/hooks/useIAP.js +31 -21
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +580 -695
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +12 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/purchase.js +22 -0
- package/lib/module/utils/purchase.js.map +1 -0
- package/lib/module/utils.js +43 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/plugin/src/withIAP.d.ts +1 -0
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +4 -5
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +57 -176
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +113 -154
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +99 -76
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/purchase.d.ts +4 -0
- package/lib/typescript/src/utils/purchase.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +8 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -1
- package/nitrogen/generated/android/c++/{JNitroSubscriptionOffer.hpp → JAndroidSubscriptionOfferInput.hpp} +15 -15
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +4 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +16 -16
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +6 -5
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +59 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +2 -1
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +22 -20
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +12 -8
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +2 -2
- package/nitrogen/generated/android/c++/JNitroReceiptValidationAndroidOptions.hpp +10 -10
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +6 -6
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +7 -7
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.cpp +39 -0
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +68 -53
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroSubscriptionOffer.kt → AndroidSubscriptionOfferInput.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +11 -11
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAndroidOptions.kt +4 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +31 -13
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +4 -4
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +99 -64
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -6
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +10 -10
- package/nitrogen/generated/ios/swift/{NitroSubscriptionOffer.swift → AndroidSubscriptionOfferInput.swift} +13 -13
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____.swift +81 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +35 -7
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +7 -14
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +40 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +72 -72
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +8 -8
- package/nitrogen/generated/ios/swift/NitroReceiptValidationAndroidOptions.swift +21 -21
- package/nitrogen/generated/ios/swift/NitroReceiptValidationResultAndroid.swift +37 -11
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +11 -11
- package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +8 -137
- package/nitrogen/generated/shared/c++/{NitroSubscriptionOffer.hpp → AndroidSubscriptionOfferInput.hpp} +15 -15
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +9 -6
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +8 -7
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +24 -22
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +15 -10
- package/nitrogen/generated/shared/c++/NitroReceiptValidationAndroidOptions.hpp +10 -10
- package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +9 -9
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +8 -8
- package/package.json +2 -2
- package/plugin/build/withIAP.d.ts +1 -0
- package/plugin/build/withIAP.js +8 -2
- package/plugin/src/withIAP.ts +13 -3
- package/src/hooks/useIAP.ts +63 -32
- package/src/index.ts +716 -790
- package/src/specs/RnIap.nitro.ts +131 -163
- package/src/types.ts +131 -85
- package/src/utils/purchase.ts +32 -0
- package/src/utils.ts +68 -0
- package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +0 -80
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +0 -42
- package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +0 -47
- package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +0 -18
- package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +0 -78
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AndroidSubscriptionOfferInput` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
|
|
11
13
|
// Forward declaration of `HybridRnIapSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::iap { class HybridRnIapSpec; }
|
|
13
15
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
15
17
|
// Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
|
|
19
|
+
// Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::iap { enum class NitroAvailablePurchasesAndroidType; }
|
|
17
21
|
// Forward declaration of `NitroAvailablePurchasesIosOptions` to properly resolve imports.
|
|
18
22
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesIosOptions; }
|
|
19
23
|
// Forward declaration of `NitroAvailablePurchasesOptions` to properly resolve imports.
|
|
@@ -38,8 +42,6 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
|
|
|
38
42
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
|
|
39
43
|
// Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
|
|
40
44
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseIos; }
|
|
41
|
-
// Forward declaration of `NitroSubscriptionOffer` to properly resolve imports.
|
|
42
|
-
namespace margelo::nitro::iap { struct NitroSubscriptionOffer; }
|
|
43
45
|
// Forward declaration of `NitroSubscriptionRenewalInfo` to properly resolve imports.
|
|
44
46
|
namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
45
47
|
// Forward declaration of `NitroSubscriptionStatus` to properly resolve imports.
|
|
@@ -52,17 +54,17 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
|
|
|
52
54
|
namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
|
|
53
55
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
54
56
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
55
|
-
// Forward declaration of `RequestPurchaseResult` to properly resolve imports.
|
|
56
|
-
namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
57
57
|
|
|
58
58
|
// Forward declarations of Swift defined types
|
|
59
59
|
// Forward declaration of `HybridRnIapSpec_cxx` to properly resolve imports.
|
|
60
60
|
namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
61
61
|
|
|
62
62
|
// Include C++ defined types
|
|
63
|
+
#include "AndroidSubscriptionOfferInput.hpp"
|
|
63
64
|
#include "HybridRnIapSpec.hpp"
|
|
64
65
|
#include "IapPlatform.hpp"
|
|
65
66
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
67
|
+
#include "NitroAvailablePurchasesAndroidType.hpp"
|
|
66
68
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
67
69
|
#include "NitroAvailablePurchasesOptions.hpp"
|
|
68
70
|
#include "NitroFinishTransactionAndroidParams.hpp"
|
|
@@ -75,14 +77,12 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
75
77
|
#include "NitroReceiptValidationResultIOS.hpp"
|
|
76
78
|
#include "NitroRequestPurchaseAndroid.hpp"
|
|
77
79
|
#include "NitroRequestPurchaseIos.hpp"
|
|
78
|
-
#include "NitroSubscriptionOffer.hpp"
|
|
79
80
|
#include "NitroSubscriptionRenewalInfo.hpp"
|
|
80
81
|
#include "NitroSubscriptionStatus.hpp"
|
|
81
82
|
#include "PurchaseAndroid.hpp"
|
|
82
83
|
#include "PurchaseIOS.hpp"
|
|
83
84
|
#include "PurchaseOfferIOS.hpp"
|
|
84
85
|
#include "PurchaseState.hpp"
|
|
85
|
-
#include "RequestPurchaseResult.hpp"
|
|
86
86
|
#include <NitroModules/Promise.hpp>
|
|
87
87
|
#include <NitroModules/PromiseHolder.hpp>
|
|
88
88
|
#include <NitroModules/Result.hpp>
|
|
@@ -317,21 +317,6 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
317
317
|
return std__variant_PurchaseAndroid__PurchaseIOS_(value);
|
|
318
318
|
}
|
|
319
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
320
|
// pragma MARK: std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>
|
|
336
321
|
/**
|
|
337
322
|
* Specialized version of `std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>`.
|
|
@@ -343,53 +328,88 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
343
328
|
return vector;
|
|
344
329
|
}
|
|
345
330
|
|
|
346
|
-
// pragma MARK: std::
|
|
331
|
+
// pragma MARK: std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>
|
|
347
332
|
/**
|
|
348
|
-
*
|
|
333
|
+
* Wrapper struct for `std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>`.
|
|
334
|
+
* std::variant cannot be used in Swift because of a Swift bug.
|
|
335
|
+
* Not even specializing it works. So we create a wrapper struct.
|
|
349
336
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
337
|
+
struct std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ {
|
|
338
|
+
std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>> variant;
|
|
339
|
+
std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>> variant): variant(variant) { }
|
|
340
|
+
operator std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>() const noexcept {
|
|
341
|
+
return variant;
|
|
342
|
+
}
|
|
343
|
+
inline size_t index() const noexcept {
|
|
344
|
+
return variant.index();
|
|
345
|
+
}
|
|
346
|
+
inline PurchaseAndroid get_0() const noexcept {
|
|
347
|
+
return std::get<0>(variant);
|
|
348
|
+
}
|
|
349
|
+
inline PurchaseIOS get_1() const noexcept {
|
|
350
|
+
return std::get<1>(variant);
|
|
351
|
+
}
|
|
352
|
+
inline std::vector<std::variant<PurchaseAndroid, PurchaseIOS>> get_2() const noexcept {
|
|
353
|
+
return std::get<2>(variant);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
inline std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const PurchaseAndroid& value) noexcept {
|
|
357
|
+
return std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(value);
|
|
358
|
+
}
|
|
359
|
+
inline std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const PurchaseIOS& value) noexcept {
|
|
360
|
+
return std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(value);
|
|
361
|
+
}
|
|
362
|
+
inline std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(const std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>& value) noexcept {
|
|
363
|
+
return std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(value);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// pragma MARK: std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>
|
|
367
|
+
/**
|
|
368
|
+
* Specialized version of `std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>`.
|
|
369
|
+
*/
|
|
370
|
+
using std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ = std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>;
|
|
371
|
+
inline std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>> create_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(const std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>& value) noexcept {
|
|
372
|
+
return std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>(value);
|
|
353
373
|
}
|
|
354
|
-
inline bool
|
|
374
|
+
inline bool has_value_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& optional) noexcept {
|
|
355
375
|
return optional.has_value();
|
|
356
376
|
}
|
|
357
|
-
inline std::vector<std::variant<PurchaseAndroid, PurchaseIOS
|
|
377
|
+
inline std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>> get_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& optional) noexcept {
|
|
358
378
|
return *optional;
|
|
359
379
|
}
|
|
360
380
|
|
|
361
|
-
// pragma MARK: std::shared_ptr<Promise<
|
|
381
|
+
// pragma MARK: std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>
|
|
362
382
|
/**
|
|
363
|
-
* Specialized version of `std::shared_ptr<Promise<
|
|
383
|
+
* Specialized version of `std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>`.
|
|
364
384
|
*/
|
|
365
|
-
using
|
|
366
|
-
inline std::shared_ptr<Promise<
|
|
367
|
-
return Promise<
|
|
385
|
+
using std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______ = std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>;
|
|
386
|
+
inline std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> create_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______() noexcept {
|
|
387
|
+
return Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>::create();
|
|
368
388
|
}
|
|
369
|
-
inline PromiseHolder<
|
|
370
|
-
return PromiseHolder<
|
|
389
|
+
inline PromiseHolder<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>> wrap_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______(std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> promise) noexcept {
|
|
390
|
+
return PromiseHolder<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>(std::move(promise));
|
|
371
391
|
}
|
|
372
392
|
|
|
373
|
-
// pragma MARK: std::function<void(const
|
|
393
|
+
// pragma MARK: std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& /* result */)>
|
|
374
394
|
/**
|
|
375
|
-
* Specialized version of `std::function<void(const
|
|
395
|
+
* Specialized version of `std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>&)>`.
|
|
376
396
|
*/
|
|
377
|
-
using
|
|
397
|
+
using Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ = std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& /* result */)>;
|
|
378
398
|
/**
|
|
379
|
-
* Wrapper class for a `std::function<void(const
|
|
399
|
+
* Wrapper class for a `std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& / * result * /)>`, this can be used from Swift.
|
|
380
400
|
*/
|
|
381
|
-
class
|
|
401
|
+
class Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_____Wrapper final {
|
|
382
402
|
public:
|
|
383
|
-
explicit
|
|
384
|
-
inline void call(
|
|
403
|
+
explicit Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_____Wrapper(std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& /* result */)>>(std::move(func))) {}
|
|
404
|
+
inline void call(std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>> result) const noexcept {
|
|
385
405
|
_function->operator()(result);
|
|
386
406
|
}
|
|
387
407
|
private:
|
|
388
|
-
std::unique_ptr<std::function<void(const
|
|
408
|
+
std::unique_ptr<std::function<void(const std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>& /* result */)>> _function;
|
|
389
409
|
} SWIFT_NONCOPYABLE;
|
|
390
|
-
|
|
391
|
-
inline
|
|
392
|
-
return
|
|
410
|
+
Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ create_Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(void* _Nonnull swiftClosureWrapper) noexcept;
|
|
411
|
+
inline Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_____Wrapper wrap_Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ value) noexcept {
|
|
412
|
+
return Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_____Wrapper(std::move(value));
|
|
393
413
|
}
|
|
394
414
|
|
|
395
415
|
// pragma MARK: std::unordered_map<std::string, std::string>
|
|
@@ -447,29 +467,29 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
447
467
|
return *optional;
|
|
448
468
|
}
|
|
449
469
|
|
|
450
|
-
// pragma MARK: std::vector<
|
|
470
|
+
// pragma MARK: std::vector<AndroidSubscriptionOfferInput>
|
|
451
471
|
/**
|
|
452
|
-
* Specialized version of `std::vector<
|
|
472
|
+
* Specialized version of `std::vector<AndroidSubscriptionOfferInput>`.
|
|
453
473
|
*/
|
|
454
|
-
using
|
|
455
|
-
inline std::vector<
|
|
456
|
-
std::vector<
|
|
474
|
+
using std__vector_AndroidSubscriptionOfferInput_ = std::vector<AndroidSubscriptionOfferInput>;
|
|
475
|
+
inline std::vector<AndroidSubscriptionOfferInput> create_std__vector_AndroidSubscriptionOfferInput_(size_t size) noexcept {
|
|
476
|
+
std::vector<AndroidSubscriptionOfferInput> vector;
|
|
457
477
|
vector.reserve(size);
|
|
458
478
|
return vector;
|
|
459
479
|
}
|
|
460
480
|
|
|
461
|
-
// pragma MARK: std::optional<std::vector<
|
|
481
|
+
// pragma MARK: std::optional<std::vector<AndroidSubscriptionOfferInput>>
|
|
462
482
|
/**
|
|
463
|
-
* Specialized version of `std::optional<std::vector<
|
|
483
|
+
* Specialized version of `std::optional<std::vector<AndroidSubscriptionOfferInput>>`.
|
|
464
484
|
*/
|
|
465
|
-
using
|
|
466
|
-
inline std::optional<std::vector<
|
|
467
|
-
return std::optional<std::vector<
|
|
485
|
+
using std__optional_std__vector_AndroidSubscriptionOfferInput__ = std::optional<std::vector<AndroidSubscriptionOfferInput>>;
|
|
486
|
+
inline std::optional<std::vector<AndroidSubscriptionOfferInput>> create_std__optional_std__vector_AndroidSubscriptionOfferInput__(const std::vector<AndroidSubscriptionOfferInput>& value) noexcept {
|
|
487
|
+
return std::optional<std::vector<AndroidSubscriptionOfferInput>>(value);
|
|
468
488
|
}
|
|
469
|
-
inline bool
|
|
489
|
+
inline bool has_value_std__optional_std__vector_AndroidSubscriptionOfferInput__(const std::optional<std::vector<AndroidSubscriptionOfferInput>>& optional) noexcept {
|
|
470
490
|
return optional.has_value();
|
|
471
491
|
}
|
|
472
|
-
inline std::vector<
|
|
492
|
+
inline std::vector<AndroidSubscriptionOfferInput> get_std__optional_std__vector_AndroidSubscriptionOfferInput__(const std::optional<std::vector<AndroidSubscriptionOfferInput>>& optional) noexcept {
|
|
473
493
|
return *optional;
|
|
474
494
|
}
|
|
475
495
|
|
|
@@ -548,6 +568,21 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
548
568
|
return *optional;
|
|
549
569
|
}
|
|
550
570
|
|
|
571
|
+
// pragma MARK: std::optional<NitroAvailablePurchasesAndroidType>
|
|
572
|
+
/**
|
|
573
|
+
* Specialized version of `std::optional<NitroAvailablePurchasesAndroidType>`.
|
|
574
|
+
*/
|
|
575
|
+
using std__optional_NitroAvailablePurchasesAndroidType_ = std::optional<NitroAvailablePurchasesAndroidType>;
|
|
576
|
+
inline std::optional<NitroAvailablePurchasesAndroidType> create_std__optional_NitroAvailablePurchasesAndroidType_(const NitroAvailablePurchasesAndroidType& value) noexcept {
|
|
577
|
+
return std::optional<NitroAvailablePurchasesAndroidType>(value);
|
|
578
|
+
}
|
|
579
|
+
inline bool has_value_std__optional_NitroAvailablePurchasesAndroidType_(const std::optional<NitroAvailablePurchasesAndroidType>& optional) noexcept {
|
|
580
|
+
return optional.has_value();
|
|
581
|
+
}
|
|
582
|
+
inline NitroAvailablePurchasesAndroidType get_std__optional_NitroAvailablePurchasesAndroidType_(const std::optional<NitroAvailablePurchasesAndroidType>& optional) noexcept {
|
|
583
|
+
return *optional;
|
|
584
|
+
}
|
|
585
|
+
|
|
551
586
|
// pragma MARK: std::optional<NitroAvailablePurchasesAndroidOptions>
|
|
552
587
|
/**
|
|
553
588
|
* Specialized version of `std::optional<NitroAvailablePurchasesAndroidOptions>`.
|
|
@@ -1120,13 +1155,13 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
1120
1155
|
return Result<std::shared_ptr<Promise<std::vector<NitroProduct>>>>::withError(error);
|
|
1121
1156
|
}
|
|
1122
1157
|
|
|
1123
|
-
// pragma MARK: Result<std::shared_ptr<Promise<
|
|
1124
|
-
using
|
|
1125
|
-
inline
|
|
1126
|
-
return Result<std::shared_ptr<Promise<
|
|
1158
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>>
|
|
1159
|
+
using Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______ = Result<std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>>;
|
|
1160
|
+
inline Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______ create_Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______(const std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>& value) noexcept {
|
|
1161
|
+
return Result<std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>>::withValue(value);
|
|
1127
1162
|
}
|
|
1128
|
-
inline
|
|
1129
|
-
return Result<std::shared_ptr<Promise<
|
|
1163
|
+
inline Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______ create_Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______(const std::exception_ptr& error) noexcept {
|
|
1164
|
+
return Result<std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>>>::withError(error);
|
|
1130
1165
|
}
|
|
1131
1166
|
|
|
1132
1167
|
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<NitroPurchase>>>>
|
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AndroidSubscriptionOfferInput` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
|
|
11
13
|
// Forward declaration of `HybridRnIapSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::iap { class HybridRnIapSpec; }
|
|
13
15
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
15
17
|
// Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
|
|
19
|
+
// Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::iap { enum class NitroAvailablePurchasesAndroidType; }
|
|
17
21
|
// Forward declaration of `NitroAvailablePurchasesIosOptions` to properly resolve imports.
|
|
18
22
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesIosOptions; }
|
|
19
23
|
// Forward declaration of `NitroAvailablePurchasesOptions` to properly resolve imports.
|
|
@@ -46,8 +50,6 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
|
|
|
46
50
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
|
|
47
51
|
// Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
|
|
48
52
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseIos; }
|
|
49
|
-
// Forward declaration of `NitroSubscriptionOffer` to properly resolve imports.
|
|
50
|
-
namespace margelo::nitro::iap { struct NitroSubscriptionOffer; }
|
|
51
53
|
// Forward declaration of `NitroSubscriptionRenewalInfo` to properly resolve imports.
|
|
52
54
|
namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
53
55
|
// Forward declaration of `NitroSubscriptionStatus` to properly resolve imports.
|
|
@@ -60,13 +62,13 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
|
|
|
60
62
|
namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
|
|
61
63
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
62
64
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
63
|
-
// Forward declaration of `RequestPurchaseResult` to properly resolve imports.
|
|
64
|
-
namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
65
65
|
|
|
66
66
|
// Include C++ defined types
|
|
67
|
+
#include "AndroidSubscriptionOfferInput.hpp"
|
|
67
68
|
#include "HybridRnIapSpec.hpp"
|
|
68
69
|
#include "IapPlatform.hpp"
|
|
69
70
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
71
|
+
#include "NitroAvailablePurchasesAndroidType.hpp"
|
|
70
72
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
71
73
|
#include "NitroAvailablePurchasesOptions.hpp"
|
|
72
74
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
@@ -83,14 +85,12 @@ namespace margelo::nitro::iap { struct RequestPurchaseResult; }
|
|
|
83
85
|
#include "NitroReceiptValidationResultIOS.hpp"
|
|
84
86
|
#include "NitroRequestPurchaseAndroid.hpp"
|
|
85
87
|
#include "NitroRequestPurchaseIos.hpp"
|
|
86
|
-
#include "NitroSubscriptionOffer.hpp"
|
|
87
88
|
#include "NitroSubscriptionRenewalInfo.hpp"
|
|
88
89
|
#include "NitroSubscriptionStatus.hpp"
|
|
89
90
|
#include "PurchaseAndroid.hpp"
|
|
90
91
|
#include "PurchaseIOS.hpp"
|
|
91
92
|
#include "PurchaseOfferIOS.hpp"
|
|
92
93
|
#include "PurchaseState.hpp"
|
|
93
|
-
#include "RequestPurchaseResult.hpp"
|
|
94
94
|
#include <NitroModules/Promise.hpp>
|
|
95
95
|
#include <NitroModules/Result.hpp>
|
|
96
96
|
#include <exception>
|
|
@@ -14,14 +14,12 @@ 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 `
|
|
18
|
-
namespace margelo::nitro::iap {
|
|
17
|
+
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
19
19
|
// Forward declaration of `PurchaseAndroid` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::iap { struct PurchaseAndroid; }
|
|
21
21
|
// Forward declaration of `PurchaseIOS` to properly resolve imports.
|
|
22
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
23
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
26
24
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
27
25
|
// Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
|
|
@@ -32,8 +30,8 @@ namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
|
|
|
32
30
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseIos; }
|
|
33
31
|
// Forward declaration of `NitroRequestPurchaseAndroid` to properly resolve imports.
|
|
34
32
|
namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
|
|
35
|
-
// Forward declaration of `
|
|
36
|
-
namespace margelo::nitro::iap { struct
|
|
33
|
+
// Forward declaration of `AndroidSubscriptionOfferInput` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
|
|
37
35
|
// Forward declaration of `NitroPurchase` to properly resolve imports.
|
|
38
36
|
namespace margelo::nitro::iap { struct NitroPurchase; }
|
|
39
37
|
// Forward declaration of `NitroAvailablePurchasesOptions` to properly resolve imports.
|
|
@@ -42,6 +40,8 @@ namespace margelo::nitro::iap { struct NitroAvailablePurchasesOptions; }
|
|
|
42
40
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesIosOptions; }
|
|
43
41
|
// Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
|
|
44
42
|
namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
|
|
43
|
+
// Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::iap { enum class NitroAvailablePurchasesAndroidType; }
|
|
45
45
|
// Forward declaration of `NitroPurchaseResult` to properly resolve imports.
|
|
46
46
|
namespace margelo::nitro::iap { struct NitroPurchaseResult; }
|
|
47
47
|
// Forward declaration of `NitroFinishTransactionParams` to properly resolve imports.
|
|
@@ -70,22 +70,22 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
70
70
|
#include <vector>
|
|
71
71
|
#include <string>
|
|
72
72
|
#include <optional>
|
|
73
|
-
#include "
|
|
73
|
+
#include "IapPlatform.hpp"
|
|
74
74
|
#include "PurchaseAndroid.hpp"
|
|
75
75
|
#include "PurchaseIOS.hpp"
|
|
76
76
|
#include <variant>
|
|
77
|
-
#include "IapPlatform.hpp"
|
|
78
77
|
#include "PurchaseState.hpp"
|
|
79
78
|
#include "PurchaseOfferIOS.hpp"
|
|
80
79
|
#include "NitroPurchaseRequest.hpp"
|
|
81
80
|
#include "NitroRequestPurchaseIos.hpp"
|
|
82
81
|
#include <unordered_map>
|
|
83
82
|
#include "NitroRequestPurchaseAndroid.hpp"
|
|
84
|
-
#include "
|
|
83
|
+
#include "AndroidSubscriptionOfferInput.hpp"
|
|
85
84
|
#include "NitroPurchase.hpp"
|
|
86
85
|
#include "NitroAvailablePurchasesOptions.hpp"
|
|
87
86
|
#include "NitroAvailablePurchasesIosOptions.hpp"
|
|
88
87
|
#include "NitroAvailablePurchasesAndroidOptions.hpp"
|
|
88
|
+
#include "NitroAvailablePurchasesAndroidType.hpp"
|
|
89
89
|
#include "NitroPurchaseResult.hpp"
|
|
90
90
|
#include "NitroFinishTransactionParams.hpp"
|
|
91
91
|
#include "NitroFinishTransactionIosParams.hpp"
|
|
@@ -164,7 +164,7 @@ namespace margelo::nitro::iap {
|
|
|
164
164
|
auto __value = std::move(__result.value());
|
|
165
165
|
return __value;
|
|
166
166
|
}
|
|
167
|
-
inline std::shared_ptr<Promise<
|
|
167
|
+
inline std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> requestPurchase(const NitroPurchaseRequest& request) override {
|
|
168
168
|
auto __result = _swiftPart.requestPurchase(request);
|
|
169
169
|
if (__result.hasError()) [[unlikely]] {
|
|
170
170
|
std::rethrow_exception(__result.error());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// AndroidSubscriptionOfferInput.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -8,39 +8,39 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Represents an instance of `
|
|
11
|
+
* Represents an instance of `AndroidSubscriptionOfferInput`, backed by a C++ struct.
|
|
12
12
|
*/
|
|
13
|
-
public typealias
|
|
13
|
+
public typealias AndroidSubscriptionOfferInput = margelo.nitro.iap.AndroidSubscriptionOfferInput
|
|
14
14
|
|
|
15
|
-
public extension
|
|
15
|
+
public extension AndroidSubscriptionOfferInput {
|
|
16
16
|
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Create a new instance of `
|
|
19
|
+
* Create a new instance of `AndroidSubscriptionOfferInput`.
|
|
20
20
|
*/
|
|
21
|
-
init(
|
|
22
|
-
self.init(std.string(
|
|
21
|
+
init(offerToken: String, sku: String) {
|
|
22
|
+
self.init(std.string(offerToken), std.string(sku))
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var offerToken: String {
|
|
26
26
|
@inline(__always)
|
|
27
27
|
get {
|
|
28
|
-
return String(self.
|
|
28
|
+
return String(self.__offerToken)
|
|
29
29
|
}
|
|
30
30
|
@inline(__always)
|
|
31
31
|
set {
|
|
32
|
-
self.
|
|
32
|
+
self.__offerToken = std.string(newValue)
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var sku: String {
|
|
37
37
|
@inline(__always)
|
|
38
38
|
get {
|
|
39
|
-
return String(self.
|
|
39
|
+
return String(self.__sku)
|
|
40
40
|
}
|
|
41
41
|
@inline(__always)
|
|
42
42
|
set {
|
|
43
|
-
self.
|
|
43
|
+
self.__sku = std.string(newValue)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____.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_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ {
|
|
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: bridge.std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____) -> Void {
|
|
26
|
+
self.closure({ () -> RequestPurchaseResult? in
|
|
27
|
+
if bridge.has_value_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(value) {
|
|
28
|
+
let __unwrapped = bridge.get_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____(value)
|
|
29
|
+
return { () -> RequestPurchaseResult in
|
|
30
|
+
let __variant = bridge.std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(__unwrapped)
|
|
31
|
+
switch __variant.index() {
|
|
32
|
+
case 0:
|
|
33
|
+
let __actual = __variant.get_0()
|
|
34
|
+
return .first(__actual)
|
|
35
|
+
case 1:
|
|
36
|
+
let __actual = __variant.get_1()
|
|
37
|
+
return .second(__actual)
|
|
38
|
+
case 2:
|
|
39
|
+
let __actual = __variant.get_2()
|
|
40
|
+
return .third(__actual.map({ __item in { () -> Purchase in
|
|
41
|
+
let __variant = bridge.std__variant_PurchaseAndroid__PurchaseIOS_(__item)
|
|
42
|
+
switch __variant.index() {
|
|
43
|
+
case 0:
|
|
44
|
+
let __actual = __variant.get_0()
|
|
45
|
+
return .first(__actual)
|
|
46
|
+
case 1:
|
|
47
|
+
let __actual = __variant.get_1()
|
|
48
|
+
return .second(__actual)
|
|
49
|
+
default:
|
|
50
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
51
|
+
}
|
|
52
|
+
}() }))
|
|
53
|
+
default:
|
|
54
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
55
|
+
}
|
|
56
|
+
}()
|
|
57
|
+
} else {
|
|
58
|
+
return nil
|
|
59
|
+
}
|
|
60
|
+
}())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
65
|
+
* This acquires one additional strong reference on the object!
|
|
66
|
+
*/
|
|
67
|
+
@inline(__always)
|
|
68
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
69
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Casts an unsafe pointer to a `Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____`.
|
|
74
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____>`.
|
|
75
|
+
* This removes one strong reference from the object!
|
|
76
|
+
*/
|
|
77
|
+
@inline(__always)
|
|
78
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ {
|
|
79
|
+
return Unmanaged<Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____>.fromOpaque(pointer).takeRetainedValue()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -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<RequestPurchaseResult
|
|
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,49 @@ 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_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______ {
|
|
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_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______ in
|
|
180
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______()
|
|
181
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS______(__promise)
|
|
182
182
|
__result
|
|
183
|
-
.then({ __result in __promiseHolder.resolve(
|
|
183
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____ in
|
|
184
|
+
if let __unwrappedValue = __result {
|
|
185
|
+
return bridge.create_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ in
|
|
186
|
+
switch __unwrappedValue {
|
|
187
|
+
case .first(let __value):
|
|
188
|
+
return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(__value)
|
|
189
|
+
case .second(let __value):
|
|
190
|
+
return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(__value)
|
|
191
|
+
case .third(let __value):
|
|
192
|
+
return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS___({ () -> bridge.std__vector_std__variant_PurchaseAndroid__PurchaseIOS__ in
|
|
193
|
+
var __vector = bridge.create_std__vector_std__variant_PurchaseAndroid__PurchaseIOS__(__value.count)
|
|
194
|
+
for __item in __value {
|
|
195
|
+
__vector.push_back({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS_ in
|
|
196
|
+
switch __item {
|
|
197
|
+
case .first(let __value):
|
|
198
|
+
return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
|
|
199
|
+
case .second(let __value):
|
|
200
|
+
return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
|
|
201
|
+
}
|
|
202
|
+
}().variant)
|
|
203
|
+
}
|
|
204
|
+
return __vector
|
|
205
|
+
}())
|
|
206
|
+
}
|
|
207
|
+
}().variant)
|
|
208
|
+
} else {
|
|
209
|
+
return .init()
|
|
210
|
+
}
|
|
211
|
+
}()) })
|
|
184
212
|
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
185
213
|
return __promise
|
|
186
214
|
}()
|
|
187
|
-
return bridge.
|
|
215
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______(__resultCpp)
|
|
188
216
|
} catch (let __error) {
|
|
189
217
|
let __exceptionPtr = __error.toCpp()
|
|
190
|
-
return bridge.
|
|
218
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS_______(__exceptionPtr)
|
|
191
219
|
}
|
|
192
220
|
}
|
|
193
221
|
|