react-native-iap 14.4.11 → 14.4.12
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 +159 -10
- package/ios/HybridRnIap.swift +115 -2
- package/lib/module/hooks/useIAP.js +24 -3
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +275 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +18 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts +27 -0
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +6 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +133 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +72 -2
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +116 -13
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +58 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseNoticeAction.hpp +59 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +60 -0
- package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +132 -3
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +4 -0
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +4 -0
- package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +43 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +32 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +156 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +81 -3
- package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseLinkResultIOS.swift +65 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeAction.swift +40 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +65 -0
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseLinkResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseNoticeResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_UserChoiceBillingDetails.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +9 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +168 -2
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +47 -0
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +31 -1
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
- package/nitrogen/generated/ios/swift/UserChoiceBillingDetails.swift +58 -0
- package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +72 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeAction.hpp +76 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +8 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +22 -2
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +69 -0
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +5 -1
- package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +72 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/withIAP.d.ts +27 -0
- package/plugin/build/withIAP.js +91 -1
- package/plugin/src/withIAP.ts +162 -0
- package/src/hooks/useIAP.ts +47 -1
- package/src/index.ts +313 -2
- package/src/specs/RnIap.nitro.ts +99 -1
- package/src/types.ts +124 -13
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JInitConnectionConfig.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 "InitConnectionConfig.hpp"
|
|
12
|
+
|
|
13
|
+
#include "AlternativeBillingModeAndroid.hpp"
|
|
14
|
+
#include "JAlternativeBillingModeAndroid.hpp"
|
|
15
|
+
#include <optional>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::iap {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The C++ JNI bridge between the C++ struct "InitConnectionConfig" and the the Kotlin data class "InitConnectionConfig".
|
|
23
|
+
*/
|
|
24
|
+
struct JInitConnectionConfig final: public jni::JavaClass<JInitConnectionConfig> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/InitConnectionConfig;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Convert this Java/Kotlin-based struct to the C++ struct InitConnectionConfig by copying all values to C++.
|
|
31
|
+
*/
|
|
32
|
+
[[maybe_unused]]
|
|
33
|
+
[[nodiscard]]
|
|
34
|
+
InitConnectionConfig toCpp() const {
|
|
35
|
+
static const auto clazz = javaClassStatic();
|
|
36
|
+
static const auto fieldAlternativeBillingModeAndroid = clazz->getField<JAlternativeBillingModeAndroid>("alternativeBillingModeAndroid");
|
|
37
|
+
jni::local_ref<JAlternativeBillingModeAndroid> alternativeBillingModeAndroid = this->getFieldValue(fieldAlternativeBillingModeAndroid);
|
|
38
|
+
return InitConnectionConfig(
|
|
39
|
+
alternativeBillingModeAndroid != nullptr ? std::make_optional(alternativeBillingModeAndroid->toCpp()) : std::nullopt
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
/**
|
|
45
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
46
|
+
*/
|
|
47
|
+
[[maybe_unused]]
|
|
48
|
+
static jni::local_ref<JInitConnectionConfig::javaobject> fromCpp(const InitConnectionConfig& value) {
|
|
49
|
+
return newInstance(
|
|
50
|
+
value.alternativeBillingModeAndroid.has_value() ? JAlternativeBillingModeAndroid::fromCpp(value.alternativeBillingModeAndroid.value()) : nullptr
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::iap
|
|
@@ -39,6 +39,8 @@ namespace margelo::nitro::iap {
|
|
|
39
39
|
static const auto clazz = javaClassStatic();
|
|
40
40
|
static const auto fieldAutoRenewingAndroid = clazz->getField<jni::JBoolean>("autoRenewingAndroid");
|
|
41
41
|
jni::local_ref<jni::JBoolean> autoRenewingAndroid = this->getFieldValue(fieldAutoRenewingAndroid);
|
|
42
|
+
static const auto fieldCurrentPlanId = clazz->getField<jni::JString>("currentPlanId");
|
|
43
|
+
jni::local_ref<jni::JString> currentPlanId = this->getFieldValue(fieldCurrentPlanId);
|
|
42
44
|
static const auto fieldDataAndroid = clazz->getField<jni::JString>("dataAndroid");
|
|
43
45
|
jni::local_ref<jni::JString> dataAndroid = this->getFieldValue(fieldDataAndroid);
|
|
44
46
|
static const auto fieldDeveloperPayloadAndroid = clazz->getField<jni::JString>("developerPayloadAndroid");
|
|
@@ -75,6 +77,7 @@ namespace margelo::nitro::iap {
|
|
|
75
77
|
jni::local_ref<jni::JString> transactionId = this->getFieldValue(fieldTransactionId);
|
|
76
78
|
return PurchaseAndroid(
|
|
77
79
|
autoRenewingAndroid != nullptr ? std::make_optional(static_cast<bool>(autoRenewingAndroid->value())) : std::nullopt,
|
|
80
|
+
currentPlanId != nullptr ? std::make_optional(currentPlanId->toStdString()) : std::nullopt,
|
|
78
81
|
dataAndroid != nullptr ? std::make_optional(dataAndroid->toStdString()) : std::nullopt,
|
|
79
82
|
developerPayloadAndroid != nullptr ? std::make_optional(developerPayloadAndroid->toStdString()) : std::nullopt,
|
|
80
83
|
id->toStdString(),
|
|
@@ -112,6 +115,7 @@ namespace margelo::nitro::iap {
|
|
|
112
115
|
static jni::local_ref<JPurchaseAndroid::javaobject> fromCpp(const PurchaseAndroid& value) {
|
|
113
116
|
return newInstance(
|
|
114
117
|
value.autoRenewingAndroid.has_value() ? jni::JBoolean::valueOf(value.autoRenewingAndroid.value()) : nullptr,
|
|
118
|
+
value.currentPlanId.has_value() ? jni::make_jstring(value.currentPlanId.value()) : nullptr,
|
|
115
119
|
value.dataAndroid.has_value() ? jni::make_jstring(value.dataAndroid.value()) : nullptr,
|
|
116
120
|
value.developerPayloadAndroid.has_value() ? jni::make_jstring(value.developerPayloadAndroid.value()) : nullptr,
|
|
117
121
|
jni::make_jstring(value.id),
|
|
@@ -49,6 +49,8 @@ namespace margelo::nitro::iap {
|
|
|
49
49
|
jni::local_ref<jni::JString> currencyCodeIOS = this->getFieldValue(fieldCurrencyCodeIOS);
|
|
50
50
|
static const auto fieldCurrencySymbolIOS = clazz->getField<jni::JString>("currencySymbolIOS");
|
|
51
51
|
jni::local_ref<jni::JString> currencySymbolIOS = this->getFieldValue(fieldCurrencySymbolIOS);
|
|
52
|
+
static const auto fieldCurrentPlanId = clazz->getField<jni::JString>("currentPlanId");
|
|
53
|
+
jni::local_ref<jni::JString> currentPlanId = this->getFieldValue(fieldCurrentPlanId);
|
|
52
54
|
static const auto fieldEnvironmentIOS = clazz->getField<jni::JString>("environmentIOS");
|
|
53
55
|
jni::local_ref<jni::JString> environmentIOS = this->getFieldValue(fieldEnvironmentIOS);
|
|
54
56
|
static const auto fieldExpirationDateIOS = clazz->getField<jni::JDouble>("expirationDateIOS");
|
|
@@ -107,6 +109,7 @@ namespace margelo::nitro::iap {
|
|
|
107
109
|
countryCodeIOS != nullptr ? std::make_optional(countryCodeIOS->toStdString()) : std::nullopt,
|
|
108
110
|
currencyCodeIOS != nullptr ? std::make_optional(currencyCodeIOS->toStdString()) : std::nullopt,
|
|
109
111
|
currencySymbolIOS != nullptr ? std::make_optional(currencySymbolIOS->toStdString()) : std::nullopt,
|
|
112
|
+
currentPlanId != nullptr ? std::make_optional(currentPlanId->toStdString()) : std::nullopt,
|
|
110
113
|
environmentIOS != nullptr ? std::make_optional(environmentIOS->toStdString()) : std::nullopt,
|
|
111
114
|
expirationDateIOS != nullptr ? std::make_optional(expirationDateIOS->value()) : std::nullopt,
|
|
112
115
|
id->toStdString(),
|
|
@@ -157,6 +160,7 @@ namespace margelo::nitro::iap {
|
|
|
157
160
|
value.countryCodeIOS.has_value() ? jni::make_jstring(value.countryCodeIOS.value()) : nullptr,
|
|
158
161
|
value.currencyCodeIOS.has_value() ? jni::make_jstring(value.currencyCodeIOS.value()) : nullptr,
|
|
159
162
|
value.currencySymbolIOS.has_value() ? jni::make_jstring(value.currencySymbolIOS.value()) : nullptr,
|
|
163
|
+
value.currentPlanId.has_value() ? jni::make_jstring(value.currentPlanId.value()) : nullptr,
|
|
160
164
|
value.environmentIOS.has_value() ? jni::make_jstring(value.environmentIOS.value()) : nullptr,
|
|
161
165
|
value.expirationDateIOS.has_value() ? jni::JDouble::valueOf(value.expirationDateIOS.value()) : nullptr,
|
|
162
166
|
jni::make_jstring(value.id),
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JUserChoiceBillingDetails.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 "UserChoiceBillingDetails.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::iap {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "UserChoiceBillingDetails" and the the Kotlin data class "UserChoiceBillingDetails".
|
|
22
|
+
*/
|
|
23
|
+
struct JUserChoiceBillingDetails final: public jni::JavaClass<JUserChoiceBillingDetails> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/UserChoiceBillingDetails;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct UserChoiceBillingDetails by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
UserChoiceBillingDetails toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldExternalTransactionToken = clazz->getField<jni::JString>("externalTransactionToken");
|
|
36
|
+
jni::local_ref<jni::JString> externalTransactionToken = this->getFieldValue(fieldExternalTransactionToken);
|
|
37
|
+
static const auto fieldProducts = clazz->getField<jni::JArrayClass<jni::JString>>("products");
|
|
38
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> products = this->getFieldValue(fieldProducts);
|
|
39
|
+
return UserChoiceBillingDetails(
|
|
40
|
+
externalTransactionToken->toStdString(),
|
|
41
|
+
[&]() {
|
|
42
|
+
size_t __size = products->size();
|
|
43
|
+
std::vector<std::string> __vector;
|
|
44
|
+
__vector.reserve(__size);
|
|
45
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
46
|
+
auto __element = products->getElement(__i);
|
|
47
|
+
__vector.push_back(__element->toStdString());
|
|
48
|
+
}
|
|
49
|
+
return __vector;
|
|
50
|
+
}()
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
/**
|
|
56
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
57
|
+
*/
|
|
58
|
+
[[maybe_unused]]
|
|
59
|
+
static jni::local_ref<JUserChoiceBillingDetails::javaobject> fromCpp(const UserChoiceBillingDetails& value) {
|
|
60
|
+
return newInstance(
|
|
61
|
+
jni::make_jstring(value.externalTransactionToken),
|
|
62
|
+
[&]() {
|
|
63
|
+
size_t __size = value.products.size();
|
|
64
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
65
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
66
|
+
const auto& __element = value.products[__i];
|
|
67
|
+
__array->setElement(__i, *jni::make_jstring(__element));
|
|
68
|
+
}
|
|
69
|
+
return __array;
|
|
70
|
+
}()
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::iap
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AlternativeBillingModeAndroid.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "AlternativeBillingModeAndroid".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class AlternativeBillingModeAndroid(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
NONE(0),
|
|
20
|
+
USER_CHOICE(1),
|
|
21
|
+
ALTERNATIVE_ONLY(2);
|
|
22
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalPurchaseLinkResultIOS.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 "ExternalPurchaseLinkResultIOS".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class ExternalPurchaseLinkResultIOS
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val error: String?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val success: Boolean
|
|
30
|
+
) {
|
|
31
|
+
/* main constructor */
|
|
32
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalPurchaseNoticeAction.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "ExternalPurchaseNoticeAction".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class ExternalPurchaseNoticeAction(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
CONTINUE(0),
|
|
20
|
+
DISMISSED(1);
|
|
21
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalPurchaseNoticeResultIOS.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 "ExternalPurchaseNoticeResultIOS".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class ExternalPurchaseNoticeResultIOS
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val error: String?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val result: ExternalPurchaseNoticeAction
|
|
30
|
+
) {
|
|
31
|
+
/* main constructor */
|
|
32
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_UserChoiceBillingDetails.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 com.margelo.nitro.core.*
|
|
14
|
+
import dalvik.annotation.optimization.FastNative
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
19
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
20
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
21
|
+
*/
|
|
22
|
+
@DoNotStrip
|
|
23
|
+
@Keep
|
|
24
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
25
|
+
fun interface Func_void_UserChoiceBillingDetails: (UserChoiceBillingDetails) -> Unit {
|
|
26
|
+
/**
|
|
27
|
+
* Call the given JS callback.
|
|
28
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
29
|
+
*/
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
override fun invoke(details: UserChoiceBillingDetails): Unit
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
37
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
38
|
+
* The callback might be coming from JS.
|
|
39
|
+
*/
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
@Keep
|
|
42
|
+
@Suppress(
|
|
43
|
+
"KotlinJniMissingFunction", "unused",
|
|
44
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
45
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
46
|
+
)
|
|
47
|
+
class Func_void_UserChoiceBillingDetails_cxx: Func_void_UserChoiceBillingDetails {
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
private val mHybridData: HybridData
|
|
51
|
+
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
@Keep
|
|
54
|
+
private constructor(hybridData: HybridData) {
|
|
55
|
+
mHybridData = hybridData
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
override fun invoke(details: UserChoiceBillingDetails): Unit
|
|
61
|
+
= invoke_cxx(details)
|
|
62
|
+
|
|
63
|
+
@FastNative
|
|
64
|
+
private external fun invoke_cxx(details: UserChoiceBillingDetails): Unit
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Represents the JavaScript callback `(details: struct) => void`.
|
|
69
|
+
* This is implemented in Java/Kotlin, via a `(UserChoiceBillingDetails) -> Unit`.
|
|
70
|
+
* The callback is always coming from native.
|
|
71
|
+
*/
|
|
72
|
+
@DoNotStrip
|
|
73
|
+
@Keep
|
|
74
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
75
|
+
class Func_void_UserChoiceBillingDetails_java(private val function: (UserChoiceBillingDetails) -> Unit): Func_void_UserChoiceBillingDetails {
|
|
76
|
+
@DoNotStrip
|
|
77
|
+
@Keep
|
|
78
|
+
override fun invoke(details: UserChoiceBillingDetails): Unit {
|
|
79
|
+
return this.function(details)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -42,7 +42,7 @@ abstract class HybridRnIapSpec: HybridObject() {
|
|
|
42
42
|
// Methods
|
|
43
43
|
@DoNotStrip
|
|
44
44
|
@Keep
|
|
45
|
-
abstract fun initConnection(): Promise<Boolean>
|
|
45
|
+
abstract fun initConnection(config: InitConnectionConfig?): Promise<Boolean>
|
|
46
46
|
|
|
47
47
|
@DoNotStrip
|
|
48
48
|
@Keep
|
|
@@ -213,6 +213,48 @@ abstract class HybridRnIapSpec: HybridObject() {
|
|
|
213
213
|
@DoNotStrip
|
|
214
214
|
@Keep
|
|
215
215
|
abstract fun deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid): Promise<Unit>
|
|
216
|
+
|
|
217
|
+
@DoNotStrip
|
|
218
|
+
@Keep
|
|
219
|
+
abstract fun checkAlternativeBillingAvailabilityAndroid(): Promise<Boolean>
|
|
220
|
+
|
|
221
|
+
@DoNotStrip
|
|
222
|
+
@Keep
|
|
223
|
+
abstract fun showAlternativeBillingDialogAndroid(): Promise<Boolean>
|
|
224
|
+
|
|
225
|
+
@DoNotStrip
|
|
226
|
+
@Keep
|
|
227
|
+
abstract fun createAlternativeBillingTokenAndroid(sku: String?): Promise<String?>
|
|
228
|
+
|
|
229
|
+
abstract fun addUserChoiceBillingListenerAndroid(listener: (details: UserChoiceBillingDetails) -> Unit): Unit
|
|
230
|
+
|
|
231
|
+
@DoNotStrip
|
|
232
|
+
@Keep
|
|
233
|
+
private fun addUserChoiceBillingListenerAndroid_cxx(listener: Func_void_UserChoiceBillingDetails): Unit {
|
|
234
|
+
val __result = addUserChoiceBillingListenerAndroid(listener)
|
|
235
|
+
return __result
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
abstract fun removeUserChoiceBillingListenerAndroid(listener: (details: UserChoiceBillingDetails) -> Unit): Unit
|
|
239
|
+
|
|
240
|
+
@DoNotStrip
|
|
241
|
+
@Keep
|
|
242
|
+
private fun removeUserChoiceBillingListenerAndroid_cxx(listener: Func_void_UserChoiceBillingDetails): Unit {
|
|
243
|
+
val __result = removeUserChoiceBillingListenerAndroid(listener)
|
|
244
|
+
return __result
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@DoNotStrip
|
|
248
|
+
@Keep
|
|
249
|
+
abstract fun canPresentExternalPurchaseNoticeIOS(): Promise<Boolean>
|
|
250
|
+
|
|
251
|
+
@DoNotStrip
|
|
252
|
+
@Keep
|
|
253
|
+
abstract fun presentExternalPurchaseNoticeSheetIOS(): Promise<ExternalPurchaseNoticeResultIOS>
|
|
254
|
+
|
|
255
|
+
@DoNotStrip
|
|
256
|
+
@Keep
|
|
257
|
+
abstract fun presentExternalPurchaseLinkIOS(url: String): Promise<ExternalPurchaseLinkResultIOS>
|
|
216
258
|
|
|
217
259
|
private external fun initHybrid(): HybridData
|
|
218
260
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// InitConnectionConfig.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 "InitConnectionConfig".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class InitConnectionConfig
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val alternativeBillingModeAndroid: AlternativeBillingModeAndroid?
|
|
27
|
+
) {
|
|
28
|
+
/* main constructor */
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UserChoiceBillingDetails.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 "UserChoiceBillingDetails".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class UserChoiceBillingDetails
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val externalTransactionToken: String,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val products: Array<String>
|
|
30
|
+
) {
|
|
31
|
+
/* main constructor */
|
|
32
|
+
}
|
|
@@ -141,6 +141,30 @@ namespace margelo::nitro::iap::bridge::swift {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// pragma MARK: std::function<void(const UserChoiceBillingDetails& /* details */)>
|
|
145
|
+
Func_void_UserChoiceBillingDetails create_Func_void_UserChoiceBillingDetails(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
146
|
+
auto swiftClosure = NitroIap::Func_void_UserChoiceBillingDetails::fromUnsafe(swiftClosureWrapper);
|
|
147
|
+
return [swiftClosure = std::move(swiftClosure)](const UserChoiceBillingDetails& details) mutable -> void {
|
|
148
|
+
swiftClosure.call(details);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// pragma MARK: std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>
|
|
153
|
+
Func_void_ExternalPurchaseNoticeResultIOS create_Func_void_ExternalPurchaseNoticeResultIOS(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
154
|
+
auto swiftClosure = NitroIap::Func_void_ExternalPurchaseNoticeResultIOS::fromUnsafe(swiftClosureWrapper);
|
|
155
|
+
return [swiftClosure = std::move(swiftClosure)](const ExternalPurchaseNoticeResultIOS& result) mutable -> void {
|
|
156
|
+
swiftClosure.call(result);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// pragma MARK: std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>
|
|
161
|
+
Func_void_ExternalPurchaseLinkResultIOS create_Func_void_ExternalPurchaseLinkResultIOS(void* _Nonnull swiftClosureWrapper) noexcept {
|
|
162
|
+
auto swiftClosure = NitroIap::Func_void_ExternalPurchaseLinkResultIOS::fromUnsafe(swiftClosureWrapper);
|
|
163
|
+
return [swiftClosure = std::move(swiftClosure)](const ExternalPurchaseLinkResultIOS& result) mutable -> void {
|
|
164
|
+
swiftClosure.call(result);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
144
168
|
// pragma MARK: std::shared_ptr<HybridRnIapSpec>
|
|
145
169
|
std::shared_ptr<HybridRnIapSpec> create_std__shared_ptr_HybridRnIapSpec_(void* _Nonnull swiftUnsafePointer) noexcept {
|
|
146
170
|
NitroIap::HybridRnIapSpec_cxx swiftPart = NitroIap::HybridRnIapSpec_cxx::fromUnsafe(swiftUnsafePointer);
|