react-native-iap 16.0.2 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -32
- package/android/gradle.properties +3 -3
- package/android/src/main/cpp/cpp-adapter.cpp +4 -1
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +7 -7
- package/android/src/main/java/com/margelo/nitro/iap/NitroIapPackage.java +2 -6
- package/ios/RnIapHelper.swift +22 -0
- package/lib/module/hooks/useIAP.js +12 -4
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +6 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +1 -3
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +13 -13
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +7 -7
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +5 -3
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +23 -7
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/available-purchases.d.ts +1 -1
- package/lib/typescript/src/utils/available-purchases.d.ts.map +1 -1
- package/lib/typescript/src/utils/error.d.ts +1 -1
- package/lib/typescript/src/utils/error.d.ts.map +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
- package/lib/typescript/src/utils/purchase.d.ts +1 -1
- package/lib/typescript/src/utils/purchase.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts +2 -2
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/lib/typescript/src/vega.d.ts +1 -1
- package/lib/typescript/src/vega.d.ts.map +1 -1
- package/lib/typescript/src/vega.kepler.d.ts +1 -1
- package/lib/typescript/src/vega.kepler.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JAdvancedCommerceInfoIOS.hpp +10 -1
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +5 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +5 -0
- package/nitrogen/generated/android/c++/JNitroPurchaseVerificationResultIOS.hpp +5 -0
- package/nitrogen/generated/android/c++/JPurchase.hpp +5 -0
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +5 -0
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +5 -0
- package/nitrogen/generated/android/c++/JSubscriptionPeriodIOS.hpp +67 -0
- package/nitrogen/generated/android/c++/JSubscriptionPeriodValueIOS.hpp +62 -0
- package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp +5 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceInfoIOS.hpp +5 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchase.hpp +5 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_SubscriptionPeriodValueIOS.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_SubscriptionPeriodValueIOS.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceInfoIOS.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_DeveloperProvidedBillingDetailsAndroid.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroProduct.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchase.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchaseResult.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionPeriodIOS.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionPeriodValueIOS.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS.kt +62 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +50 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/swift/AdvancedCommerceInfoIOS.swift +38 -1
- package/nitrogen/generated/ios/swift/SubscriptionPeriodIOS.swift +52 -0
- package/nitrogen/generated/ios/swift/SubscriptionPeriodValueIOS.swift +34 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_SubscriptionPeriodValueIOS.swift +30 -0
- package/nitrogen/generated/shared/c++/AdvancedCommerceInfoIOS.hpp +8 -1
- package/nitrogen/generated/shared/c++/SubscriptionPeriodIOS.hpp +88 -0
- package/nitrogen/generated/shared/c++/SubscriptionPeriodValueIOS.hpp +88 -0
- package/openiap-versions.json +3 -3
- package/package.json +34 -37
- package/src/hooks/useIAP.ts +50 -31
- package/src/index.ts +19 -22
- package/src/specs/RnIap.nitro.ts +9 -15
- package/src/types.ts +23 -7
- package/src/utils/type-bridge.ts +0 -2
- package/lib/module/types/react-test-renderer.d.js +0 -2
- package/lib/module/types/react-test-renderer.d.js.map +0 -1
- package/src/types/react-test-renderer.d.ts +0 -7
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
#include "JPurchaseState.hpp"
|
|
27
27
|
#include "JRenewalCommitmentInfoIOS.hpp"
|
|
28
28
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
29
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
30
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
29
31
|
#include "JTransactionCommitmentInfoIOS.hpp"
|
|
30
32
|
#include "JVariant_NullType_AdvancedCommerceInfoIOS.hpp"
|
|
31
33
|
#include "JVariant_NullType_AdvancedCommerceItemDetailsIOS.hpp"
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
#include "JVariant_NullType_PendingPurchaseUpdateAndroid.hpp"
|
|
39
41
|
#include "JVariant_NullType_RenewalCommitmentInfoIOS.hpp"
|
|
40
42
|
#include "JVariant_NullType_String.hpp"
|
|
43
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
41
44
|
#include "JVariant_NullType_TransactionCommitmentInfoIOS.hpp"
|
|
42
45
|
#include "NitroPurchase.hpp"
|
|
43
46
|
#include "NitroRenewalInfoIOS.hpp"
|
|
@@ -45,6 +48,8 @@
|
|
|
45
48
|
#include "PurchaseState.hpp"
|
|
46
49
|
#include "RenewalCommitmentInfoIOS.hpp"
|
|
47
50
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
51
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
52
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
48
53
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
49
54
|
#include <NitroModules/JNull.hpp>
|
|
50
55
|
#include <NitroModules/Null.hpp>
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
#include "JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp"
|
|
43
43
|
#include "JAdvancedCommerceRefundIOS.hpp"
|
|
44
44
|
#include "JVariant_NullType_Double.hpp"
|
|
45
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
46
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
47
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
48
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
49
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
45
50
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
46
51
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
47
52
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
#include "JRenewalCommitmentInfoIOS.hpp"
|
|
26
26
|
#include "JRenewalInfoIOS.hpp"
|
|
27
27
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
28
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
29
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
28
30
|
#include "JTransactionCommitmentInfoIOS.hpp"
|
|
29
31
|
#include "JVariant_NullType_AdvancedCommerceInfoIOS.hpp"
|
|
30
32
|
#include "JVariant_NullType_AdvancedCommerceItemDetailsIOS.hpp"
|
|
@@ -36,12 +38,15 @@
|
|
|
36
38
|
#include "JVariant_NullType_RenewalCommitmentInfoIOS.hpp"
|
|
37
39
|
#include "JVariant_NullType_RenewalInfoIOS.hpp"
|
|
38
40
|
#include "JVariant_NullType_String.hpp"
|
|
41
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
39
42
|
#include "JVariant_NullType_TransactionCommitmentInfoIOS.hpp"
|
|
40
43
|
#include "PurchaseOfferIOS.hpp"
|
|
41
44
|
#include "PurchaseState.hpp"
|
|
42
45
|
#include "RenewalCommitmentInfoIOS.hpp"
|
|
43
46
|
#include "RenewalInfoIOS.hpp"
|
|
44
47
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
48
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
49
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
45
50
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
46
51
|
#include <NitroModules/JNull.hpp>
|
|
47
52
|
#include <NitroModules/Null.hpp>
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
#include "JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp"
|
|
43
43
|
#include "JAdvancedCommerceRefundIOS.hpp"
|
|
44
44
|
#include "JVariant_NullType_Double.hpp"
|
|
45
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
46
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
47
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
48
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
49
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
45
50
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
46
51
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
47
52
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSubscriptionPeriodIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::iap {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "SubscriptionPeriodIOS" and the Kotlin enum "SubscriptionPeriodIOS".
|
|
19
|
+
*/
|
|
20
|
+
struct JSubscriptionPeriodIOS final: public jni::JavaClass<JSubscriptionPeriodIOS> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/SubscriptionPeriodIOS;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum SubscriptionPeriodIOS.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
SubscriptionPeriodIOS toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<SubscriptionPeriodIOS>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JSubscriptionPeriodIOS> fromCpp(SubscriptionPeriodIOS value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case SubscriptionPeriodIOS::EMPTY:
|
|
46
|
+
static const auto fieldEMPTY = clazz->getStaticField<JSubscriptionPeriodIOS>("EMPTY");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldEMPTY);
|
|
48
|
+
case SubscriptionPeriodIOS::DAY:
|
|
49
|
+
static const auto fieldDAY = clazz->getStaticField<JSubscriptionPeriodIOS>("DAY");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldDAY);
|
|
51
|
+
case SubscriptionPeriodIOS::WEEK:
|
|
52
|
+
static const auto fieldWEEK = clazz->getStaticField<JSubscriptionPeriodIOS>("WEEK");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldWEEK);
|
|
54
|
+
case SubscriptionPeriodIOS::MONTH:
|
|
55
|
+
static const auto fieldMONTH = clazz->getStaticField<JSubscriptionPeriodIOS>("MONTH");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldMONTH);
|
|
57
|
+
case SubscriptionPeriodIOS::YEAR:
|
|
58
|
+
static const auto fieldYEAR = clazz->getStaticField<JSubscriptionPeriodIOS>("YEAR");
|
|
59
|
+
return clazz->getStaticFieldValue(fieldYEAR);
|
|
60
|
+
default:
|
|
61
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
62
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSubscriptionPeriodValueIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
14
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::iap {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "SubscriptionPeriodValueIOS" and the Kotlin data class "SubscriptionPeriodValueIOS".
|
|
22
|
+
*/
|
|
23
|
+
struct JSubscriptionPeriodValueIOS final: public jni::JavaClass<JSubscriptionPeriodValueIOS> {
|
|
24
|
+
public:
|
|
25
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/SubscriptionPeriodValueIOS;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct SubscriptionPeriodValueIOS by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
SubscriptionPeriodValueIOS toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldUnit = clazz->getField<JSubscriptionPeriodIOS>("unit");
|
|
36
|
+
jni::local_ref<JSubscriptionPeriodIOS> unit = this->getFieldValue(fieldUnit);
|
|
37
|
+
static const auto fieldValue = clazz->getField<double>("value");
|
|
38
|
+
double value = this->getFieldValue(fieldValue);
|
|
39
|
+
return SubscriptionPeriodValueIOS(
|
|
40
|
+
unit->toCpp(),
|
|
41
|
+
value
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
/**
|
|
47
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
48
|
+
*/
|
|
49
|
+
[[maybe_unused]]
|
|
50
|
+
static jni::local_ref<JSubscriptionPeriodValueIOS::javaobject> fromCpp(const SubscriptionPeriodValueIOS& value) {
|
|
51
|
+
using JSignature = JSubscriptionPeriodValueIOS(jni::alias_ref<JSubscriptionPeriodIOS>, double);
|
|
52
|
+
static const auto clazz = javaClassStatic();
|
|
53
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
54
|
+
return create(
|
|
55
|
+
clazz,
|
|
56
|
+
JSubscriptionPeriodIOS::fromCpp(value.unit),
|
|
57
|
+
value.value
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::iap
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
#include "JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp"
|
|
41
41
|
#include "JAdvancedCommerceRefundIOS.hpp"
|
|
42
42
|
#include "JVariant_NullType_Double.hpp"
|
|
43
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
44
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
45
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
46
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
47
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
43
48
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
44
49
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
45
50
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
#include "JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp"
|
|
29
29
|
#include "JAdvancedCommerceRefundIOS.hpp"
|
|
30
30
|
#include "JVariant_NullType_Double.hpp"
|
|
31
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
32
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
33
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
34
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
35
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
31
36
|
|
|
32
37
|
namespace margelo::nitro::iap {
|
|
33
38
|
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
#include "JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp"
|
|
37
37
|
#include "JAdvancedCommerceRefundIOS.hpp"
|
|
38
38
|
#include "JVariant_NullType_Double.hpp"
|
|
39
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
40
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
41
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
42
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
43
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
39
44
|
#include "SubscriptionBillingPlanTypeIOS.hpp"
|
|
40
45
|
#include "JSubscriptionBillingPlanTypeIOS.hpp"
|
|
41
46
|
#include "TransactionCommitmentInfoIOS.hpp"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_SubscriptionPeriodValueIOS.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JVariant_NullType_SubscriptionPeriodValueIOS.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::iap {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JVariant_NullType_SubscriptionPeriodValueIOS to std::variant<nitro::NullType, SubscriptionPeriodValueIOS>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<nitro::NullType, SubscriptionPeriodValueIOS> JVariant_NullType_SubscriptionPeriodValueIOS::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JVariant_NullType_SubscriptionPeriodValueIOS_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `nitro::NullType`
|
|
17
|
+
auto jniValue = static_cast<const JVariant_NullType_SubscriptionPeriodValueIOS_impl::First*>(this)->getValue();
|
|
18
|
+
return nitro::null;
|
|
19
|
+
} else if (isInstanceOf(JVariant_NullType_SubscriptionPeriodValueIOS_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `SubscriptionPeriodValueIOS`
|
|
21
|
+
auto jniValue = static_cast<const JVariant_NullType_SubscriptionPeriodValueIOS_impl::Second*>(this)->getValue();
|
|
22
|
+
return jniValue->toCpp();
|
|
23
|
+
}
|
|
24
|
+
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
+
}
|
|
26
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_SubscriptionPeriodValueIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include <NitroModules/Null.hpp>
|
|
14
|
+
#include "SubscriptionPeriodValueIOS.hpp"
|
|
15
|
+
#include <variant>
|
|
16
|
+
#include <NitroModules/JNull.hpp>
|
|
17
|
+
#include "JSubscriptionPeriodValueIOS.hpp"
|
|
18
|
+
#include "SubscriptionPeriodIOS.hpp"
|
|
19
|
+
#include "JSubscriptionPeriodIOS.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::iap {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_SubscriptionPeriodValueIOS".
|
|
27
|
+
*/
|
|
28
|
+
class JVariant_NullType_SubscriptionPeriodValueIOS: public jni::JavaClass<JVariant_NullType_SubscriptionPeriodValueIOS> {
|
|
29
|
+
public:
|
|
30
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS;";
|
|
31
|
+
|
|
32
|
+
static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> create_0(jni::alias_ref<JNull> value) {
|
|
33
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_SubscriptionPeriodValueIOS(jni::alias_ref<JNull>)>("create");
|
|
34
|
+
return method(javaClassStatic(), value);
|
|
35
|
+
}
|
|
36
|
+
static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> create_1(jni::alias_ref<JSubscriptionPeriodValueIOS> value) {
|
|
37
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_SubscriptionPeriodValueIOS(jni::alias_ref<JSubscriptionPeriodValueIOS>)>("create");
|
|
38
|
+
return method(javaClassStatic(), value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> fromCpp(const std::variant<nitro::NullType, SubscriptionPeriodValueIOS>& variant) {
|
|
42
|
+
switch (variant.index()) {
|
|
43
|
+
case 0: return create_0(JNull::null());
|
|
44
|
+
case 1: return create_1(JSubscriptionPeriodValueIOS::fromCpp(std::get<1>(variant)));
|
|
45
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[[nodiscard]] std::variant<nitro::NullType, SubscriptionPeriodValueIOS> toCpp() const;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
namespace JVariant_NullType_SubscriptionPeriodValueIOS_impl {
|
|
53
|
+
class First final: public jni::JavaClass<First, JVariant_NullType_SubscriptionPeriodValueIOS> {
|
|
54
|
+
public:
|
|
55
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS$First;";
|
|
56
|
+
|
|
57
|
+
[[nodiscard]] jni::local_ref<JNull> getValue() const {
|
|
58
|
+
static const auto field = javaClassStatic()->getField<JNull>("value");
|
|
59
|
+
return getFieldValue(field);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
class Second final: public jni::JavaClass<Second, JVariant_NullType_SubscriptionPeriodValueIOS> {
|
|
64
|
+
public:
|
|
65
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS$Second;";
|
|
66
|
+
|
|
67
|
+
[[nodiscard]] jni::local_ref<JSubscriptionPeriodValueIOS> getValue() const {
|
|
68
|
+
static const auto field = javaClassStatic()->getField<JSubscriptionPeriodValueIOS>("value");
|
|
69
|
+
return getFieldValue(field);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} // namespace JVariant_NullType_SubscriptionPeriodValueIOS_impl
|
|
73
|
+
} // namespace margelo::nitro::iap
|
|
@@ -32,6 +32,9 @@ data class AdvancedCommerceInfoIOS(
|
|
|
32
32
|
val items: Array<AdvancedCommerceItemIOS>,
|
|
33
33
|
@DoNotStrip
|
|
34
34
|
@Keep
|
|
35
|
+
val period: Variant_NullType_SubscriptionPeriodValueIOS?,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
35
38
|
val requestReferenceId: Variant_NullType_String?,
|
|
36
39
|
@DoNotStrip
|
|
37
40
|
@Keep
|
|
@@ -52,6 +55,7 @@ data class AdvancedCommerceInfoIOS(
|
|
|
52
55
|
&& Objects.deepEquals(this.displayName, other.displayName)
|
|
53
56
|
&& Objects.deepEquals(this.estimatedTax, other.estimatedTax)
|
|
54
57
|
&& Objects.deepEquals(this.items, other.items)
|
|
58
|
+
&& Objects.deepEquals(this.period, other.period)
|
|
55
59
|
&& Objects.deepEquals(this.requestReferenceId, other.requestReferenceId)
|
|
56
60
|
&& Objects.deepEquals(this.taxCode, other.taxCode)
|
|
57
61
|
&& Objects.deepEquals(this.taxExclusivePrice, other.taxExclusivePrice)
|
|
@@ -64,6 +68,7 @@ data class AdvancedCommerceInfoIOS(
|
|
|
64
68
|
displayName,
|
|
65
69
|
estimatedTax,
|
|
66
70
|
items,
|
|
71
|
+
period,
|
|
67
72
|
requestReferenceId,
|
|
68
73
|
taxCode,
|
|
69
74
|
taxExclusivePrice,
|
|
@@ -79,8 +84,8 @@ data class AdvancedCommerceInfoIOS(
|
|
|
79
84
|
@Keep
|
|
80
85
|
@Suppress("unused")
|
|
81
86
|
@JvmStatic
|
|
82
|
-
private fun fromCpp(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: Array<AdvancedCommerceItemIOS>, requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?): AdvancedCommerceInfoIOS {
|
|
83
|
-
return AdvancedCommerceInfoIOS(description, displayName, estimatedTax, items, requestReferenceId, taxCode, taxExclusivePrice, taxRate)
|
|
87
|
+
private fun fromCpp(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: Array<AdvancedCommerceItemIOS>, period: Variant_NullType_SubscriptionPeriodValueIOS?, requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?): AdvancedCommerceInfoIOS {
|
|
88
|
+
return AdvancedCommerceInfoIOS(description, displayName, estimatedTax, items, period, requestReferenceId, taxCode, taxExclusivePrice, taxRate)
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
}
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_DeveloperProvidedBillingDetailsAndroid_cxx: Func_void_DeveloperP
|
|
|
59
58
|
override fun invoke(details: DeveloperProvidedBillingDetailsAndroid): Unit
|
|
60
59
|
= invoke_cxx(details)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(details: DeveloperProvidedBillingDetailsAndroid): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_NitroProduct_cxx: Func_void_NitroProduct {
|
|
|
59
58
|
override fun invoke(product: NitroProduct): Unit
|
|
60
59
|
= invoke_cxx(product)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(product: NitroProduct): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_NitroPurchase_cxx: Func_void_NitroPurchase {
|
|
|
59
58
|
override fun invoke(purchase: NitroPurchase): Unit
|
|
60
59
|
= invoke_cxx(purchase)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(purchase: NitroPurchase): Unit
|
|
64
62
|
}
|
|
65
63
|
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchaseResult.kt
CHANGED
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_NitroPurchaseResult_cxx: Func_void_NitroPurchaseResult {
|
|
|
59
58
|
override fun invoke(error: NitroPurchaseResult): Unit
|
|
60
59
|
= invoke_cxx(error)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(error: NitroPurchaseResult): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_UserChoiceBillingDetails_cxx: Func_void_UserChoiceBillingDetails
|
|
|
59
58
|
override fun invoke(details: UserChoiceBillingDetails): Unit
|
|
60
59
|
= invoke_cxx(details)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(details: UserChoiceBillingDetails): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.iap
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
13
14
|
import com.margelo.nitro.core.Promise
|
|
14
15
|
import com.margelo.nitro.core.NullType
|
|
15
16
|
import com.margelo.nitro.core.HybridObject
|
|
@@ -319,6 +320,7 @@ abstract class HybridRnIapSpec: HybridObject() {
|
|
|
319
320
|
@Keep
|
|
320
321
|
protected open class CxxPart(javaPart: HybridRnIapSpec): HybridObject.CxxPart(javaPart) {
|
|
321
322
|
// C++ JHybridRnIapSpec::CxxPart::initHybrid(...)
|
|
323
|
+
@FastNative
|
|
322
324
|
external override fun initHybrid(): HybridData
|
|
323
325
|
}
|
|
324
326
|
override fun createCxxPart(): CxxPart {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SubscriptionPeriodIOS.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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 "SubscriptionPeriodIOS".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class SubscriptionPeriodIOS(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
EMPTY(0),
|
|
20
|
+
DAY(1),
|
|
21
|
+
WEEK(2),
|
|
22
|
+
MONTH(3),
|
|
23
|
+
YEAR(4);
|
|
24
|
+
|
|
25
|
+
companion object
|
|
26
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SubscriptionPeriodValueIOS.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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 java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "SubscriptionPeriodValueIOS".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class SubscriptionPeriodValueIOS(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val unit: SubscriptionPeriodIOS,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val value: Double
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is SubscriptionPeriodValueIOS) return false
|
|
33
|
+
return Objects.deepEquals(this.unit, other.unit)
|
|
34
|
+
&& Objects.deepEquals(this.value, other.value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
unit,
|
|
40
|
+
value
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(unit: SubscriptionPeriodIOS, value: Double): SubscriptionPeriodValueIOS {
|
|
53
|
+
return SubscriptionPeriodValueIOS(unit, value)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_SubscriptionPeriodValueIOS.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.iap
|
|
9
|
+
|
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
11
|
+
import com.margelo.nitro.core.NullType
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the TypeScript variant "NullType | SubscriptionPeriodValueIOS".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_NullType_SubscriptionPeriodValueIOS {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: NullType): Variant_NullType_SubscriptionPeriodValueIOS()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: SubscriptionPeriodValueIOS): Variant_NullType_SubscriptionPeriodValueIOS()
|
|
23
|
+
|
|
24
|
+
inline fun <reified T> asType(): T? {
|
|
25
|
+
return when (this) {
|
|
26
|
+
is First -> (value) as? T
|
|
27
|
+
is Second -> (value) as? T
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
inline fun <reified T> isType(): Boolean {
|
|
31
|
+
return asType<T>() != null
|
|
32
|
+
}
|
|
33
|
+
inline fun <R> match(first: (NullType) -> R, second: (SubscriptionPeriodValueIOS) -> R): R {
|
|
34
|
+
return when (this) {
|
|
35
|
+
is First -> first(value)
|
|
36
|
+
is Second -> second(value)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
val isFirst: Boolean
|
|
41
|
+
get() = this is First
|
|
42
|
+
val isSecond: Boolean
|
|
43
|
+
get() = this is Second
|
|
44
|
+
|
|
45
|
+
fun asFirstOrNull(): NullType? {
|
|
46
|
+
val value = (this as? First)?.value ?: return null
|
|
47
|
+
return value
|
|
48
|
+
}
|
|
49
|
+
fun asSecondOrNull(): SubscriptionPeriodValueIOS? {
|
|
50
|
+
val value = (this as? Second)?.value ?: return null
|
|
51
|
+
return value
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
@JvmStatic
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
fun create(value: NullType): Variant_NullType_SubscriptionPeriodValueIOS = First(value)
|
|
58
|
+
@JvmStatic
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
fun create(value: SubscriptionPeriodValueIOS): Variant_NullType_SubscriptionPeriodValueIOS = Second(value)
|
|
61
|
+
}
|
|
62
|
+
}
|