react-native-iap 14.4.15 → 14.4.17

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.
Files changed (48) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +55 -0
  2. package/ios/HybridRnIap.swift +17 -0
  3. package/ios/RnIapHelper.swift +45 -0
  4. package/lib/module/index.js +123 -33
  5. package/lib/module/index.js.map +1 -1
  6. package/lib/module/types.js +5 -0
  7. package/lib/module/types.js.map +1 -1
  8. package/lib/typescript/src/index.d.ts +9 -6
  9. package/lib/typescript/src/index.d.ts.map +1 -1
  10. package/lib/typescript/src/specs/RnIap.nitro.d.ts +41 -1
  11. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  12. package/lib/typescript/src/types.d.ts +47 -0
  13. package/lib/typescript/src/types.d.ts.map +1 -1
  14. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +45 -0
  15. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -0
  16. package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +108 -0
  17. package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +90 -0
  18. package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
  19. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +6 -0
  20. package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +94 -0
  21. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +4 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +68 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +56 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +59 -0
  27. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +8 -0
  28. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +93 -0
  29. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +9 -0
  30. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +17 -0
  31. package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroActiveSubscription_.swift +47 -0
  32. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -0
  33. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +32 -0
  34. package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +340 -0
  35. package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +296 -0
  36. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
  37. package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +314 -0
  38. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -0
  39. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -0
  40. package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +122 -0
  41. package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +104 -0
  42. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
  43. package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +108 -0
  44. package/openiap-versions.json +3 -3
  45. package/package.json +1 -1
  46. package/src/index.ts +87 -4
  47. package/src/specs/RnIap.nitro.ts +48 -0
  48. package/src/types.ts +47 -0
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// JRenewalInfoIOS.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "RenewalInfoIOS.hpp"
12
+
13
+ #include <optional>
14
+ #include <string>
15
+
16
+ namespace margelo::nitro::iap {
17
+
18
+ using namespace facebook;
19
+
20
+ /**
21
+ * The C++ JNI bridge between the C++ struct "RenewalInfoIOS" and the the Kotlin data class "RenewalInfoIOS".
22
+ */
23
+ struct JRenewalInfoIOS final: public jni::JavaClass<JRenewalInfoIOS> {
24
+ public:
25
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/RenewalInfoIOS;";
26
+
27
+ public:
28
+ /**
29
+ * Convert this Java/Kotlin-based struct to the C++ struct RenewalInfoIOS by copying all values to C++.
30
+ */
31
+ [[maybe_unused]]
32
+ [[nodiscard]]
33
+ RenewalInfoIOS toCpp() const {
34
+ static const auto clazz = javaClassStatic();
35
+ static const auto fieldAutoRenewPreference = clazz->getField<jni::JString>("autoRenewPreference");
36
+ jni::local_ref<jni::JString> autoRenewPreference = this->getFieldValue(fieldAutoRenewPreference);
37
+ static const auto fieldExpirationReason = clazz->getField<jni::JString>("expirationReason");
38
+ jni::local_ref<jni::JString> expirationReason = this->getFieldValue(fieldExpirationReason);
39
+ static const auto fieldGracePeriodExpirationDate = clazz->getField<jni::JDouble>("gracePeriodExpirationDate");
40
+ jni::local_ref<jni::JDouble> gracePeriodExpirationDate = this->getFieldValue(fieldGracePeriodExpirationDate);
41
+ static const auto fieldIsInBillingRetry = clazz->getField<jni::JBoolean>("isInBillingRetry");
42
+ jni::local_ref<jni::JBoolean> isInBillingRetry = this->getFieldValue(fieldIsInBillingRetry);
43
+ static const auto fieldJsonRepresentation = clazz->getField<jni::JString>("jsonRepresentation");
44
+ jni::local_ref<jni::JString> jsonRepresentation = this->getFieldValue(fieldJsonRepresentation);
45
+ static const auto fieldPendingUpgradeProductId = clazz->getField<jni::JString>("pendingUpgradeProductId");
46
+ jni::local_ref<jni::JString> pendingUpgradeProductId = this->getFieldValue(fieldPendingUpgradeProductId);
47
+ static const auto fieldPriceIncreaseStatus = clazz->getField<jni::JString>("priceIncreaseStatus");
48
+ jni::local_ref<jni::JString> priceIncreaseStatus = this->getFieldValue(fieldPriceIncreaseStatus);
49
+ static const auto fieldRenewalDate = clazz->getField<jni::JDouble>("renewalDate");
50
+ jni::local_ref<jni::JDouble> renewalDate = this->getFieldValue(fieldRenewalDate);
51
+ static const auto fieldRenewalOfferId = clazz->getField<jni::JString>("renewalOfferId");
52
+ jni::local_ref<jni::JString> renewalOfferId = this->getFieldValue(fieldRenewalOfferId);
53
+ static const auto fieldRenewalOfferType = clazz->getField<jni::JString>("renewalOfferType");
54
+ jni::local_ref<jni::JString> renewalOfferType = this->getFieldValue(fieldRenewalOfferType);
55
+ static const auto fieldWillAutoRenew = clazz->getField<jboolean>("willAutoRenew");
56
+ jboolean willAutoRenew = this->getFieldValue(fieldWillAutoRenew);
57
+ return RenewalInfoIOS(
58
+ autoRenewPreference != nullptr ? std::make_optional(autoRenewPreference->toStdString()) : std::nullopt,
59
+ expirationReason != nullptr ? std::make_optional(expirationReason->toStdString()) : std::nullopt,
60
+ gracePeriodExpirationDate != nullptr ? std::make_optional(gracePeriodExpirationDate->value()) : std::nullopt,
61
+ isInBillingRetry != nullptr ? std::make_optional(static_cast<bool>(isInBillingRetry->value())) : std::nullopt,
62
+ jsonRepresentation != nullptr ? std::make_optional(jsonRepresentation->toStdString()) : std::nullopt,
63
+ pendingUpgradeProductId != nullptr ? std::make_optional(pendingUpgradeProductId->toStdString()) : std::nullopt,
64
+ priceIncreaseStatus != nullptr ? std::make_optional(priceIncreaseStatus->toStdString()) : std::nullopt,
65
+ renewalDate != nullptr ? std::make_optional(renewalDate->value()) : std::nullopt,
66
+ renewalOfferId != nullptr ? std::make_optional(renewalOfferId->toStdString()) : std::nullopt,
67
+ renewalOfferType != nullptr ? std::make_optional(renewalOfferType->toStdString()) : std::nullopt,
68
+ static_cast<bool>(willAutoRenew)
69
+ );
70
+ }
71
+
72
+ public:
73
+ /**
74
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
75
+ */
76
+ [[maybe_unused]]
77
+ static jni::local_ref<JRenewalInfoIOS::javaobject> fromCpp(const RenewalInfoIOS& value) {
78
+ return newInstance(
79
+ value.autoRenewPreference.has_value() ? jni::make_jstring(value.autoRenewPreference.value()) : nullptr,
80
+ value.expirationReason.has_value() ? jni::make_jstring(value.expirationReason.value()) : nullptr,
81
+ value.gracePeriodExpirationDate.has_value() ? jni::JDouble::valueOf(value.gracePeriodExpirationDate.value()) : nullptr,
82
+ value.isInBillingRetry.has_value() ? jni::JBoolean::valueOf(value.isInBillingRetry.value()) : nullptr,
83
+ value.jsonRepresentation.has_value() ? jni::make_jstring(value.jsonRepresentation.value()) : nullptr,
84
+ value.pendingUpgradeProductId.has_value() ? jni::make_jstring(value.pendingUpgradeProductId.value()) : nullptr,
85
+ value.priceIncreaseStatus.has_value() ? jni::make_jstring(value.priceIncreaseStatus.value()) : nullptr,
86
+ value.renewalDate.has_value() ? jni::JDouble::valueOf(value.renewalDate.value()) : nullptr,
87
+ value.renewalOfferId.has_value() ? jni::make_jstring(value.renewalOfferId.value()) : nullptr,
88
+ value.renewalOfferType.has_value() ? jni::make_jstring(value.renewalOfferType.value()) : nullptr,
89
+ value.willAutoRenew
90
+ );
91
+ }
92
+ };
93
+
94
+ } // namespace margelo::nitro::iap
@@ -24,6 +24,8 @@
24
24
  #include "JPurchaseIOS.hpp"
25
25
  #include "PurchaseOfferIOS.hpp"
26
26
  #include "JPurchaseOfferIOS.hpp"
27
+ #include "RenewalInfoIOS.hpp"
28
+ #include "JRenewalInfoIOS.hpp"
27
29
  #include "JPurchase.hpp"
28
30
 
29
31
  namespace margelo::nitro::iap {
@@ -60,6 +60,10 @@ abstract class HybridRnIapSpec: HybridObject() {
60
60
  @Keep
61
61
  abstract fun getAvailablePurchases(options: NitroAvailablePurchasesOptions?): Promise<Array<NitroPurchase>>
62
62
 
63
+ @DoNotStrip
64
+ @Keep
65
+ abstract fun getActiveSubscriptions(subscriptionIds: Array<String>?): Promise<Array<NitroActiveSubscription>>
66
+
63
67
  @DoNotStrip
64
68
  @Keep
65
69
  abstract fun finishTransaction(params: NitroFinishTransactionParams): Promise<Variant_Boolean_NitroPurchaseResult>
@@ -0,0 +1,68 @@
1
+ ///
2
+ /// NitroActiveSubscription.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 "NitroActiveSubscription".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NitroActiveSubscription
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val productId: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val isActive: Boolean,
30
+ @DoNotStrip
31
+ @Keep
32
+ val transactionId: String,
33
+ @DoNotStrip
34
+ @Keep
35
+ val purchaseToken: String?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val transactionDate: Double,
39
+ @DoNotStrip
40
+ @Keep
41
+ val expirationDateIOS: Double?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val environmentIOS: String?,
45
+ @DoNotStrip
46
+ @Keep
47
+ val willExpireSoon: Boolean?,
48
+ @DoNotStrip
49
+ @Keep
50
+ val daysUntilExpirationIOS: Double?,
51
+ @DoNotStrip
52
+ @Keep
53
+ val renewalInfoIOS: NitroRenewalInfoIOS?,
54
+ @DoNotStrip
55
+ @Keep
56
+ val autoRenewingAndroid: Boolean?,
57
+ @DoNotStrip
58
+ @Keep
59
+ val basePlanIdAndroid: String?,
60
+ @DoNotStrip
61
+ @Keep
62
+ val currentPlanId: String?,
63
+ @DoNotStrip
64
+ @Keep
65
+ val purchaseTokenAndroid: String?
66
+ ) {
67
+ /* main constructor */
68
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// NitroRenewalInfoIOS.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 "NitroRenewalInfoIOS".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NitroRenewalInfoIOS
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val willAutoRenew: Boolean?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val autoRenewPreference: String?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val pendingUpgradeProductId: String?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val renewalDate: Double?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val expirationReason: String?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val isInBillingRetry: Boolean?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val gracePeriodExpirationDate: Double?,
45
+ @DoNotStrip
46
+ @Keep
47
+ val priceIncreaseStatus: String?,
48
+ @DoNotStrip
49
+ @Keep
50
+ val offerType: String?,
51
+ @DoNotStrip
52
+ @Keep
53
+ val offerIdentifier: String?
54
+ ) {
55
+ /* main constructor */
56
+ }
@@ -95,6 +95,9 @@ data class PurchaseIOS
95
95
  val reasonStringRepresentationIOS: String?,
96
96
  @DoNotStrip
97
97
  @Keep
98
+ val renewalInfoIOS: RenewalInfoIOS?,
99
+ @DoNotStrip
100
+ @Keep
98
101
  val revocationDateIOS: Double?,
99
102
  @DoNotStrip
100
103
  @Keep
@@ -0,0 +1,59 @@
1
+ ///
2
+ /// RenewalInfoIOS.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 "RenewalInfoIOS".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class RenewalInfoIOS
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val autoRenewPreference: String?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val expirationReason: String?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val gracePeriodExpirationDate: Double?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val isInBillingRetry: Boolean?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val jsonRepresentation: String?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val pendingUpgradeProductId: String?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val priceIncreaseStatus: String?,
45
+ @DoNotStrip
46
+ @Keep
47
+ val renewalDate: Double?,
48
+ @DoNotStrip
49
+ @Keep
50
+ val renewalOfferId: String?,
51
+ @DoNotStrip
52
+ @Keep
53
+ val renewalOfferType: String?,
54
+ @DoNotStrip
55
+ @Keep
56
+ val willAutoRenew: Boolean
57
+ ) {
58
+ /* main constructor */
59
+ }
@@ -53,6 +53,14 @@ namespace margelo::nitro::iap::bridge::swift {
53
53
  };
54
54
  }
55
55
 
56
+ // pragma MARK: std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>
57
+ Func_void_std__vector_NitroActiveSubscription_ create_Func_void_std__vector_NitroActiveSubscription_(void* _Nonnull swiftClosureWrapper) noexcept {
58
+ auto swiftClosure = NitroIap::Func_void_std__vector_NitroActiveSubscription_::fromUnsafe(swiftClosureWrapper);
59
+ return [swiftClosure = std::move(swiftClosure)](const std::vector<NitroActiveSubscription>& result) mutable -> void {
60
+ swiftClosure.call(result);
61
+ };
62
+ }
63
+
56
64
  // pragma MARK: std::function<void(const std::variant<bool, NitroPurchaseResult>& /* result */)>
57
65
  Func_void_std__variant_bool__NitroPurchaseResult_ create_Func_void_std__variant_bool__NitroPurchaseResult_(void* _Nonnull swiftClosureWrapper) noexcept {
58
66
  auto swiftClosure = NitroIap::Func_void_std__variant_bool__NitroPurchaseResult_::fromUnsafe(swiftClosureWrapper);
@@ -24,6 +24,8 @@ namespace margelo::nitro::iap { class HybridRnIapSpec; }
24
24
  namespace margelo::nitro::iap { enum class IapPlatform; }
25
25
  // Forward declaration of `InitConnectionConfig` to properly resolve imports.
26
26
  namespace margelo::nitro::iap { struct InitConnectionConfig; }
27
+ // Forward declaration of `NitroActiveSubscription` to properly resolve imports.
28
+ namespace margelo::nitro::iap { struct NitroActiveSubscription; }
27
29
  // Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
28
30
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
29
31
  // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
@@ -50,6 +52,8 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationAndroidOptions; }
50
52
  namespace margelo::nitro::iap { struct NitroReceiptValidationResultAndroid; }
51
53
  // Forward declaration of `NitroReceiptValidationResultIOS` to properly resolve imports.
52
54
  namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
55
+ // Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
56
+ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
53
57
  // Forward declaration of `NitroRequestPurchaseAndroid` to properly resolve imports.
54
58
  namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
55
59
  // Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
@@ -66,6 +70,8 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
66
70
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
67
71
  // Forward declaration of `PurchaseState` to properly resolve imports.
68
72
  namespace margelo::nitro::iap { enum class PurchaseState; }
73
+ // Forward declaration of `RenewalInfoIOS` to properly resolve imports.
74
+ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
69
75
  // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
70
76
  namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
71
77
 
@@ -82,6 +88,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
82
88
  #include "HybridRnIapSpec.hpp"
83
89
  #include "IapPlatform.hpp"
84
90
  #include "InitConnectionConfig.hpp"
91
+ #include "NitroActiveSubscription.hpp"
85
92
  #include "NitroAvailablePurchasesAndroidOptions.hpp"
86
93
  #include "NitroAvailablePurchasesAndroidType.hpp"
87
94
  #include "NitroAvailablePurchasesIosOptions.hpp"
@@ -95,6 +102,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
95
102
  #include "NitroReceiptValidationAndroidOptions.hpp"
96
103
  #include "NitroReceiptValidationResultAndroid.hpp"
97
104
  #include "NitroReceiptValidationResultIOS.hpp"
105
+ #include "NitroRenewalInfoIOS.hpp"
98
106
  #include "NitroRequestPurchaseAndroid.hpp"
99
107
  #include "NitroRequestPurchaseIos.hpp"
100
108
  #include "NitroSubscriptionRenewalInfo.hpp"
@@ -103,6 +111,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
103
111
  #include "PurchaseIOS.hpp"
104
112
  #include "PurchaseOfferIOS.hpp"
105
113
  #include "PurchaseState.hpp"
114
+ #include "RenewalInfoIOS.hpp"
106
115
  #include "UserChoiceBillingDetails.hpp"
107
116
  #include <NitroModules/Promise.hpp>
108
117
  #include <NitroModules/PromiseHolder.hpp>
@@ -354,6 +363,21 @@ namespace margelo::nitro::iap::bridge::swift {
354
363
  return *optional;
355
364
  }
356
365
 
366
+ // pragma MARK: std::optional<RenewalInfoIOS>
367
+ /**
368
+ * Specialized version of `std::optional<RenewalInfoIOS>`.
369
+ */
370
+ using std__optional_RenewalInfoIOS_ = std::optional<RenewalInfoIOS>;
371
+ inline std::optional<RenewalInfoIOS> create_std__optional_RenewalInfoIOS_(const RenewalInfoIOS& value) noexcept {
372
+ return std::optional<RenewalInfoIOS>(value);
373
+ }
374
+ inline bool has_value_std__optional_RenewalInfoIOS_(const std::optional<RenewalInfoIOS>& optional) noexcept {
375
+ return optional.has_value();
376
+ }
377
+ inline RenewalInfoIOS get_std__optional_RenewalInfoIOS_(const std::optional<RenewalInfoIOS>& optional) noexcept {
378
+ return *optional;
379
+ }
380
+
357
381
  // pragma MARK: std::variant<PurchaseAndroid, PurchaseIOS>
358
382
  /**
359
383
  * Wrapper struct for `std::variant<PurchaseAndroid, PurchaseIOS>`.
@@ -679,6 +703,66 @@ namespace margelo::nitro::iap::bridge::swift {
679
703
  return *optional;
680
704
  }
681
705
 
706
+ // pragma MARK: std::optional<NitroRenewalInfoIOS>
707
+ /**
708
+ * Specialized version of `std::optional<NitroRenewalInfoIOS>`.
709
+ */
710
+ using std__optional_NitroRenewalInfoIOS_ = std::optional<NitroRenewalInfoIOS>;
711
+ inline std::optional<NitroRenewalInfoIOS> create_std__optional_NitroRenewalInfoIOS_(const NitroRenewalInfoIOS& value) noexcept {
712
+ return std::optional<NitroRenewalInfoIOS>(value);
713
+ }
714
+ inline bool has_value_std__optional_NitroRenewalInfoIOS_(const std::optional<NitroRenewalInfoIOS>& optional) noexcept {
715
+ return optional.has_value();
716
+ }
717
+ inline NitroRenewalInfoIOS get_std__optional_NitroRenewalInfoIOS_(const std::optional<NitroRenewalInfoIOS>& optional) noexcept {
718
+ return *optional;
719
+ }
720
+
721
+ // pragma MARK: std::vector<NitroActiveSubscription>
722
+ /**
723
+ * Specialized version of `std::vector<NitroActiveSubscription>`.
724
+ */
725
+ using std__vector_NitroActiveSubscription_ = std::vector<NitroActiveSubscription>;
726
+ inline std::vector<NitroActiveSubscription> create_std__vector_NitroActiveSubscription_(size_t size) noexcept {
727
+ std::vector<NitroActiveSubscription> vector;
728
+ vector.reserve(size);
729
+ return vector;
730
+ }
731
+
732
+ // pragma MARK: std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>
733
+ /**
734
+ * Specialized version of `std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>`.
735
+ */
736
+ using std__shared_ptr_Promise_std__vector_NitroActiveSubscription___ = std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>;
737
+ inline std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>> create_std__shared_ptr_Promise_std__vector_NitroActiveSubscription___() noexcept {
738
+ return Promise<std::vector<NitroActiveSubscription>>::create();
739
+ }
740
+ inline PromiseHolder<std::vector<NitroActiveSubscription>> wrap_std__shared_ptr_Promise_std__vector_NitroActiveSubscription___(std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>> promise) noexcept {
741
+ return PromiseHolder<std::vector<NitroActiveSubscription>>(std::move(promise));
742
+ }
743
+
744
+ // pragma MARK: std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>
745
+ /**
746
+ * Specialized version of `std::function<void(const std::vector<NitroActiveSubscription>&)>`.
747
+ */
748
+ using Func_void_std__vector_NitroActiveSubscription_ = std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>;
749
+ /**
750
+ * Wrapper class for a `std::function<void(const std::vector<NitroActiveSubscription>& / * result * /)>`, this can be used from Swift.
751
+ */
752
+ class Func_void_std__vector_NitroActiveSubscription__Wrapper final {
753
+ public:
754
+ explicit Func_void_std__vector_NitroActiveSubscription__Wrapper(std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>>(std::move(func))) {}
755
+ inline void call(std::vector<NitroActiveSubscription> result) const noexcept {
756
+ _function->operator()(result);
757
+ }
758
+ private:
759
+ std::unique_ptr<std::function<void(const std::vector<NitroActiveSubscription>& /* result */)>> _function;
760
+ } SWIFT_NONCOPYABLE;
761
+ Func_void_std__vector_NitroActiveSubscription_ create_Func_void_std__vector_NitroActiveSubscription_(void* _Nonnull swiftClosureWrapper) noexcept;
762
+ inline Func_void_std__vector_NitroActiveSubscription__Wrapper wrap_Func_void_std__vector_NitroActiveSubscription_(Func_void_std__vector_NitroActiveSubscription_ value) noexcept {
763
+ return Func_void_std__vector_NitroActiveSubscription__Wrapper(std::move(value));
764
+ }
765
+
682
766
  // pragma MARK: std::variant<bool, NitroPurchaseResult>
683
767
  /**
684
768
  * Wrapper struct for `std::variant<bool, NitroPurchaseResult>`.
@@ -1329,6 +1413,15 @@ namespace margelo::nitro::iap::bridge::swift {
1329
1413
  return Result<std::shared_ptr<Promise<std::vector<NitroPurchase>>>>::withError(error);
1330
1414
  }
1331
1415
 
1416
+ // pragma MARK: Result<std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>>
1417
+ using Result_std__shared_ptr_Promise_std__vector_NitroActiveSubscription____ = Result<std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>>;
1418
+ inline Result_std__shared_ptr_Promise_std__vector_NitroActiveSubscription____ create_Result_std__shared_ptr_Promise_std__vector_NitroActiveSubscription____(const std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>& value) noexcept {
1419
+ return Result<std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>>::withValue(value);
1420
+ }
1421
+ inline Result_std__shared_ptr_Promise_std__vector_NitroActiveSubscription____ create_Result_std__shared_ptr_Promise_std__vector_NitroActiveSubscription____(const std::exception_ptr& error) noexcept {
1422
+ return Result<std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>>>::withError(error);
1423
+ }
1424
+
1332
1425
  // pragma MARK: Result<std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>>>
1333
1426
  using Result_std__shared_ptr_Promise_std__variant_bool__NitroPurchaseResult____ = Result<std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>>>;
1334
1427
  inline Result_std__shared_ptr_Promise_std__variant_bool__NitroPurchaseResult____ create_Result_std__shared_ptr_Promise_std__variant_bool__NitroPurchaseResult____(const std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>>& value) noexcept {
@@ -24,6 +24,8 @@ namespace margelo::nitro::iap { class HybridRnIapSpec; }
24
24
  namespace margelo::nitro::iap { enum class IapPlatform; }
25
25
  // Forward declaration of `InitConnectionConfig` to properly resolve imports.
26
26
  namespace margelo::nitro::iap { struct InitConnectionConfig; }
27
+ // Forward declaration of `NitroActiveSubscription` to properly resolve imports.
28
+ namespace margelo::nitro::iap { struct NitroActiveSubscription; }
27
29
  // Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
28
30
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
29
31
  // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
@@ -58,6 +60,8 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationParams; }
58
60
  namespace margelo::nitro::iap { struct NitroReceiptValidationResultAndroid; }
59
61
  // Forward declaration of `NitroReceiptValidationResultIOS` to properly resolve imports.
60
62
  namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
63
+ // Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
64
+ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
61
65
  // Forward declaration of `NitroRequestPurchaseAndroid` to properly resolve imports.
62
66
  namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
63
67
  // Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
@@ -74,6 +78,8 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
74
78
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
75
79
  // Forward declaration of `PurchaseState` to properly resolve imports.
76
80
  namespace margelo::nitro::iap { enum class PurchaseState; }
81
+ // Forward declaration of `RenewalInfoIOS` to properly resolve imports.
82
+ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
77
83
  // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
78
84
  namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
79
85
 
@@ -86,6 +92,7 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
86
92
  #include "HybridRnIapSpec.hpp"
87
93
  #include "IapPlatform.hpp"
88
94
  #include "InitConnectionConfig.hpp"
95
+ #include "NitroActiveSubscription.hpp"
89
96
  #include "NitroAvailablePurchasesAndroidOptions.hpp"
90
97
  #include "NitroAvailablePurchasesAndroidType.hpp"
91
98
  #include "NitroAvailablePurchasesIosOptions.hpp"
@@ -103,6 +110,7 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
103
110
  #include "NitroReceiptValidationParams.hpp"
104
111
  #include "NitroReceiptValidationResultAndroid.hpp"
105
112
  #include "NitroReceiptValidationResultIOS.hpp"
113
+ #include "NitroRenewalInfoIOS.hpp"
106
114
  #include "NitroRequestPurchaseAndroid.hpp"
107
115
  #include "NitroRequestPurchaseIos.hpp"
108
116
  #include "NitroSubscriptionRenewalInfo.hpp"
@@ -111,6 +119,7 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
111
119
  #include "PurchaseIOS.hpp"
112
120
  #include "PurchaseOfferIOS.hpp"
113
121
  #include "PurchaseState.hpp"
122
+ #include "RenewalInfoIOS.hpp"
114
123
  #include "UserChoiceBillingDetails.hpp"
115
124
  #include <NitroModules/Promise.hpp>
116
125
  #include <NitroModules/Result.hpp>
@@ -30,6 +30,8 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
30
30
  namespace margelo::nitro::iap { enum class PurchaseState; }
31
31
  // Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
32
32
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
33
+ // Forward declaration of `RenewalInfoIOS` to properly resolve imports.
34
+ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
33
35
  // Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
34
36
  namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
35
37
  // Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
@@ -48,6 +50,10 @@ namespace margelo::nitro::iap { struct NitroAvailablePurchasesIosOptions; }
48
50
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
49
51
  // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
50
52
  namespace margelo::nitro::iap { enum class NitroAvailablePurchasesAndroidType; }
53
+ // Forward declaration of `NitroActiveSubscription` to properly resolve imports.
54
+ namespace margelo::nitro::iap { struct NitroActiveSubscription; }
55
+ // Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
56
+ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
51
57
  // Forward declaration of `NitroPurchaseResult` to properly resolve imports.
52
58
  namespace margelo::nitro::iap { struct NitroPurchaseResult; }
53
59
  // Forward declaration of `NitroFinishTransactionParams` to properly resolve imports.
@@ -93,6 +99,7 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
93
99
  #include <variant>
94
100
  #include "PurchaseState.hpp"
95
101
  #include "PurchaseOfferIOS.hpp"
102
+ #include "RenewalInfoIOS.hpp"
96
103
  #include "NitroPurchaseRequest.hpp"
97
104
  #include "NitroRequestPurchaseIos.hpp"
98
105
  #include <unordered_map>
@@ -103,6 +110,8 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
103
110
  #include "NitroAvailablePurchasesIosOptions.hpp"
104
111
  #include "NitroAvailablePurchasesAndroidOptions.hpp"
105
112
  #include "NitroAvailablePurchasesAndroidType.hpp"
113
+ #include "NitroActiveSubscription.hpp"
114
+ #include "NitroRenewalInfoIOS.hpp"
106
115
  #include "NitroPurchaseResult.hpp"
107
116
  #include "NitroFinishTransactionParams.hpp"
108
117
  #include "NitroFinishTransactionIosParams.hpp"
@@ -201,6 +210,14 @@ namespace margelo::nitro::iap {
201
210
  auto __value = std::move(__result.value());
202
211
  return __value;
203
212
  }
213
+ inline std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>> getActiveSubscriptions(const std::optional<std::vector<std::string>>& subscriptionIds) override {
214
+ auto __result = _swiftPart.getActiveSubscriptions(subscriptionIds);
215
+ if (__result.hasError()) [[unlikely]] {
216
+ std::rethrow_exception(__result.error());
217
+ }
218
+ auto __value = std::move(__result.value());
219
+ return __value;
220
+ }
204
221
  inline std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>> finishTransaction(const NitroFinishTransactionParams& params) override {
205
222
  auto __result = _swiftPart.finishTransaction(params);
206
223
  if (__result.hasError()) [[unlikely]] {
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__vector_NitroActiveSubscription_.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: [NitroActiveSubscription]) -> 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__vector_NitroActiveSubscription_ {
16
+ public typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ private let closure: (_ value: [NitroActiveSubscription]) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: [NitroActiveSubscription]) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: bridge.std__vector_NitroActiveSubscription_) -> Void {
26
+ self.closure(value.map({ __item in __item }))
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_std__vector_NitroActiveSubscription_`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_NitroActiveSubscription_>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_NitroActiveSubscription_ {
45
+ return Unmanaged<Func_void_std__vector_NitroActiveSubscription_>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -19,6 +19,7 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
19
19
  func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
20
20
  func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<RequestPurchaseResult?>
21
21
  func getAvailablePurchases(options: NitroAvailablePurchasesOptions?) throws -> Promise<[NitroPurchase]>
22
+ func getActiveSubscriptions(subscriptionIds: [String]?) throws -> Promise<[NitroActiveSubscription]>
22
23
  func finishTransaction(params: NitroFinishTransactionParams) throws -> Promise<Variant_Bool_NitroPurchaseResult>
23
24
  func addPurchaseUpdatedListener(listener: @escaping (_ purchase: NitroPurchase) -> Void) throws -> Void
24
25
  func addPurchaseErrorListener(listener: @escaping (_ error: NitroPurchaseResult) -> Void) throws -> Void