react-native-iap 14.6.3 → 14.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +40 -0
- package/ios/HybridRnIap.swift +11 -3
- package/lib/module/index.js +78 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +26 -2
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -18
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +35 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +72 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +3 -0
- package/nitrogen/generated/android/c++/JDeveloperProvidedBillingDetailsAndroid.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_DeveloperProvidedBillingDetailsAndroid.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +13 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingDetailsAndroid.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_DeveloperProvidedBillingDetailsAndroid.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +18 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +6 -3
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +40 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +18 -3
- package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +4 -0
- package/nitrogen/generated/ios/swift/DeveloperProvidedBillingDetailsAndroid.swift +35 -0
- package/nitrogen/generated/ios/swift/Func_void_DeveloperProvidedBillingDetailsAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +32 -0
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +24 -1
- package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +4 -0
- package/nitrogen/generated/shared/c++/DeveloperProvidedBillingDetailsAndroid.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +9 -2
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +105 -34
- package/src/specs/RnIap.nitro.ts +49 -2
- package/src/types.ts +76 -4
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
#include "InitConnectionConfig.hpp"
|
|
12
12
|
|
|
13
13
|
#include "AlternativeBillingModeAndroid.hpp"
|
|
14
|
+
#include "BillingProgramAndroid.hpp"
|
|
14
15
|
#include "JAlternativeBillingModeAndroid.hpp"
|
|
16
|
+
#include "JBillingProgramAndroid.hpp"
|
|
15
17
|
#include <optional>
|
|
16
18
|
|
|
17
19
|
namespace margelo::nitro::iap {
|
|
@@ -35,8 +37,11 @@ namespace margelo::nitro::iap {
|
|
|
35
37
|
static const auto clazz = javaClassStatic();
|
|
36
38
|
static const auto fieldAlternativeBillingModeAndroid = clazz->getField<JAlternativeBillingModeAndroid>("alternativeBillingModeAndroid");
|
|
37
39
|
jni::local_ref<JAlternativeBillingModeAndroid> alternativeBillingModeAndroid = this->getFieldValue(fieldAlternativeBillingModeAndroid);
|
|
40
|
+
static const auto fieldEnableBillingProgramAndroid = clazz->getField<JBillingProgramAndroid>("enableBillingProgramAndroid");
|
|
41
|
+
jni::local_ref<JBillingProgramAndroid> enableBillingProgramAndroid = this->getFieldValue(fieldEnableBillingProgramAndroid);
|
|
38
42
|
return InitConnectionConfig(
|
|
39
|
-
alternativeBillingModeAndroid != nullptr ? std::make_optional(alternativeBillingModeAndroid->toCpp()) : std::nullopt
|
|
43
|
+
alternativeBillingModeAndroid != nullptr ? std::make_optional(alternativeBillingModeAndroid->toCpp()) : std::nullopt,
|
|
44
|
+
enableBillingProgramAndroid != nullptr ? std::make_optional(enableBillingProgramAndroid->toCpp()) : std::nullopt
|
|
40
45
|
);
|
|
41
46
|
}
|
|
42
47
|
|
|
@@ -46,12 +51,13 @@ namespace margelo::nitro::iap {
|
|
|
46
51
|
*/
|
|
47
52
|
[[maybe_unused]]
|
|
48
53
|
static jni::local_ref<JInitConnectionConfig::javaobject> fromCpp(const InitConnectionConfig& value) {
|
|
49
|
-
using JSignature = JInitConnectionConfig(jni::alias_ref<JAlternativeBillingModeAndroid>);
|
|
54
|
+
using JSignature = JInitConnectionConfig(jni::alias_ref<JAlternativeBillingModeAndroid>, jni::alias_ref<JBillingProgramAndroid>);
|
|
50
55
|
static const auto clazz = javaClassStatic();
|
|
51
56
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
52
57
|
return create(
|
|
53
58
|
clazz,
|
|
54
|
-
value.alternativeBillingModeAndroid.has_value() ? JAlternativeBillingModeAndroid::fromCpp(value.alternativeBillingModeAndroid.value()) : nullptr
|
|
59
|
+
value.alternativeBillingModeAndroid.has_value() ? JAlternativeBillingModeAndroid::fromCpp(value.alternativeBillingModeAndroid.value()) : nullptr,
|
|
60
|
+
value.enableBillingProgramAndroid.has_value() ? JBillingProgramAndroid::fromCpp(value.enableBillingProgramAndroid.value()) : nullptr
|
|
55
61
|
);
|
|
56
62
|
}
|
|
57
63
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DeveloperProvidedBillingDetailsAndroid.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "DeveloperProvidedBillingDetailsAndroid".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class DeveloperProvidedBillingDetailsAndroid(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val externalTransactionToken: String
|
|
23
|
+
) {
|
|
24
|
+
private companion object {
|
|
25
|
+
/**
|
|
26
|
+
* Constructor called from C++
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
@Suppress("unused")
|
|
31
|
+
@JvmStatic
|
|
32
|
+
private fun fromCpp(externalTransactionToken: String): DeveloperProvidedBillingDetailsAndroid {
|
|
33
|
+
return DeveloperProvidedBillingDetailsAndroid(externalTransactionToken)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_DeveloperProvidedBillingDetailsAndroid.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.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_DeveloperProvidedBillingDetailsAndroid: (DeveloperProvidedBillingDetailsAndroid) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(details: DeveloperProvidedBillingDetailsAndroid): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_DeveloperProvidedBillingDetailsAndroid_cxx: Func_void_DeveloperProvidedBillingDetailsAndroid {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(details: DeveloperProvidedBillingDetailsAndroid): Unit
|
|
60
|
+
= invoke_cxx(details)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(details: DeveloperProvidedBillingDetailsAndroid): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(DeveloperProvidedBillingDetailsAndroid) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_DeveloperProvidedBillingDetailsAndroid_java(private val function: (DeveloperProvidedBillingDetailsAndroid) -> Unit): Func_void_DeveloperProvidedBillingDetailsAndroid {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(details: DeveloperProvidedBillingDetailsAndroid): Unit {
|
|
78
|
+
return this.function(details)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -257,6 +257,24 @@ abstract class HybridRnIapSpec: HybridObject() {
|
|
|
257
257
|
return __result
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
abstract fun addDeveloperProvidedBillingListenerAndroid(listener: (details: DeveloperProvidedBillingDetailsAndroid) -> Unit): Unit
|
|
261
|
+
|
|
262
|
+
@DoNotStrip
|
|
263
|
+
@Keep
|
|
264
|
+
private fun addDeveloperProvidedBillingListenerAndroid_cxx(listener: Func_void_DeveloperProvidedBillingDetailsAndroid): Unit {
|
|
265
|
+
val __result = addDeveloperProvidedBillingListenerAndroid(listener)
|
|
266
|
+
return __result
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
abstract fun removeDeveloperProvidedBillingListenerAndroid(listener: (details: DeveloperProvidedBillingDetailsAndroid) -> Unit): Unit
|
|
270
|
+
|
|
271
|
+
@DoNotStrip
|
|
272
|
+
@Keep
|
|
273
|
+
private fun removeDeveloperProvidedBillingListenerAndroid_cxx(listener: Func_void_DeveloperProvidedBillingDetailsAndroid): Unit {
|
|
274
|
+
val __result = removeDeveloperProvidedBillingListenerAndroid(listener)
|
|
275
|
+
return __result
|
|
276
|
+
}
|
|
277
|
+
|
|
260
278
|
@DoNotStrip
|
|
261
279
|
@Keep
|
|
262
280
|
abstract fun enableBillingProgramAndroid(program: BillingProgramAndroid): Unit
|
|
@@ -19,7 +19,10 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
19
19
|
data class InitConnectionConfig(
|
|
20
20
|
@DoNotStrip
|
|
21
21
|
@Keep
|
|
22
|
-
val alternativeBillingModeAndroid: AlternativeBillingModeAndroid
|
|
22
|
+
val alternativeBillingModeAndroid: AlternativeBillingModeAndroid?,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val enableBillingProgramAndroid: BillingProgramAndroid?
|
|
23
26
|
) {
|
|
24
27
|
private companion object {
|
|
25
28
|
/**
|
|
@@ -29,8 +32,8 @@ data class InitConnectionConfig(
|
|
|
29
32
|
@Keep
|
|
30
33
|
@Suppress("unused")
|
|
31
34
|
@JvmStatic
|
|
32
|
-
private fun fromCpp(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?): InitConnectionConfig {
|
|
33
|
-
return InitConnectionConfig(alternativeBillingModeAndroid)
|
|
35
|
+
private fun fromCpp(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?, enableBillingProgramAndroid: BillingProgramAndroid?): InitConnectionConfig {
|
|
36
|
+
return InitConnectionConfig(alternativeBillingModeAndroid, enableBillingProgramAndroid)
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -165,6 +165,14 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// pragma MARK: std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>
|
|
169
|
+
Func_void_DeveloperProvidedBillingDetailsAndroid create_Func_void_DeveloperProvidedBillingDetailsAndroid(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
170
|
+
auto swiftClosure = NitroIap::Func_void_DeveloperProvidedBillingDetailsAndroid::fromUnsafe(swiftClosureWrapper);
|
|
171
|
+
return [swiftClosure = std::move(swiftClosure)](const DeveloperProvidedBillingDetailsAndroid& details) mutable -> void {
|
|
172
|
+
swiftClosure.call(details);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
168
176
|
// pragma MARK: std::function<void(const NitroBillingProgramAvailabilityResultAndroid& /* result */)>
|
|
169
177
|
Func_void_NitroBillingProgramAvailabilityResultAndroid create_Func_void_NitroBillingProgramAvailabilityResultAndroid(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
170
178
|
auto swiftClosure = NitroIap::Func_void_NitroBillingProgramAvailabilityResultAndroid::fromUnsafe(swiftClosureWrapper);
|
|
@@ -14,6 +14,8 @@ namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
|
|
|
14
14
|
namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
|
|
15
15
|
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
17
|
+
// Forward declaration of `DeveloperProvidedBillingDetailsAndroid` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::iap { struct DeveloperProvidedBillingDetailsAndroid; }
|
|
17
19
|
// Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
|
|
18
20
|
namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
19
21
|
// Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
|
|
@@ -125,6 +127,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
125
127
|
#include "AlternativeBillingModeAndroid.hpp"
|
|
126
128
|
#include "AndroidSubscriptionOfferInput.hpp"
|
|
127
129
|
#include "BillingProgramAndroid.hpp"
|
|
130
|
+
#include "DeveloperProvidedBillingDetailsAndroid.hpp"
|
|
128
131
|
#include "ExternalPurchaseLinkResultIOS.hpp"
|
|
129
132
|
#include "ExternalPurchaseNoticeAction.hpp"
|
|
130
133
|
#include "ExternalPurchaseNoticeResultIOS.hpp"
|
|
@@ -266,6 +269,21 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
266
269
|
return *optional;
|
|
267
270
|
}
|
|
268
271
|
|
|
272
|
+
// pragma MARK: std::optional<BillingProgramAndroid>
|
|
273
|
+
/**
|
|
274
|
+
* Specialized version of `std::optional<BillingProgramAndroid>`.
|
|
275
|
+
*/
|
|
276
|
+
using std__optional_BillingProgramAndroid_ = std::optional<BillingProgramAndroid>;
|
|
277
|
+
inline std::optional<BillingProgramAndroid> create_std__optional_BillingProgramAndroid_(const BillingProgramAndroid& value) noexcept {
|
|
278
|
+
return std::optional<BillingProgramAndroid>(value);
|
|
279
|
+
}
|
|
280
|
+
inline bool has_value_std__optional_BillingProgramAndroid_(const std::optional<BillingProgramAndroid>& optional) noexcept {
|
|
281
|
+
return optional.has_value();
|
|
282
|
+
}
|
|
283
|
+
inline BillingProgramAndroid get_std__optional_BillingProgramAndroid_(const std::optional<BillingProgramAndroid>& optional) noexcept {
|
|
284
|
+
return *optional;
|
|
285
|
+
}
|
|
286
|
+
|
|
269
287
|
// pragma MARK: std::optional<InitConnectionConfig>
|
|
270
288
|
/**
|
|
271
289
|
* Specialized version of `std::optional<InitConnectionConfig>`.
|
|
@@ -1612,6 +1630,28 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
1612
1630
|
return Func_void_UserChoiceBillingDetails_Wrapper(std::move(value));
|
|
1613
1631
|
}
|
|
1614
1632
|
|
|
1633
|
+
// pragma MARK: std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>
|
|
1634
|
+
/**
|
|
1635
|
+
* Specialized version of `std::function<void(const DeveloperProvidedBillingDetailsAndroid&)>`.
|
|
1636
|
+
*/
|
|
1637
|
+
using Func_void_DeveloperProvidedBillingDetailsAndroid = std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>;
|
|
1638
|
+
/**
|
|
1639
|
+
* Wrapper class for a `std::function<void(const DeveloperProvidedBillingDetailsAndroid& / * details * /)>`, this can be used from Swift.
|
|
1640
|
+
*/
|
|
1641
|
+
class Func_void_DeveloperProvidedBillingDetailsAndroid_Wrapper final {
|
|
1642
|
+
public:
|
|
1643
|
+
explicit Func_void_DeveloperProvidedBillingDetailsAndroid_Wrapper(std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>&& func): _function(std::make_unique<std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>>(std::move(func))) {}
|
|
1644
|
+
inline void call(DeveloperProvidedBillingDetailsAndroid details) const noexcept {
|
|
1645
|
+
_function->operator()(details);
|
|
1646
|
+
}
|
|
1647
|
+
private:
|
|
1648
|
+
std::unique_ptr<std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>> _function;
|
|
1649
|
+
} SWIFT_NONCOPYABLE;
|
|
1650
|
+
Func_void_DeveloperProvidedBillingDetailsAndroid create_Func_void_DeveloperProvidedBillingDetailsAndroid(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
1651
|
+
inline Func_void_DeveloperProvidedBillingDetailsAndroid_Wrapper wrap_Func_void_DeveloperProvidedBillingDetailsAndroid(Func_void_DeveloperProvidedBillingDetailsAndroid value) noexcept {
|
|
1652
|
+
return Func_void_DeveloperProvidedBillingDetailsAndroid_Wrapper(std::move(value));
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1615
1655
|
// pragma MARK: std::shared_ptr<Promise<NitroBillingProgramAvailabilityResultAndroid>>
|
|
1616
1656
|
/**
|
|
1617
1657
|
* Specialized version of `std::shared_ptr<Promise<NitroBillingProgramAvailabilityResultAndroid>>`.
|
|
@@ -14,6 +14,8 @@ namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
|
|
|
14
14
|
namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
|
|
15
15
|
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
17
|
+
// Forward declaration of `DeveloperProvidedBillingDetailsAndroid` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::iap { struct DeveloperProvidedBillingDetailsAndroid; }
|
|
17
19
|
// Forward declaration of `ExternalLinkLaunchModeAndroid` to properly resolve imports.
|
|
18
20
|
namespace margelo::nitro::iap { enum class ExternalLinkLaunchModeAndroid; }
|
|
19
21
|
// Forward declaration of `ExternalLinkTypeAndroid` to properly resolve imports.
|
|
@@ -137,6 +139,7 @@ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
|
137
139
|
#include "AlternativeBillingModeAndroid.hpp"
|
|
138
140
|
#include "AndroidSubscriptionOfferInput.hpp"
|
|
139
141
|
#include "BillingProgramAndroid.hpp"
|
|
142
|
+
#include "DeveloperProvidedBillingDetailsAndroid.hpp"
|
|
140
143
|
#include "ExternalLinkLaunchModeAndroid.hpp"
|
|
141
144
|
#include "ExternalLinkTypeAndroid.hpp"
|
|
142
145
|
#include "ExternalPurchaseLinkResultIOS.hpp"
|
|
@@ -16,6 +16,8 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
|
|
|
16
16
|
namespace margelo::nitro::iap { struct InitConnectionConfig; }
|
|
17
17
|
// Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
|
|
19
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
19
21
|
// Forward declaration of `NitroProduct` to properly resolve imports.
|
|
20
22
|
namespace margelo::nitro::iap { struct NitroProduct; }
|
|
21
23
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
@@ -116,8 +118,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps;
|
|
|
116
118
|
namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
117
119
|
// Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
|
|
118
120
|
namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
119
|
-
// Forward declaration of `
|
|
120
|
-
namespace margelo::nitro::iap {
|
|
121
|
+
// Forward declaration of `DeveloperProvidedBillingDetailsAndroid` to properly resolve imports.
|
|
122
|
+
namespace margelo::nitro::iap { struct DeveloperProvidedBillingDetailsAndroid; }
|
|
121
123
|
// Forward declaration of `NitroBillingProgramAvailabilityResultAndroid` to properly resolve imports.
|
|
122
124
|
namespace margelo::nitro::iap { struct NitroBillingProgramAvailabilityResultAndroid; }
|
|
123
125
|
// Forward declaration of `NitroBillingProgramReportingDetailsAndroid` to properly resolve imports.
|
|
@@ -139,6 +141,7 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
|
139
141
|
#include "InitConnectionConfig.hpp"
|
|
140
142
|
#include <optional>
|
|
141
143
|
#include "AlternativeBillingModeAndroid.hpp"
|
|
144
|
+
#include "BillingProgramAndroid.hpp"
|
|
142
145
|
#include "NitroProduct.hpp"
|
|
143
146
|
#include <vector>
|
|
144
147
|
#include <string>
|
|
@@ -194,7 +197,7 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
|
194
197
|
#include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
|
|
195
198
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
196
199
|
#include "UserChoiceBillingDetails.hpp"
|
|
197
|
-
#include "
|
|
200
|
+
#include "DeveloperProvidedBillingDetailsAndroid.hpp"
|
|
198
201
|
#include "NitroBillingProgramAvailabilityResultAndroid.hpp"
|
|
199
202
|
#include "NitroBillingProgramReportingDetailsAndroid.hpp"
|
|
200
203
|
#include "NitroLaunchExternalLinkParamsAndroid.hpp"
|
|
@@ -581,6 +584,18 @@ namespace margelo::nitro::iap {
|
|
|
581
584
|
std::rethrow_exception(__result.error());
|
|
582
585
|
}
|
|
583
586
|
}
|
|
587
|
+
inline void addDeveloperProvidedBillingListenerAndroid(const std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>& listener) override {
|
|
588
|
+
auto __result = _swiftPart.addDeveloperProvidedBillingListenerAndroid(listener);
|
|
589
|
+
if (__result.hasError()) [[unlikely]] {
|
|
590
|
+
std::rethrow_exception(__result.error());
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
inline void removeDeveloperProvidedBillingListenerAndroid(const std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>& listener) override {
|
|
594
|
+
auto __result = _swiftPart.removeDeveloperProvidedBillingListenerAndroid(listener);
|
|
595
|
+
if (__result.hasError()) [[unlikely]] {
|
|
596
|
+
std::rethrow_exception(__result.error());
|
|
597
|
+
}
|
|
598
|
+
}
|
|
584
599
|
inline void enableBillingProgramAndroid(BillingProgramAndroid program) override {
|
|
585
600
|
auto __result = _swiftPart.enableBillingProgramAndroid(static_cast<int>(program));
|
|
586
601
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -23,6 +23,8 @@ public extension BillingProgramAndroid {
|
|
|
23
23
|
self = .externalContentLink
|
|
24
24
|
case "external-offer":
|
|
25
25
|
self = .externalOffer
|
|
26
|
+
case "external-payments":
|
|
27
|
+
self = .externalPayments
|
|
26
28
|
default:
|
|
27
29
|
return nil
|
|
28
30
|
}
|
|
@@ -39,6 +41,8 @@ public extension BillingProgramAndroid {
|
|
|
39
41
|
return "external-content-link"
|
|
40
42
|
case .externalOffer:
|
|
41
43
|
return "external-offer"
|
|
44
|
+
case .externalPayments:
|
|
45
|
+
return "external-payments"
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DeveloperProvidedBillingDetailsAndroid.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `DeveloperProvidedBillingDetailsAndroid`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias DeveloperProvidedBillingDetailsAndroid = margelo.nitro.iap.DeveloperProvidedBillingDetailsAndroid
|
|
14
|
+
|
|
15
|
+
public extension DeveloperProvidedBillingDetailsAndroid {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `DeveloperProvidedBillingDetailsAndroid`.
|
|
20
|
+
*/
|
|
21
|
+
init(externalTransactionToken: String) {
|
|
22
|
+
self.init(std.string(externalTransactionToken))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var externalTransactionToken: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__externalTransactionToken)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__externalTransactionToken = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_DeveloperProvidedBillingDetailsAndroid.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ details: DeveloperProvidedBillingDetailsAndroid) -> 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_DeveloperProvidedBillingDetailsAndroid {
|
|
16
|
+
public typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(details: DeveloperProvidedBillingDetailsAndroid) -> Void {
|
|
26
|
+
self.closure(details)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_DeveloperProvidedBillingDetailsAndroid`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_DeveloperProvidedBillingDetailsAndroid>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_DeveloperProvidedBillingDetailsAndroid {
|
|
45
|
+
return Unmanaged<Func_void_DeveloperProvidedBillingDetailsAndroid>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -59,6 +59,8 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
|
|
|
59
59
|
func createAlternativeBillingTokenAndroid(sku: String?) throws -> Promise<String?>
|
|
60
60
|
func addUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
|
|
61
61
|
func removeUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
|
|
62
|
+
func addDeveloperProvidedBillingListenerAndroid(listener: @escaping (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void) throws -> Void
|
|
63
|
+
func removeDeveloperProvidedBillingListenerAndroid(listener: @escaping (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void) throws -> Void
|
|
62
64
|
func enableBillingProgramAndroid(program: BillingProgramAndroid) throws -> Void
|
|
63
65
|
func isBillingProgramAvailableAndroid(program: BillingProgramAndroid) throws -> Promise<NitroBillingProgramAvailabilityResultAndroid>
|
|
64
66
|
func createBillingProgramReportingDetailsAndroid(program: BillingProgramAndroid) throws -> Promise<NitroBillingProgramReportingDetailsAndroid>
|
|
@@ -1075,6 +1075,38 @@ open class HybridRnIapSpec_cxx {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
|
|
1078
|
+
@inline(__always)
|
|
1079
|
+
public final func addDeveloperProvidedBillingListenerAndroid(listener: bridge.Func_void_DeveloperProvidedBillingDetailsAndroid) -> bridge.Result_void_ {
|
|
1080
|
+
do {
|
|
1081
|
+
try self.__implementation.addDeveloperProvidedBillingListenerAndroid(listener: { () -> (DeveloperProvidedBillingDetailsAndroid) -> Void in
|
|
1082
|
+
let __wrappedFunction = bridge.wrap_Func_void_DeveloperProvidedBillingDetailsAndroid(listener)
|
|
1083
|
+
return { (__details: DeveloperProvidedBillingDetailsAndroid) -> Void in
|
|
1084
|
+
__wrappedFunction.call(__details)
|
|
1085
|
+
}
|
|
1086
|
+
}())
|
|
1087
|
+
return bridge.create_Result_void_()
|
|
1088
|
+
} catch (let __error) {
|
|
1089
|
+
let __exceptionPtr = __error.toCpp()
|
|
1090
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
@inline(__always)
|
|
1095
|
+
public final func removeDeveloperProvidedBillingListenerAndroid(listener: bridge.Func_void_DeveloperProvidedBillingDetailsAndroid) -> bridge.Result_void_ {
|
|
1096
|
+
do {
|
|
1097
|
+
try self.__implementation.removeDeveloperProvidedBillingListenerAndroid(listener: { () -> (DeveloperProvidedBillingDetailsAndroid) -> Void in
|
|
1098
|
+
let __wrappedFunction = bridge.wrap_Func_void_DeveloperProvidedBillingDetailsAndroid(listener)
|
|
1099
|
+
return { (__details: DeveloperProvidedBillingDetailsAndroid) -> Void in
|
|
1100
|
+
__wrappedFunction.call(__details)
|
|
1101
|
+
}
|
|
1102
|
+
}())
|
|
1103
|
+
return bridge.create_Result_void_()
|
|
1104
|
+
} catch (let __error) {
|
|
1105
|
+
let __exceptionPtr = __error.toCpp()
|
|
1106
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1078
1110
|
@inline(__always)
|
|
1079
1111
|
public final func enableBillingProgramAndroid(program: Int32) -> bridge.Result_void_ {
|
|
1080
1112
|
do {
|
|
@@ -18,13 +18,19 @@ public extension InitConnectionConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `InitConnectionConfig`.
|
|
20
20
|
*/
|
|
21
|
-
init(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?) {
|
|
21
|
+
init(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?, enableBillingProgramAndroid: BillingProgramAndroid?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_AlternativeBillingModeAndroid_ in
|
|
23
23
|
if let __unwrappedValue = alternativeBillingModeAndroid {
|
|
24
24
|
return bridge.create_std__optional_AlternativeBillingModeAndroid_(__unwrappedValue)
|
|
25
25
|
} else {
|
|
26
26
|
return .init()
|
|
27
27
|
}
|
|
28
|
+
}(), { () -> bridge.std__optional_BillingProgramAndroid_ in
|
|
29
|
+
if let __unwrappedValue = enableBillingProgramAndroid {
|
|
30
|
+
return bridge.create_std__optional_BillingProgramAndroid_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
28
34
|
}())
|
|
29
35
|
}
|
|
30
36
|
|
|
@@ -44,4 +50,21 @@ public extension InitConnectionConfig {
|
|
|
44
50
|
}()
|
|
45
51
|
}
|
|
46
52
|
}
|
|
53
|
+
|
|
54
|
+
var enableBillingProgramAndroid: BillingProgramAndroid? {
|
|
55
|
+
@inline(__always)
|
|
56
|
+
get {
|
|
57
|
+
return self.__enableBillingProgramAndroid.value
|
|
58
|
+
}
|
|
59
|
+
@inline(__always)
|
|
60
|
+
set {
|
|
61
|
+
self.__enableBillingProgramAndroid = { () -> bridge.std__optional_BillingProgramAndroid_ in
|
|
62
|
+
if let __unwrappedValue = newValue {
|
|
63
|
+
return bridge.create_std__optional_BillingProgramAndroid_(__unwrappedValue)
|
|
64
|
+
} else {
|
|
65
|
+
return .init()
|
|
66
|
+
}
|
|
67
|
+
}()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
47
70
|
}
|
|
@@ -32,6 +32,7 @@ namespace margelo::nitro::iap {
|
|
|
32
32
|
UNSPECIFIED SWIFT_NAME(unspecified) = 0,
|
|
33
33
|
EXTERNAL_CONTENT_LINK SWIFT_NAME(externalContentLink) = 1,
|
|
34
34
|
EXTERNAL_OFFER SWIFT_NAME(externalOffer) = 2,
|
|
35
|
+
EXTERNAL_PAYMENTS SWIFT_NAME(externalPayments) = 3,
|
|
35
36
|
} CLOSED_ENUM;
|
|
36
37
|
|
|
37
38
|
} // namespace margelo::nitro::iap
|
|
@@ -47,6 +48,7 @@ namespace margelo::nitro {
|
|
|
47
48
|
case hashString("unspecified"): return margelo::nitro::iap::BillingProgramAndroid::UNSPECIFIED;
|
|
48
49
|
case hashString("external-content-link"): return margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_CONTENT_LINK;
|
|
49
50
|
case hashString("external-offer"): return margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_OFFER;
|
|
51
|
+
case hashString("external-payments"): return margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_PAYMENTS;
|
|
50
52
|
default: [[unlikely]]
|
|
51
53
|
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BillingProgramAndroid - invalid value!");
|
|
52
54
|
}
|
|
@@ -56,6 +58,7 @@ namespace margelo::nitro {
|
|
|
56
58
|
case margelo::nitro::iap::BillingProgramAndroid::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
|
|
57
59
|
case margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_CONTENT_LINK: return JSIConverter<std::string>::toJSI(runtime, "external-content-link");
|
|
58
60
|
case margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_OFFER: return JSIConverter<std::string>::toJSI(runtime, "external-offer");
|
|
61
|
+
case margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_PAYMENTS: return JSIConverter<std::string>::toJSI(runtime, "external-payments");
|
|
59
62
|
default: [[unlikely]]
|
|
60
63
|
throw std::invalid_argument("Cannot convert BillingProgramAndroid to JS - invalid value: "
|
|
61
64
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
@@ -70,6 +73,7 @@ namespace margelo::nitro {
|
|
|
70
73
|
case hashString("unspecified"):
|
|
71
74
|
case hashString("external-content-link"):
|
|
72
75
|
case hashString("external-offer"):
|
|
76
|
+
case hashString("external-payments"):
|
|
73
77
|
return true;
|
|
74
78
|
default:
|
|
75
79
|
return false;
|