react-native-iap 14.4.10 → 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 +195 -12
- package/ios/HybridRnIap.swift +115 -2
- package/ios/RnIapHelper.swift +32 -1
- 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/module/utils/type-bridge.js +39 -1
- package/lib/module/utils/type-bridge.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 +101 -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/lib/typescript/src/utils/type-bridge.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_NitroProduct.hpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +136 -3
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +16 -2
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +74 -2
- 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/NitroOneTimePurchaseOfferDetail.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +10 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +55 -1
- 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 +174 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +21 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +84 -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/NitroOneTimePurchaseOfferDetail.swift +57 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +91 -1
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +520 -1
- 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++/NitroOneTimePurchaseOfferDetail.hpp +75 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +17 -2
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +74 -2
- 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 +3 -3
- 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 +131 -1
- package/src/types.ts +124 -13
- package/src/utils/type-bridge.ts +76 -16
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_UserChoiceBillingDetails.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 <functional>
|
|
12
|
+
|
|
13
|
+
#include "UserChoiceBillingDetails.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include "JUserChoiceBillingDetails.hpp"
|
|
16
|
+
#include <string>
|
|
17
|
+
#include <vector>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::iap {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(details: UserChoiceBillingDetails) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_UserChoiceBillingDetails: public jni::JavaClass<JFunc_void_UserChoiceBillingDetails> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Func_void_UserChoiceBillingDetails;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_UserChoiceBillingDetails` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const UserChoiceBillingDetails& details) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JUserChoiceBillingDetails> /* details */)>("invoke");
|
|
37
|
+
method(self(), JUserChoiceBillingDetails::fromCpp(details));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_UserChoiceBillingDetails that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
struct JFunc_void_UserChoiceBillingDetails_cxx final: public jni::HybridClass<JFunc_void_UserChoiceBillingDetails_cxx, JFunc_void_UserChoiceBillingDetails> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_UserChoiceBillingDetails::javaobject> fromCpp(const std::function<void(const UserChoiceBillingDetails& /* details */)>& func) {
|
|
47
|
+
return JFunc_void_UserChoiceBillingDetails_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_UserChoiceBillingDetails_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<JUserChoiceBillingDetails> details) {
|
|
55
|
+
_func(details->toCpp());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const UserChoiceBillingDetails& /* details */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Func_void_UserChoiceBillingDetails_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_UserChoiceBillingDetails_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_UserChoiceBillingDetails_cxx(const std::function<void(const UserChoiceBillingDetails& /* details */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const UserChoiceBillingDetails& /* details */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::iap
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
namespace margelo::nitro::iap { struct NitroProduct; }
|
|
12
12
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
13
13
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
14
|
+
// Forward declaration of `NitroOneTimePurchaseOfferDetail` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::iap { struct NitroOneTimePurchaseOfferDetail; }
|
|
14
16
|
// Forward declaration of `PurchaseAndroid` to properly resolve imports.
|
|
15
17
|
namespace margelo::nitro::iap { struct PurchaseAndroid; }
|
|
16
18
|
// Forward declaration of `PurchaseIOS` to properly resolve imports.
|
|
@@ -31,6 +33,16 @@ namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
|
31
33
|
namespace margelo::nitro::iap { struct NitroReceiptValidationResultIOS; }
|
|
32
34
|
// Forward declaration of `NitroReceiptValidationResultAndroid` to properly resolve imports.
|
|
33
35
|
namespace margelo::nitro::iap { struct NitroReceiptValidationResultAndroid; }
|
|
36
|
+
// Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
|
|
37
|
+
namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
|
|
38
|
+
// Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::iap { enum class ExternalPurchaseNoticeAction; }
|
|
40
|
+
// Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
42
|
+
// Forward declaration of `InitConnectionConfig` to properly resolve imports.
|
|
43
|
+
namespace margelo::nitro::iap { struct InitConnectionConfig; }
|
|
44
|
+
// Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
|
|
45
|
+
namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
|
|
34
46
|
// Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
|
|
35
47
|
namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
|
|
36
48
|
// Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
|
|
@@ -59,6 +71,8 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationParams; }
|
|
|
59
71
|
namespace margelo::nitro::iap { struct NitroReceiptValidationAndroidOptions; }
|
|
60
72
|
// Forward declaration of `NitroDeepLinkOptionsAndroid` to properly resolve imports.
|
|
61
73
|
namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
74
|
+
// Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
|
|
75
|
+
namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
62
76
|
|
|
63
77
|
#include <NitroModules/Promise.hpp>
|
|
64
78
|
#include <NitroModules/JPromise.hpp>
|
|
@@ -69,6 +83,8 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
69
83
|
#include <optional>
|
|
70
84
|
#include "IapPlatform.hpp"
|
|
71
85
|
#include "JIapPlatform.hpp"
|
|
86
|
+
#include "NitroOneTimePurchaseOfferDetail.hpp"
|
|
87
|
+
#include "JNitroOneTimePurchaseOfferDetail.hpp"
|
|
72
88
|
#include "PurchaseAndroid.hpp"
|
|
73
89
|
#include "PurchaseIOS.hpp"
|
|
74
90
|
#include <variant>
|
|
@@ -94,6 +110,16 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
94
110
|
#include "JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp"
|
|
95
111
|
#include "JNitroReceiptValidationResultIOS.hpp"
|
|
96
112
|
#include "JNitroReceiptValidationResultAndroid.hpp"
|
|
113
|
+
#include "ExternalPurchaseNoticeResultIOS.hpp"
|
|
114
|
+
#include "JExternalPurchaseNoticeResultIOS.hpp"
|
|
115
|
+
#include "ExternalPurchaseNoticeAction.hpp"
|
|
116
|
+
#include "JExternalPurchaseNoticeAction.hpp"
|
|
117
|
+
#include "ExternalPurchaseLinkResultIOS.hpp"
|
|
118
|
+
#include "JExternalPurchaseLinkResultIOS.hpp"
|
|
119
|
+
#include "InitConnectionConfig.hpp"
|
|
120
|
+
#include "JInitConnectionConfig.hpp"
|
|
121
|
+
#include "AlternativeBillingModeAndroid.hpp"
|
|
122
|
+
#include "JAlternativeBillingModeAndroid.hpp"
|
|
97
123
|
#include "NitroPurchaseRequest.hpp"
|
|
98
124
|
#include "JNitroPurchaseRequest.hpp"
|
|
99
125
|
#include "NitroRequestPurchaseIos.hpp"
|
|
@@ -127,6 +153,9 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
|
127
153
|
#include "JNitroReceiptValidationAndroidOptions.hpp"
|
|
128
154
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
129
155
|
#include "JNitroDeepLinkOptionsAndroid.hpp"
|
|
156
|
+
#include "UserChoiceBillingDetails.hpp"
|
|
157
|
+
#include "JFunc_void_UserChoiceBillingDetails.hpp"
|
|
158
|
+
#include "JUserChoiceBillingDetails.hpp"
|
|
130
159
|
|
|
131
160
|
namespace margelo::nitro::iap {
|
|
132
161
|
|
|
@@ -154,9 +183,9 @@ namespace margelo::nitro::iap {
|
|
|
154
183
|
|
|
155
184
|
|
|
156
185
|
// Methods
|
|
157
|
-
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::initConnection() {
|
|
158
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("initConnection");
|
|
159
|
-
auto __result = method(_javaPart);
|
|
186
|
+
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::initConnection(const std::optional<InitConnectionConfig>& config) {
|
|
187
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JInitConnectionConfig> /* config */)>("initConnection");
|
|
188
|
+
auto __result = method(_javaPart, config.has_value() ? JInitConnectionConfig::fromCpp(config.value()) : nullptr);
|
|
160
189
|
return [&]() {
|
|
161
190
|
auto __promise = Promise<bool>::create();
|
|
162
191
|
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
@@ -708,5 +737,109 @@ namespace margelo::nitro::iap {
|
|
|
708
737
|
return __promise;
|
|
709
738
|
}();
|
|
710
739
|
}
|
|
740
|
+
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::checkAlternativeBillingAvailabilityAndroid() {
|
|
741
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("checkAlternativeBillingAvailabilityAndroid");
|
|
742
|
+
auto __result = method(_javaPart);
|
|
743
|
+
return [&]() {
|
|
744
|
+
auto __promise = Promise<bool>::create();
|
|
745
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
746
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
747
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
748
|
+
});
|
|
749
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
750
|
+
jni::JniException __jniError(__throwable);
|
|
751
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
752
|
+
});
|
|
753
|
+
return __promise;
|
|
754
|
+
}();
|
|
755
|
+
}
|
|
756
|
+
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::showAlternativeBillingDialogAndroid() {
|
|
757
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("showAlternativeBillingDialogAndroid");
|
|
758
|
+
auto __result = method(_javaPart);
|
|
759
|
+
return [&]() {
|
|
760
|
+
auto __promise = Promise<bool>::create();
|
|
761
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
762
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
763
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
764
|
+
});
|
|
765
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
766
|
+
jni::JniException __jniError(__throwable);
|
|
767
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
768
|
+
});
|
|
769
|
+
return __promise;
|
|
770
|
+
}();
|
|
771
|
+
}
|
|
772
|
+
std::shared_ptr<Promise<std::optional<std::string>>> JHybridRnIapSpec::createAlternativeBillingTokenAndroid(const std::optional<std::string>& sku) {
|
|
773
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* sku */)>("createAlternativeBillingTokenAndroid");
|
|
774
|
+
auto __result = method(_javaPart, sku.has_value() ? jni::make_jstring(sku.value()) : nullptr);
|
|
775
|
+
return [&]() {
|
|
776
|
+
auto __promise = Promise<std::optional<std::string>>::create();
|
|
777
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
778
|
+
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
779
|
+
__promise->resolve(__result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt);
|
|
780
|
+
});
|
|
781
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
782
|
+
jni::JniException __jniError(__throwable);
|
|
783
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
784
|
+
});
|
|
785
|
+
return __promise;
|
|
786
|
+
}();
|
|
787
|
+
}
|
|
788
|
+
void JHybridRnIapSpec::addUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) {
|
|
789
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_UserChoiceBillingDetails::javaobject> /* listener */)>("addUserChoiceBillingListenerAndroid_cxx");
|
|
790
|
+
method(_javaPart, JFunc_void_UserChoiceBillingDetails_cxx::fromCpp(listener));
|
|
791
|
+
}
|
|
792
|
+
void JHybridRnIapSpec::removeUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) {
|
|
793
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_UserChoiceBillingDetails::javaobject> /* listener */)>("removeUserChoiceBillingListenerAndroid_cxx");
|
|
794
|
+
method(_javaPart, JFunc_void_UserChoiceBillingDetails_cxx::fromCpp(listener));
|
|
795
|
+
}
|
|
796
|
+
std::shared_ptr<Promise<bool>> JHybridRnIapSpec::canPresentExternalPurchaseNoticeIOS() {
|
|
797
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("canPresentExternalPurchaseNoticeIOS");
|
|
798
|
+
auto __result = method(_javaPart);
|
|
799
|
+
return [&]() {
|
|
800
|
+
auto __promise = Promise<bool>::create();
|
|
801
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
802
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
803
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
804
|
+
});
|
|
805
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
806
|
+
jni::JniException __jniError(__throwable);
|
|
807
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
808
|
+
});
|
|
809
|
+
return __promise;
|
|
810
|
+
}();
|
|
811
|
+
}
|
|
812
|
+
std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> JHybridRnIapSpec::presentExternalPurchaseNoticeSheetIOS() {
|
|
813
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("presentExternalPurchaseNoticeSheetIOS");
|
|
814
|
+
auto __result = method(_javaPart);
|
|
815
|
+
return [&]() {
|
|
816
|
+
auto __promise = Promise<ExternalPurchaseNoticeResultIOS>::create();
|
|
817
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
818
|
+
auto __result = jni::static_ref_cast<JExternalPurchaseNoticeResultIOS>(__boxedResult);
|
|
819
|
+
__promise->resolve(__result->toCpp());
|
|
820
|
+
});
|
|
821
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
822
|
+
jni::JniException __jniError(__throwable);
|
|
823
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
824
|
+
});
|
|
825
|
+
return __promise;
|
|
826
|
+
}();
|
|
827
|
+
}
|
|
828
|
+
std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> JHybridRnIapSpec::presentExternalPurchaseLinkIOS(const std::string& url) {
|
|
829
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* url */)>("presentExternalPurchaseLinkIOS");
|
|
830
|
+
auto __result = method(_javaPart, jni::make_jstring(url));
|
|
831
|
+
return [&]() {
|
|
832
|
+
auto __promise = Promise<ExternalPurchaseLinkResultIOS>::create();
|
|
833
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
834
|
+
auto __result = jni::static_ref_cast<JExternalPurchaseLinkResultIOS>(__boxedResult);
|
|
835
|
+
__promise->resolve(__result->toCpp());
|
|
836
|
+
});
|
|
837
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
838
|
+
jni::JniException __jniError(__throwable);
|
|
839
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
840
|
+
});
|
|
841
|
+
return __promise;
|
|
842
|
+
}();
|
|
843
|
+
}
|
|
711
844
|
|
|
712
845
|
} // namespace margelo::nitro::iap
|
|
@@ -53,7 +53,7 @@ namespace margelo::nitro::iap {
|
|
|
53
53
|
|
|
54
54
|
public:
|
|
55
55
|
// Methods
|
|
56
|
-
std::shared_ptr<Promise<bool>> initConnection() override;
|
|
56
|
+
std::shared_ptr<Promise<bool>> initConnection(const std::optional<InitConnectionConfig>& config) override;
|
|
57
57
|
std::shared_ptr<Promise<bool>> endConnection() override;
|
|
58
58
|
std::shared_ptr<Promise<std::vector<NitroProduct>>> fetchProducts(const std::vector<std::string>& skus, const std::string& type) override;
|
|
59
59
|
std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> requestPurchase(const NitroPurchaseRequest& request) override;
|
|
@@ -89,6 +89,14 @@ namespace margelo::nitro::iap {
|
|
|
89
89
|
std::shared_ptr<Promise<std::variant<NitroReceiptValidationResultIOS, NitroReceiptValidationResultAndroid>>> validateReceipt(const NitroReceiptValidationParams& params) override;
|
|
90
90
|
std::shared_ptr<Promise<std::string>> getStorefront() override;
|
|
91
91
|
std::shared_ptr<Promise<void>> deepLinkToSubscriptionsAndroid(const NitroDeepLinkOptionsAndroid& options) override;
|
|
92
|
+
std::shared_ptr<Promise<bool>> checkAlternativeBillingAvailabilityAndroid() override;
|
|
93
|
+
std::shared_ptr<Promise<bool>> showAlternativeBillingDialogAndroid() override;
|
|
94
|
+
std::shared_ptr<Promise<std::optional<std::string>>> createAlternativeBillingTokenAndroid(const std::optional<std::string>& sku) override;
|
|
95
|
+
void addUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) override;
|
|
96
|
+
void removeUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) override;
|
|
97
|
+
std::shared_ptr<Promise<bool>> canPresentExternalPurchaseNoticeIOS() override;
|
|
98
|
+
std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> presentExternalPurchaseNoticeSheetIOS() override;
|
|
99
|
+
std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> presentExternalPurchaseLinkIOS(const std::string& url) override;
|
|
92
100
|
|
|
93
101
|
private:
|
|
94
102
|
friend HybridBase;
|
|
@@ -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
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroOneTimePurchaseOfferDetail.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 "NitroOneTimePurchaseOfferDetail.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::iap {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "NitroOneTimePurchaseOfferDetail" and the the Kotlin data class "NitroOneTimePurchaseOfferDetail".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroOneTimePurchaseOfferDetail final: public jni::JavaClass<JNitroOneTimePurchaseOfferDetail> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroOneTimePurchaseOfferDetail by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroOneTimePurchaseOfferDetail toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldFormattedPrice = clazz->getField<jni::JString>("formattedPrice");
|
|
35
|
+
jni::local_ref<jni::JString> formattedPrice = this->getFieldValue(fieldFormattedPrice);
|
|
36
|
+
static const auto fieldPriceAmountMicros = clazz->getField<jni::JString>("priceAmountMicros");
|
|
37
|
+
jni::local_ref<jni::JString> priceAmountMicros = this->getFieldValue(fieldPriceAmountMicros);
|
|
38
|
+
static const auto fieldPriceCurrencyCode = clazz->getField<jni::JString>("priceCurrencyCode");
|
|
39
|
+
jni::local_ref<jni::JString> priceCurrencyCode = this->getFieldValue(fieldPriceCurrencyCode);
|
|
40
|
+
return NitroOneTimePurchaseOfferDetail(
|
|
41
|
+
formattedPrice->toStdString(),
|
|
42
|
+
priceAmountMicros->toStdString(),
|
|
43
|
+
priceCurrencyCode->toStdString()
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
+
*/
|
|
51
|
+
[[maybe_unused]]
|
|
52
|
+
static jni::local_ref<JNitroOneTimePurchaseOfferDetail::javaobject> fromCpp(const NitroOneTimePurchaseOfferDetail& value) {
|
|
53
|
+
return newInstance(
|
|
54
|
+
jni::make_jstring(value.formattedPrice),
|
|
55
|
+
jni::make_jstring(value.priceAmountMicros),
|
|
56
|
+
jni::make_jstring(value.priceCurrencyCode)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::iap
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
#include "IapPlatform.hpp"
|
|
14
14
|
#include "JIapPlatform.hpp"
|
|
15
|
+
#include "JNitroOneTimePurchaseOfferDetail.hpp"
|
|
16
|
+
#include "NitroOneTimePurchaseOfferDetail.hpp"
|
|
15
17
|
#include <optional>
|
|
16
18
|
#include <string>
|
|
17
19
|
|
|
@@ -58,6 +60,8 @@ namespace margelo::nitro::iap {
|
|
|
58
60
|
jni::local_ref<jni::JBoolean> isFamilyShareableIOS = this->getFieldValue(fieldIsFamilyShareableIOS);
|
|
59
61
|
static const auto fieldJsonRepresentationIOS = clazz->getField<jni::JString>("jsonRepresentationIOS");
|
|
60
62
|
jni::local_ref<jni::JString> jsonRepresentationIOS = this->getFieldValue(fieldJsonRepresentationIOS);
|
|
63
|
+
static const auto fieldDiscountsIOS = clazz->getField<jni::JString>("discountsIOS");
|
|
64
|
+
jni::local_ref<jni::JString> discountsIOS = this->getFieldValue(fieldDiscountsIOS);
|
|
61
65
|
static const auto fieldIntroductoryPriceIOS = clazz->getField<jni::JString>("introductoryPriceIOS");
|
|
62
66
|
jni::local_ref<jni::JString> introductoryPriceIOS = this->getFieldValue(fieldIntroductoryPriceIOS);
|
|
63
67
|
static const auto fieldIntroductoryPriceAsAmountIOS = clazz->getField<jni::JDouble>("introductoryPriceAsAmountIOS");
|
|
@@ -72,6 +76,8 @@ namespace margelo::nitro::iap {
|
|
|
72
76
|
jni::local_ref<jni::JDouble> subscriptionPeriodNumberIOS = this->getFieldValue(fieldSubscriptionPeriodNumberIOS);
|
|
73
77
|
static const auto fieldSubscriptionPeriodUnitIOS = clazz->getField<jni::JString>("subscriptionPeriodUnitIOS");
|
|
74
78
|
jni::local_ref<jni::JString> subscriptionPeriodUnitIOS = this->getFieldValue(fieldSubscriptionPeriodUnitIOS);
|
|
79
|
+
static const auto fieldNameAndroid = clazz->getField<jni::JString>("nameAndroid");
|
|
80
|
+
jni::local_ref<jni::JString> nameAndroid = this->getFieldValue(fieldNameAndroid);
|
|
75
81
|
static const auto fieldOriginalPriceAndroid = clazz->getField<jni::JString>("originalPriceAndroid");
|
|
76
82
|
jni::local_ref<jni::JString> originalPriceAndroid = this->getFieldValue(fieldOriginalPriceAndroid);
|
|
77
83
|
static const auto fieldOriginalPriceAmountMicrosAndroid = clazz->getField<jni::JDouble>("originalPriceAmountMicrosAndroid");
|
|
@@ -88,6 +94,8 @@ namespace margelo::nitro::iap {
|
|
|
88
94
|
jni::local_ref<jni::JString> freeTrialPeriodAndroid = this->getFieldValue(fieldFreeTrialPeriodAndroid);
|
|
89
95
|
static const auto fieldSubscriptionOfferDetailsAndroid = clazz->getField<jni::JString>("subscriptionOfferDetailsAndroid");
|
|
90
96
|
jni::local_ref<jni::JString> subscriptionOfferDetailsAndroid = this->getFieldValue(fieldSubscriptionOfferDetailsAndroid);
|
|
97
|
+
static const auto fieldOneTimePurchaseOfferDetailsAndroid = clazz->getField<JNitroOneTimePurchaseOfferDetail>("oneTimePurchaseOfferDetailsAndroid");
|
|
98
|
+
jni::local_ref<JNitroOneTimePurchaseOfferDetail> oneTimePurchaseOfferDetailsAndroid = this->getFieldValue(fieldOneTimePurchaseOfferDetailsAndroid);
|
|
91
99
|
return NitroProduct(
|
|
92
100
|
id->toStdString(),
|
|
93
101
|
title->toStdString(),
|
|
@@ -101,6 +109,7 @@ namespace margelo::nitro::iap {
|
|
|
101
109
|
typeIOS != nullptr ? std::make_optional(typeIOS->toStdString()) : std::nullopt,
|
|
102
110
|
isFamilyShareableIOS != nullptr ? std::make_optional(static_cast<bool>(isFamilyShareableIOS->value())) : std::nullopt,
|
|
103
111
|
jsonRepresentationIOS != nullptr ? std::make_optional(jsonRepresentationIOS->toStdString()) : std::nullopt,
|
|
112
|
+
discountsIOS != nullptr ? std::make_optional(discountsIOS->toStdString()) : std::nullopt,
|
|
104
113
|
introductoryPriceIOS != nullptr ? std::make_optional(introductoryPriceIOS->toStdString()) : std::nullopt,
|
|
105
114
|
introductoryPriceAsAmountIOS != nullptr ? std::make_optional(introductoryPriceAsAmountIOS->value()) : std::nullopt,
|
|
106
115
|
introductoryPriceNumberOfPeriodsIOS != nullptr ? std::make_optional(introductoryPriceNumberOfPeriodsIOS->value()) : std::nullopt,
|
|
@@ -108,6 +117,7 @@ namespace margelo::nitro::iap {
|
|
|
108
117
|
introductoryPriceSubscriptionPeriodIOS != nullptr ? std::make_optional(introductoryPriceSubscriptionPeriodIOS->toStdString()) : std::nullopt,
|
|
109
118
|
subscriptionPeriodNumberIOS != nullptr ? std::make_optional(subscriptionPeriodNumberIOS->value()) : std::nullopt,
|
|
110
119
|
subscriptionPeriodUnitIOS != nullptr ? std::make_optional(subscriptionPeriodUnitIOS->toStdString()) : std::nullopt,
|
|
120
|
+
nameAndroid != nullptr ? std::make_optional(nameAndroid->toStdString()) : std::nullopt,
|
|
111
121
|
originalPriceAndroid != nullptr ? std::make_optional(originalPriceAndroid->toStdString()) : std::nullopt,
|
|
112
122
|
originalPriceAmountMicrosAndroid != nullptr ? std::make_optional(originalPriceAmountMicrosAndroid->value()) : std::nullopt,
|
|
113
123
|
introductoryPriceCyclesAndroid != nullptr ? std::make_optional(introductoryPriceCyclesAndroid->value()) : std::nullopt,
|
|
@@ -115,7 +125,8 @@ namespace margelo::nitro::iap {
|
|
|
115
125
|
introductoryPriceValueAndroid != nullptr ? std::make_optional(introductoryPriceValueAndroid->value()) : std::nullopt,
|
|
116
126
|
subscriptionPeriodAndroid != nullptr ? std::make_optional(subscriptionPeriodAndroid->toStdString()) : std::nullopt,
|
|
117
127
|
freeTrialPeriodAndroid != nullptr ? std::make_optional(freeTrialPeriodAndroid->toStdString()) : std::nullopt,
|
|
118
|
-
subscriptionOfferDetailsAndroid != nullptr ? std::make_optional(subscriptionOfferDetailsAndroid->toStdString()) : std::nullopt
|
|
128
|
+
subscriptionOfferDetailsAndroid != nullptr ? std::make_optional(subscriptionOfferDetailsAndroid->toStdString()) : std::nullopt,
|
|
129
|
+
oneTimePurchaseOfferDetailsAndroid != nullptr ? std::make_optional(oneTimePurchaseOfferDetailsAndroid->toCpp()) : std::nullopt
|
|
119
130
|
);
|
|
120
131
|
}
|
|
121
132
|
|
|
@@ -138,6 +149,7 @@ namespace margelo::nitro::iap {
|
|
|
138
149
|
value.typeIOS.has_value() ? jni::make_jstring(value.typeIOS.value()) : nullptr,
|
|
139
150
|
value.isFamilyShareableIOS.has_value() ? jni::JBoolean::valueOf(value.isFamilyShareableIOS.value()) : nullptr,
|
|
140
151
|
value.jsonRepresentationIOS.has_value() ? jni::make_jstring(value.jsonRepresentationIOS.value()) : nullptr,
|
|
152
|
+
value.discountsIOS.has_value() ? jni::make_jstring(value.discountsIOS.value()) : nullptr,
|
|
141
153
|
value.introductoryPriceIOS.has_value() ? jni::make_jstring(value.introductoryPriceIOS.value()) : nullptr,
|
|
142
154
|
value.introductoryPriceAsAmountIOS.has_value() ? jni::JDouble::valueOf(value.introductoryPriceAsAmountIOS.value()) : nullptr,
|
|
143
155
|
value.introductoryPriceNumberOfPeriodsIOS.has_value() ? jni::JDouble::valueOf(value.introductoryPriceNumberOfPeriodsIOS.value()) : nullptr,
|
|
@@ -145,6 +157,7 @@ namespace margelo::nitro::iap {
|
|
|
145
157
|
value.introductoryPriceSubscriptionPeriodIOS.has_value() ? jni::make_jstring(value.introductoryPriceSubscriptionPeriodIOS.value()) : nullptr,
|
|
146
158
|
value.subscriptionPeriodNumberIOS.has_value() ? jni::JDouble::valueOf(value.subscriptionPeriodNumberIOS.value()) : nullptr,
|
|
147
159
|
value.subscriptionPeriodUnitIOS.has_value() ? jni::make_jstring(value.subscriptionPeriodUnitIOS.value()) : nullptr,
|
|
160
|
+
value.nameAndroid.has_value() ? jni::make_jstring(value.nameAndroid.value()) : nullptr,
|
|
148
161
|
value.originalPriceAndroid.has_value() ? jni::make_jstring(value.originalPriceAndroid.value()) : nullptr,
|
|
149
162
|
value.originalPriceAmountMicrosAndroid.has_value() ? jni::JDouble::valueOf(value.originalPriceAmountMicrosAndroid.value()) : nullptr,
|
|
150
163
|
value.introductoryPriceCyclesAndroid.has_value() ? jni::JDouble::valueOf(value.introductoryPriceCyclesAndroid.value()) : nullptr,
|
|
@@ -152,7 +165,8 @@ namespace margelo::nitro::iap {
|
|
|
152
165
|
value.introductoryPriceValueAndroid.has_value() ? jni::JDouble::valueOf(value.introductoryPriceValueAndroid.value()) : nullptr,
|
|
153
166
|
value.subscriptionPeriodAndroid.has_value() ? jni::make_jstring(value.subscriptionPeriodAndroid.value()) : nullptr,
|
|
154
167
|
value.freeTrialPeriodAndroid.has_value() ? jni::make_jstring(value.freeTrialPeriodAndroid.value()) : nullptr,
|
|
155
|
-
value.subscriptionOfferDetailsAndroid.has_value() ? jni::make_jstring(value.subscriptionOfferDetailsAndroid.value()) : nullptr
|
|
168
|
+
value.subscriptionOfferDetailsAndroid.has_value() ? jni::make_jstring(value.subscriptionOfferDetailsAndroid.value()) : nullptr,
|
|
169
|
+
value.oneTimePurchaseOfferDetailsAndroid.has_value() ? JNitroOneTimePurchaseOfferDetail::fromCpp(value.oneTimePurchaseOfferDetailsAndroid.value()) : nullptr
|
|
156
170
|
);
|
|
157
171
|
}
|
|
158
172
|
};
|
|
@@ -60,6 +60,40 @@ namespace margelo::nitro::iap {
|
|
|
60
60
|
jni::local_ref<jni::JString> originalTransactionIdentifierIOS = this->getFieldValue(fieldOriginalTransactionIdentifierIOS);
|
|
61
61
|
static const auto fieldAppAccountToken = clazz->getField<jni::JString>("appAccountToken");
|
|
62
62
|
jni::local_ref<jni::JString> appAccountToken = this->getFieldValue(fieldAppAccountToken);
|
|
63
|
+
static const auto fieldAppBundleIdIOS = clazz->getField<jni::JString>("appBundleIdIOS");
|
|
64
|
+
jni::local_ref<jni::JString> appBundleIdIOS = this->getFieldValue(fieldAppBundleIdIOS);
|
|
65
|
+
static const auto fieldCountryCodeIOS = clazz->getField<jni::JString>("countryCodeIOS");
|
|
66
|
+
jni::local_ref<jni::JString> countryCodeIOS = this->getFieldValue(fieldCountryCodeIOS);
|
|
67
|
+
static const auto fieldCurrencyCodeIOS = clazz->getField<jni::JString>("currencyCodeIOS");
|
|
68
|
+
jni::local_ref<jni::JString> currencyCodeIOS = this->getFieldValue(fieldCurrencyCodeIOS);
|
|
69
|
+
static const auto fieldCurrencySymbolIOS = clazz->getField<jni::JString>("currencySymbolIOS");
|
|
70
|
+
jni::local_ref<jni::JString> currencySymbolIOS = this->getFieldValue(fieldCurrencySymbolIOS);
|
|
71
|
+
static const auto fieldEnvironmentIOS = clazz->getField<jni::JString>("environmentIOS");
|
|
72
|
+
jni::local_ref<jni::JString> environmentIOS = this->getFieldValue(fieldEnvironmentIOS);
|
|
73
|
+
static const auto fieldExpirationDateIOS = clazz->getField<jni::JDouble>("expirationDateIOS");
|
|
74
|
+
jni::local_ref<jni::JDouble> expirationDateIOS = this->getFieldValue(fieldExpirationDateIOS);
|
|
75
|
+
static const auto fieldIsUpgradedIOS = clazz->getField<jni::JBoolean>("isUpgradedIOS");
|
|
76
|
+
jni::local_ref<jni::JBoolean> isUpgradedIOS = this->getFieldValue(fieldIsUpgradedIOS);
|
|
77
|
+
static const auto fieldOfferIOS = clazz->getField<jni::JString>("offerIOS");
|
|
78
|
+
jni::local_ref<jni::JString> offerIOS = this->getFieldValue(fieldOfferIOS);
|
|
79
|
+
static const auto fieldOwnershipTypeIOS = clazz->getField<jni::JString>("ownershipTypeIOS");
|
|
80
|
+
jni::local_ref<jni::JString> ownershipTypeIOS = this->getFieldValue(fieldOwnershipTypeIOS);
|
|
81
|
+
static const auto fieldReasonIOS = clazz->getField<jni::JString>("reasonIOS");
|
|
82
|
+
jni::local_ref<jni::JString> reasonIOS = this->getFieldValue(fieldReasonIOS);
|
|
83
|
+
static const auto fieldReasonStringRepresentationIOS = clazz->getField<jni::JString>("reasonStringRepresentationIOS");
|
|
84
|
+
jni::local_ref<jni::JString> reasonStringRepresentationIOS = this->getFieldValue(fieldReasonStringRepresentationIOS);
|
|
85
|
+
static const auto fieldRevocationDateIOS = clazz->getField<jni::JDouble>("revocationDateIOS");
|
|
86
|
+
jni::local_ref<jni::JDouble> revocationDateIOS = this->getFieldValue(fieldRevocationDateIOS);
|
|
87
|
+
static const auto fieldRevocationReasonIOS = clazz->getField<jni::JString>("revocationReasonIOS");
|
|
88
|
+
jni::local_ref<jni::JString> revocationReasonIOS = this->getFieldValue(fieldRevocationReasonIOS);
|
|
89
|
+
static const auto fieldStorefrontCountryCodeIOS = clazz->getField<jni::JString>("storefrontCountryCodeIOS");
|
|
90
|
+
jni::local_ref<jni::JString> storefrontCountryCodeIOS = this->getFieldValue(fieldStorefrontCountryCodeIOS);
|
|
91
|
+
static const auto fieldSubscriptionGroupIdIOS = clazz->getField<jni::JString>("subscriptionGroupIdIOS");
|
|
92
|
+
jni::local_ref<jni::JString> subscriptionGroupIdIOS = this->getFieldValue(fieldSubscriptionGroupIdIOS);
|
|
93
|
+
static const auto fieldTransactionReasonIOS = clazz->getField<jni::JString>("transactionReasonIOS");
|
|
94
|
+
jni::local_ref<jni::JString> transactionReasonIOS = this->getFieldValue(fieldTransactionReasonIOS);
|
|
95
|
+
static const auto fieldWebOrderLineItemIdIOS = clazz->getField<jni::JString>("webOrderLineItemIdIOS");
|
|
96
|
+
jni::local_ref<jni::JString> webOrderLineItemIdIOS = this->getFieldValue(fieldWebOrderLineItemIdIOS);
|
|
63
97
|
static const auto fieldPurchaseTokenAndroid = clazz->getField<jni::JString>("purchaseTokenAndroid");
|
|
64
98
|
jni::local_ref<jni::JString> purchaseTokenAndroid = this->getFieldValue(fieldPurchaseTokenAndroid);
|
|
65
99
|
static const auto fieldDataAndroid = clazz->getField<jni::JString>("dataAndroid");
|
|
@@ -78,6 +112,8 @@ namespace margelo::nitro::iap {
|
|
|
78
112
|
jni::local_ref<jni::JString> obfuscatedAccountIdAndroid = this->getFieldValue(fieldObfuscatedAccountIdAndroid);
|
|
79
113
|
static const auto fieldObfuscatedProfileIdAndroid = clazz->getField<jni::JString>("obfuscatedProfileIdAndroid");
|
|
80
114
|
jni::local_ref<jni::JString> obfuscatedProfileIdAndroid = this->getFieldValue(fieldObfuscatedProfileIdAndroid);
|
|
115
|
+
static const auto fieldDeveloperPayloadAndroid = clazz->getField<jni::JString>("developerPayloadAndroid");
|
|
116
|
+
jni::local_ref<jni::JString> developerPayloadAndroid = this->getFieldValue(fieldDeveloperPayloadAndroid);
|
|
81
117
|
return NitroPurchase(
|
|
82
118
|
id->toStdString(),
|
|
83
119
|
productId->toStdString(),
|
|
@@ -91,6 +127,23 @@ namespace margelo::nitro::iap {
|
|
|
91
127
|
originalTransactionDateIOS != nullptr ? std::make_optional(originalTransactionDateIOS->value()) : std::nullopt,
|
|
92
128
|
originalTransactionIdentifierIOS != nullptr ? std::make_optional(originalTransactionIdentifierIOS->toStdString()) : std::nullopt,
|
|
93
129
|
appAccountToken != nullptr ? std::make_optional(appAccountToken->toStdString()) : std::nullopt,
|
|
130
|
+
appBundleIdIOS != nullptr ? std::make_optional(appBundleIdIOS->toStdString()) : std::nullopt,
|
|
131
|
+
countryCodeIOS != nullptr ? std::make_optional(countryCodeIOS->toStdString()) : std::nullopt,
|
|
132
|
+
currencyCodeIOS != nullptr ? std::make_optional(currencyCodeIOS->toStdString()) : std::nullopt,
|
|
133
|
+
currencySymbolIOS != nullptr ? std::make_optional(currencySymbolIOS->toStdString()) : std::nullopt,
|
|
134
|
+
environmentIOS != nullptr ? std::make_optional(environmentIOS->toStdString()) : std::nullopt,
|
|
135
|
+
expirationDateIOS != nullptr ? std::make_optional(expirationDateIOS->value()) : std::nullopt,
|
|
136
|
+
isUpgradedIOS != nullptr ? std::make_optional(static_cast<bool>(isUpgradedIOS->value())) : std::nullopt,
|
|
137
|
+
offerIOS != nullptr ? std::make_optional(offerIOS->toStdString()) : std::nullopt,
|
|
138
|
+
ownershipTypeIOS != nullptr ? std::make_optional(ownershipTypeIOS->toStdString()) : std::nullopt,
|
|
139
|
+
reasonIOS != nullptr ? std::make_optional(reasonIOS->toStdString()) : std::nullopt,
|
|
140
|
+
reasonStringRepresentationIOS != nullptr ? std::make_optional(reasonStringRepresentationIOS->toStdString()) : std::nullopt,
|
|
141
|
+
revocationDateIOS != nullptr ? std::make_optional(revocationDateIOS->value()) : std::nullopt,
|
|
142
|
+
revocationReasonIOS != nullptr ? std::make_optional(revocationReasonIOS->toStdString()) : std::nullopt,
|
|
143
|
+
storefrontCountryCodeIOS != nullptr ? std::make_optional(storefrontCountryCodeIOS->toStdString()) : std::nullopt,
|
|
144
|
+
subscriptionGroupIdIOS != nullptr ? std::make_optional(subscriptionGroupIdIOS->toStdString()) : std::nullopt,
|
|
145
|
+
transactionReasonIOS != nullptr ? std::make_optional(transactionReasonIOS->toStdString()) : std::nullopt,
|
|
146
|
+
webOrderLineItemIdIOS != nullptr ? std::make_optional(webOrderLineItemIdIOS->toStdString()) : std::nullopt,
|
|
94
147
|
purchaseTokenAndroid != nullptr ? std::make_optional(purchaseTokenAndroid->toStdString()) : std::nullopt,
|
|
95
148
|
dataAndroid != nullptr ? std::make_optional(dataAndroid->toStdString()) : std::nullopt,
|
|
96
149
|
signatureAndroid != nullptr ? std::make_optional(signatureAndroid->toStdString()) : std::nullopt,
|
|
@@ -99,7 +152,8 @@ namespace margelo::nitro::iap {
|
|
|
99
152
|
isAcknowledgedAndroid != nullptr ? std::make_optional(static_cast<bool>(isAcknowledgedAndroid->value())) : std::nullopt,
|
|
100
153
|
packageNameAndroid != nullptr ? std::make_optional(packageNameAndroid->toStdString()) : std::nullopt,
|
|
101
154
|
obfuscatedAccountIdAndroid != nullptr ? std::make_optional(obfuscatedAccountIdAndroid->toStdString()) : std::nullopt,
|
|
102
|
-
obfuscatedProfileIdAndroid != nullptr ? std::make_optional(obfuscatedProfileIdAndroid->toStdString()) : std::nullopt
|
|
155
|
+
obfuscatedProfileIdAndroid != nullptr ? std::make_optional(obfuscatedProfileIdAndroid->toStdString()) : std::nullopt,
|
|
156
|
+
developerPayloadAndroid != nullptr ? std::make_optional(developerPayloadAndroid->toStdString()) : std::nullopt
|
|
103
157
|
);
|
|
104
158
|
}
|
|
105
159
|
|
|
@@ -122,6 +176,23 @@ namespace margelo::nitro::iap {
|
|
|
122
176
|
value.originalTransactionDateIOS.has_value() ? jni::JDouble::valueOf(value.originalTransactionDateIOS.value()) : nullptr,
|
|
123
177
|
value.originalTransactionIdentifierIOS.has_value() ? jni::make_jstring(value.originalTransactionIdentifierIOS.value()) : nullptr,
|
|
124
178
|
value.appAccountToken.has_value() ? jni::make_jstring(value.appAccountToken.value()) : nullptr,
|
|
179
|
+
value.appBundleIdIOS.has_value() ? jni::make_jstring(value.appBundleIdIOS.value()) : nullptr,
|
|
180
|
+
value.countryCodeIOS.has_value() ? jni::make_jstring(value.countryCodeIOS.value()) : nullptr,
|
|
181
|
+
value.currencyCodeIOS.has_value() ? jni::make_jstring(value.currencyCodeIOS.value()) : nullptr,
|
|
182
|
+
value.currencySymbolIOS.has_value() ? jni::make_jstring(value.currencySymbolIOS.value()) : nullptr,
|
|
183
|
+
value.environmentIOS.has_value() ? jni::make_jstring(value.environmentIOS.value()) : nullptr,
|
|
184
|
+
value.expirationDateIOS.has_value() ? jni::JDouble::valueOf(value.expirationDateIOS.value()) : nullptr,
|
|
185
|
+
value.isUpgradedIOS.has_value() ? jni::JBoolean::valueOf(value.isUpgradedIOS.value()) : nullptr,
|
|
186
|
+
value.offerIOS.has_value() ? jni::make_jstring(value.offerIOS.value()) : nullptr,
|
|
187
|
+
value.ownershipTypeIOS.has_value() ? jni::make_jstring(value.ownershipTypeIOS.value()) : nullptr,
|
|
188
|
+
value.reasonIOS.has_value() ? jni::make_jstring(value.reasonIOS.value()) : nullptr,
|
|
189
|
+
value.reasonStringRepresentationIOS.has_value() ? jni::make_jstring(value.reasonStringRepresentationIOS.value()) : nullptr,
|
|
190
|
+
value.revocationDateIOS.has_value() ? jni::JDouble::valueOf(value.revocationDateIOS.value()) : nullptr,
|
|
191
|
+
value.revocationReasonIOS.has_value() ? jni::make_jstring(value.revocationReasonIOS.value()) : nullptr,
|
|
192
|
+
value.storefrontCountryCodeIOS.has_value() ? jni::make_jstring(value.storefrontCountryCodeIOS.value()) : nullptr,
|
|
193
|
+
value.subscriptionGroupIdIOS.has_value() ? jni::make_jstring(value.subscriptionGroupIdIOS.value()) : nullptr,
|
|
194
|
+
value.transactionReasonIOS.has_value() ? jni::make_jstring(value.transactionReasonIOS.value()) : nullptr,
|
|
195
|
+
value.webOrderLineItemIdIOS.has_value() ? jni::make_jstring(value.webOrderLineItemIdIOS.value()) : nullptr,
|
|
125
196
|
value.purchaseTokenAndroid.has_value() ? jni::make_jstring(value.purchaseTokenAndroid.value()) : nullptr,
|
|
126
197
|
value.dataAndroid.has_value() ? jni::make_jstring(value.dataAndroid.value()) : nullptr,
|
|
127
198
|
value.signatureAndroid.has_value() ? jni::make_jstring(value.signatureAndroid.value()) : nullptr,
|
|
@@ -130,7 +201,8 @@ namespace margelo::nitro::iap {
|
|
|
130
201
|
value.isAcknowledgedAndroid.has_value() ? jni::JBoolean::valueOf(value.isAcknowledgedAndroid.value()) : nullptr,
|
|
131
202
|
value.packageNameAndroid.has_value() ? jni::make_jstring(value.packageNameAndroid.value()) : nullptr,
|
|
132
203
|
value.obfuscatedAccountIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedAccountIdAndroid.value()) : nullptr,
|
|
133
|
-
value.obfuscatedProfileIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedProfileIdAndroid.value()) : nullptr
|
|
204
|
+
value.obfuscatedProfileIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedProfileIdAndroid.value()) : nullptr,
|
|
205
|
+
value.developerPayloadAndroid.has_value() ? jni::make_jstring(value.developerPayloadAndroid.value()) : nullptr
|
|
134
206
|
);
|
|
135
207
|
}
|
|
136
208
|
};
|
|
@@ -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),
|