react-native-iap 14.5.0 → 14.6.0-rc.1
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 +173 -7
- package/ios/HybridRnIap.swift +24 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/index.js +166 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +93 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +2 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts +124 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +125 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +227 -15
- 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/c++/JBillingProgramAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalLinkLaunchModeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalLinkTypeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +13 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +100 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroBillingProgramAvailabilityResultAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroBillingProgramReportingDetailsAndroid.hpp +63 -0
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroLaunchExternalLinkParamsAndroid.hpp +75 -0
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +70 -3
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +35 -5
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkLaunchModeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkTypeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +16 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramAvailabilityResultAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramReportingDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid.kt +45 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +30 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +232 -18
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +36 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +66 -0
- package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalLinkLaunchModeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalLinkTypeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramAvailabilityResultAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramReportingDetailsAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +68 -0
- package/nitrogen/generated/ios/swift/NitroBillingProgramAvailabilityResultAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroBillingProgramReportingDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +70 -0
- package/nitrogen/generated/ios/swift/NitroLaunchExternalLinkParamsAndroid.swift +68 -0
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +211 -2
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +26 -7
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +31 -1
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +32 -2
- package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalLinkLaunchModeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalLinkTypeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +16 -0
- package/nitrogen/generated/shared/c++/NitroBillingProgramAvailabilityResultAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroBillingProgramReportingDetailsAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroLaunchExternalLinkParamsAndroid.hpp +95 -0
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +55 -3
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -5
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
- package/openiap-versions.json +2 -2
- package/package.json +1 -1
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +218 -0
- package/src/specs/RnIap.nitro.ts +161 -1
- package/src/types.ts +243 -15
- package/src/utils/type-bridge.ts +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroDiscountAmountAndroid.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 "NitroDiscountAmountAndroid.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 "NitroDiscountAmountAndroid" and the the Kotlin data class "NitroDiscountAmountAndroid".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroDiscountAmountAndroid final: public jni::JavaClass<JNitroDiscountAmountAndroid> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroDiscountAmountAndroid;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroDiscountAmountAndroid by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroDiscountAmountAndroid toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldDiscountAmountMicros = clazz->getField<jni::JString>("discountAmountMicros");
|
|
35
|
+
jni::local_ref<jni::JString> discountAmountMicros = this->getFieldValue(fieldDiscountAmountMicros);
|
|
36
|
+
static const auto fieldFormattedDiscountAmount = clazz->getField<jni::JString>("formattedDiscountAmount");
|
|
37
|
+
jni::local_ref<jni::JString> formattedDiscountAmount = this->getFieldValue(fieldFormattedDiscountAmount);
|
|
38
|
+
return NitroDiscountAmountAndroid(
|
|
39
|
+
discountAmountMicros->toStdString(),
|
|
40
|
+
formattedDiscountAmount->toStdString()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JNitroDiscountAmountAndroid::javaobject> fromCpp(const NitroDiscountAmountAndroid& value) {
|
|
50
|
+
using JSignature = JNitroDiscountAmountAndroid(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
jni::make_jstring(value.discountAmountMicros),
|
|
56
|
+
jni::make_jstring(value.formattedDiscountAmount)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroDiscountDisplayInfoAndroid.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 "NitroDiscountDisplayInfoAndroid.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JNitroDiscountAmountAndroid.hpp"
|
|
14
|
+
#include "NitroDiscountAmountAndroid.hpp"
|
|
15
|
+
#include <optional>
|
|
16
|
+
#include <string>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::iap {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ struct "NitroDiscountDisplayInfoAndroid" and the the Kotlin data class "NitroDiscountDisplayInfoAndroid".
|
|
24
|
+
*/
|
|
25
|
+
struct JNitroDiscountDisplayInfoAndroid final: public jni::JavaClass<JNitroDiscountDisplayInfoAndroid> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroDiscountDisplayInfoAndroid by copying all values to C++.
|
|
32
|
+
*/
|
|
33
|
+
[[maybe_unused]]
|
|
34
|
+
[[nodiscard]]
|
|
35
|
+
NitroDiscountDisplayInfoAndroid toCpp() const {
|
|
36
|
+
static const auto clazz = javaClassStatic();
|
|
37
|
+
static const auto fieldDiscountAmount = clazz->getField<JNitroDiscountAmountAndroid>("discountAmount");
|
|
38
|
+
jni::local_ref<JNitroDiscountAmountAndroid> discountAmount = this->getFieldValue(fieldDiscountAmount);
|
|
39
|
+
static const auto fieldPercentageDiscount = clazz->getField<jni::JDouble>("percentageDiscount");
|
|
40
|
+
jni::local_ref<jni::JDouble> percentageDiscount = this->getFieldValue(fieldPercentageDiscount);
|
|
41
|
+
return NitroDiscountDisplayInfoAndroid(
|
|
42
|
+
discountAmount != nullptr ? std::make_optional(discountAmount->toCpp()) : std::nullopt,
|
|
43
|
+
percentageDiscount != nullptr ? std::make_optional(percentageDiscount->value()) : std::nullopt
|
|
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<JNitroDiscountDisplayInfoAndroid::javaobject> fromCpp(const NitroDiscountDisplayInfoAndroid& value) {
|
|
53
|
+
using JSignature = JNitroDiscountDisplayInfoAndroid(jni::alias_ref<JNitroDiscountAmountAndroid>, jni::alias_ref<jni::JDouble>);
|
|
54
|
+
static const auto clazz = javaClassStatic();
|
|
55
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
|
+
return create(
|
|
57
|
+
clazz,
|
|
58
|
+
value.discountAmount.has_value() ? JNitroDiscountAmountAndroid::fromCpp(value.discountAmount.value()) : nullptr,
|
|
59
|
+
value.percentageDiscount.has_value() ? jni::JDouble::valueOf(value.percentageDiscount.value()) : nullptr
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroLaunchExternalLinkParamsAndroid.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 "NitroLaunchExternalLinkParamsAndroid.hpp"
|
|
12
|
+
|
|
13
|
+
#include "BillingProgramAndroid.hpp"
|
|
14
|
+
#include "ExternalLinkLaunchModeAndroid.hpp"
|
|
15
|
+
#include "ExternalLinkTypeAndroid.hpp"
|
|
16
|
+
#include "JBillingProgramAndroid.hpp"
|
|
17
|
+
#include "JExternalLinkLaunchModeAndroid.hpp"
|
|
18
|
+
#include "JExternalLinkTypeAndroid.hpp"
|
|
19
|
+
#include <string>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::iap {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ JNI bridge between the C++ struct "NitroLaunchExternalLinkParamsAndroid" and the the Kotlin data class "NitroLaunchExternalLinkParamsAndroid".
|
|
27
|
+
*/
|
|
28
|
+
struct JNitroLaunchExternalLinkParamsAndroid final: public jni::JavaClass<JNitroLaunchExternalLinkParamsAndroid> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid;";
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
/**
|
|
34
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroLaunchExternalLinkParamsAndroid by copying all values to C++.
|
|
35
|
+
*/
|
|
36
|
+
[[maybe_unused]]
|
|
37
|
+
[[nodiscard]]
|
|
38
|
+
NitroLaunchExternalLinkParamsAndroid toCpp() const {
|
|
39
|
+
static const auto clazz = javaClassStatic();
|
|
40
|
+
static const auto fieldBillingProgram = clazz->getField<JBillingProgramAndroid>("billingProgram");
|
|
41
|
+
jni::local_ref<JBillingProgramAndroid> billingProgram = this->getFieldValue(fieldBillingProgram);
|
|
42
|
+
static const auto fieldLaunchMode = clazz->getField<JExternalLinkLaunchModeAndroid>("launchMode");
|
|
43
|
+
jni::local_ref<JExternalLinkLaunchModeAndroid> launchMode = this->getFieldValue(fieldLaunchMode);
|
|
44
|
+
static const auto fieldLinkType = clazz->getField<JExternalLinkTypeAndroid>("linkType");
|
|
45
|
+
jni::local_ref<JExternalLinkTypeAndroid> linkType = this->getFieldValue(fieldLinkType);
|
|
46
|
+
static const auto fieldLinkUri = clazz->getField<jni::JString>("linkUri");
|
|
47
|
+
jni::local_ref<jni::JString> linkUri = this->getFieldValue(fieldLinkUri);
|
|
48
|
+
return NitroLaunchExternalLinkParamsAndroid(
|
|
49
|
+
billingProgram->toCpp(),
|
|
50
|
+
launchMode->toCpp(),
|
|
51
|
+
linkType->toCpp(),
|
|
52
|
+
linkUri->toStdString()
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
/**
|
|
58
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
59
|
+
*/
|
|
60
|
+
[[maybe_unused]]
|
|
61
|
+
static jni::local_ref<JNitroLaunchExternalLinkParamsAndroid::javaobject> fromCpp(const NitroLaunchExternalLinkParamsAndroid& value) {
|
|
62
|
+
using JSignature = JNitroLaunchExternalLinkParamsAndroid(jni::alias_ref<JBillingProgramAndroid>, jni::alias_ref<JExternalLinkLaunchModeAndroid>, jni::alias_ref<JExternalLinkTypeAndroid>, jni::alias_ref<jni::JString>);
|
|
63
|
+
static const auto clazz = javaClassStatic();
|
|
64
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
65
|
+
return create(
|
|
66
|
+
clazz,
|
|
67
|
+
JBillingProgramAndroid::fromCpp(value.billingProgram),
|
|
68
|
+
JExternalLinkLaunchModeAndroid::fromCpp(value.launchMode),
|
|
69
|
+
JExternalLinkTypeAndroid::fromCpp(value.linkType),
|
|
70
|
+
jni::make_jstring(value.linkUri)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::iap
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroLimitedQuantityInfoAndroid.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 "NitroLimitedQuantityInfoAndroid.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::iap {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "NitroLimitedQuantityInfoAndroid" and the the Kotlin data class "NitroLimitedQuantityInfoAndroid".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroLimitedQuantityInfoAndroid final: public jni::JavaClass<JNitroLimitedQuantityInfoAndroid> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroLimitedQuantityInfoAndroid by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroLimitedQuantityInfoAndroid toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldMaximumQuantity = clazz->getField<double>("maximumQuantity");
|
|
35
|
+
double maximumQuantity = this->getFieldValue(fieldMaximumQuantity);
|
|
36
|
+
static const auto fieldRemainingQuantity = clazz->getField<double>("remainingQuantity");
|
|
37
|
+
double remainingQuantity = this->getFieldValue(fieldRemainingQuantity);
|
|
38
|
+
return NitroLimitedQuantityInfoAndroid(
|
|
39
|
+
maximumQuantity,
|
|
40
|
+
remainingQuantity
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JNitroLimitedQuantityInfoAndroid::javaobject> fromCpp(const NitroLimitedQuantityInfoAndroid& value) {
|
|
50
|
+
using JSignature = JNitroLimitedQuantityInfoAndroid(double, double);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
value.maximumQuantity,
|
|
56
|
+
value.remainingQuantity
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::iap
|
|
@@ -10,7 +10,21 @@
|
|
|
10
10
|
#include <fbjni/fbjni.h>
|
|
11
11
|
#include "NitroOneTimePurchaseOfferDetail.hpp"
|
|
12
12
|
|
|
13
|
+
#include "JNitroDiscountAmountAndroid.hpp"
|
|
14
|
+
#include "JNitroDiscountDisplayInfoAndroid.hpp"
|
|
15
|
+
#include "JNitroLimitedQuantityInfoAndroid.hpp"
|
|
16
|
+
#include "JNitroPreorderDetailsAndroid.hpp"
|
|
17
|
+
#include "JNitroRentalDetailsAndroid.hpp"
|
|
18
|
+
#include "JNitroValidTimeWindowAndroid.hpp"
|
|
19
|
+
#include "NitroDiscountAmountAndroid.hpp"
|
|
20
|
+
#include "NitroDiscountDisplayInfoAndroid.hpp"
|
|
21
|
+
#include "NitroLimitedQuantityInfoAndroid.hpp"
|
|
22
|
+
#include "NitroPreorderDetailsAndroid.hpp"
|
|
23
|
+
#include "NitroRentalDetailsAndroid.hpp"
|
|
24
|
+
#include "NitroValidTimeWindowAndroid.hpp"
|
|
25
|
+
#include <optional>
|
|
13
26
|
#include <string>
|
|
27
|
+
#include <vector>
|
|
14
28
|
|
|
15
29
|
namespace margelo::nitro::iap {
|
|
16
30
|
|
|
@@ -31,16 +45,52 @@ namespace margelo::nitro::iap {
|
|
|
31
45
|
[[nodiscard]]
|
|
32
46
|
NitroOneTimePurchaseOfferDetail toCpp() const {
|
|
33
47
|
static const auto clazz = javaClassStatic();
|
|
48
|
+
static const auto fieldDiscountDisplayInfo = clazz->getField<JNitroDiscountDisplayInfoAndroid>("discountDisplayInfo");
|
|
49
|
+
jni::local_ref<JNitroDiscountDisplayInfoAndroid> discountDisplayInfo = this->getFieldValue(fieldDiscountDisplayInfo);
|
|
34
50
|
static const auto fieldFormattedPrice = clazz->getField<jni::JString>("formattedPrice");
|
|
35
51
|
jni::local_ref<jni::JString> formattedPrice = this->getFieldValue(fieldFormattedPrice);
|
|
52
|
+
static const auto fieldFullPriceMicros = clazz->getField<jni::JString>("fullPriceMicros");
|
|
53
|
+
jni::local_ref<jni::JString> fullPriceMicros = this->getFieldValue(fieldFullPriceMicros);
|
|
54
|
+
static const auto fieldLimitedQuantityInfo = clazz->getField<JNitroLimitedQuantityInfoAndroid>("limitedQuantityInfo");
|
|
55
|
+
jni::local_ref<JNitroLimitedQuantityInfoAndroid> limitedQuantityInfo = this->getFieldValue(fieldLimitedQuantityInfo);
|
|
56
|
+
static const auto fieldOfferId = clazz->getField<jni::JString>("offerId");
|
|
57
|
+
jni::local_ref<jni::JString> offerId = this->getFieldValue(fieldOfferId);
|
|
58
|
+
static const auto fieldOfferTags = clazz->getField<jni::JArrayClass<jni::JString>>("offerTags");
|
|
59
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> offerTags = this->getFieldValue(fieldOfferTags);
|
|
60
|
+
static const auto fieldOfferToken = clazz->getField<jni::JString>("offerToken");
|
|
61
|
+
jni::local_ref<jni::JString> offerToken = this->getFieldValue(fieldOfferToken);
|
|
62
|
+
static const auto fieldPreorderDetailsAndroid = clazz->getField<JNitroPreorderDetailsAndroid>("preorderDetailsAndroid");
|
|
63
|
+
jni::local_ref<JNitroPreorderDetailsAndroid> preorderDetailsAndroid = this->getFieldValue(fieldPreorderDetailsAndroid);
|
|
36
64
|
static const auto fieldPriceAmountMicros = clazz->getField<jni::JString>("priceAmountMicros");
|
|
37
65
|
jni::local_ref<jni::JString> priceAmountMicros = this->getFieldValue(fieldPriceAmountMicros);
|
|
38
66
|
static const auto fieldPriceCurrencyCode = clazz->getField<jni::JString>("priceCurrencyCode");
|
|
39
67
|
jni::local_ref<jni::JString> priceCurrencyCode = this->getFieldValue(fieldPriceCurrencyCode);
|
|
68
|
+
static const auto fieldRentalDetailsAndroid = clazz->getField<JNitroRentalDetailsAndroid>("rentalDetailsAndroid");
|
|
69
|
+
jni::local_ref<JNitroRentalDetailsAndroid> rentalDetailsAndroid = this->getFieldValue(fieldRentalDetailsAndroid);
|
|
70
|
+
static const auto fieldValidTimeWindow = clazz->getField<JNitroValidTimeWindowAndroid>("validTimeWindow");
|
|
71
|
+
jni::local_ref<JNitroValidTimeWindowAndroid> validTimeWindow = this->getFieldValue(fieldValidTimeWindow);
|
|
40
72
|
return NitroOneTimePurchaseOfferDetail(
|
|
73
|
+
discountDisplayInfo != nullptr ? std::make_optional(discountDisplayInfo->toCpp()) : std::nullopt,
|
|
41
74
|
formattedPrice->toStdString(),
|
|
75
|
+
fullPriceMicros != nullptr ? std::make_optional(fullPriceMicros->toStdString()) : std::nullopt,
|
|
76
|
+
limitedQuantityInfo != nullptr ? std::make_optional(limitedQuantityInfo->toCpp()) : std::nullopt,
|
|
77
|
+
offerId != nullptr ? std::make_optional(offerId->toStdString()) : std::nullopt,
|
|
78
|
+
[&]() {
|
|
79
|
+
size_t __size = offerTags->size();
|
|
80
|
+
std::vector<std::string> __vector;
|
|
81
|
+
__vector.reserve(__size);
|
|
82
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
83
|
+
auto __element = offerTags->getElement(__i);
|
|
84
|
+
__vector.push_back(__element->toStdString());
|
|
85
|
+
}
|
|
86
|
+
return __vector;
|
|
87
|
+
}(),
|
|
88
|
+
offerToken->toStdString(),
|
|
89
|
+
preorderDetailsAndroid != nullptr ? std::make_optional(preorderDetailsAndroid->toCpp()) : std::nullopt,
|
|
42
90
|
priceAmountMicros->toStdString(),
|
|
43
|
-
priceCurrencyCode->toStdString()
|
|
91
|
+
priceCurrencyCode->toStdString(),
|
|
92
|
+
rentalDetailsAndroid != nullptr ? std::make_optional(rentalDetailsAndroid->toCpp()) : std::nullopt,
|
|
93
|
+
validTimeWindow != nullptr ? std::make_optional(validTimeWindow->toCpp()) : std::nullopt
|
|
44
94
|
);
|
|
45
95
|
}
|
|
46
96
|
|
|
@@ -50,14 +100,31 @@ namespace margelo::nitro::iap {
|
|
|
50
100
|
*/
|
|
51
101
|
[[maybe_unused]]
|
|
52
102
|
static jni::local_ref<JNitroOneTimePurchaseOfferDetail::javaobject> fromCpp(const NitroOneTimePurchaseOfferDetail& value) {
|
|
53
|
-
using JSignature = JNitroOneTimePurchaseOfferDetail(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
103
|
+
using JSignature = JNitroOneTimePurchaseOfferDetail(jni::alias_ref<JNitroDiscountDisplayInfoAndroid>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroLimitedQuantityInfoAndroid>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroPreorderDetailsAndroid>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroRentalDetailsAndroid>, jni::alias_ref<JNitroValidTimeWindowAndroid>);
|
|
54
104
|
static const auto clazz = javaClassStatic();
|
|
55
105
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
106
|
return create(
|
|
57
107
|
clazz,
|
|
108
|
+
value.discountDisplayInfo.has_value() ? JNitroDiscountDisplayInfoAndroid::fromCpp(value.discountDisplayInfo.value()) : nullptr,
|
|
58
109
|
jni::make_jstring(value.formattedPrice),
|
|
110
|
+
value.fullPriceMicros.has_value() ? jni::make_jstring(value.fullPriceMicros.value()) : nullptr,
|
|
111
|
+
value.limitedQuantityInfo.has_value() ? JNitroLimitedQuantityInfoAndroid::fromCpp(value.limitedQuantityInfo.value()) : nullptr,
|
|
112
|
+
value.offerId.has_value() ? jni::make_jstring(value.offerId.value()) : nullptr,
|
|
113
|
+
[&]() {
|
|
114
|
+
size_t __size = value.offerTags.size();
|
|
115
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
116
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
117
|
+
const auto& __element = value.offerTags[__i];
|
|
118
|
+
__array->setElement(__i, *jni::make_jstring(__element));
|
|
119
|
+
}
|
|
120
|
+
return __array;
|
|
121
|
+
}(),
|
|
122
|
+
jni::make_jstring(value.offerToken),
|
|
123
|
+
value.preorderDetailsAndroid.has_value() ? JNitroPreorderDetailsAndroid::fromCpp(value.preorderDetailsAndroid.value()) : nullptr,
|
|
59
124
|
jni::make_jstring(value.priceAmountMicros),
|
|
60
|
-
jni::make_jstring(value.priceCurrencyCode)
|
|
125
|
+
jni::make_jstring(value.priceCurrencyCode),
|
|
126
|
+
value.rentalDetailsAndroid.has_value() ? JNitroRentalDetailsAndroid::fromCpp(value.rentalDetailsAndroid.value()) : nullptr,
|
|
127
|
+
value.validTimeWindow.has_value() ? JNitroValidTimeWindowAndroid::fromCpp(value.validTimeWindow.value()) : nullptr
|
|
61
128
|
);
|
|
62
129
|
}
|
|
63
130
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroPreorderDetailsAndroid.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 "NitroPreorderDetailsAndroid.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 "NitroPreorderDetailsAndroid" and the the Kotlin data class "NitroPreorderDetailsAndroid".
|
|
21
|
+
*/
|
|
22
|
+
struct JNitroPreorderDetailsAndroid final: public jni::JavaClass<JNitroPreorderDetailsAndroid> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroPreorderDetailsAndroid;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroPreorderDetailsAndroid by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
NitroPreorderDetailsAndroid toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldPreorderPresaleEndTimeMillis = clazz->getField<jni::JString>("preorderPresaleEndTimeMillis");
|
|
35
|
+
jni::local_ref<jni::JString> preorderPresaleEndTimeMillis = this->getFieldValue(fieldPreorderPresaleEndTimeMillis);
|
|
36
|
+
static const auto fieldPreorderReleaseTimeMillis = clazz->getField<jni::JString>("preorderReleaseTimeMillis");
|
|
37
|
+
jni::local_ref<jni::JString> preorderReleaseTimeMillis = this->getFieldValue(fieldPreorderReleaseTimeMillis);
|
|
38
|
+
return NitroPreorderDetailsAndroid(
|
|
39
|
+
preorderPresaleEndTimeMillis->toStdString(),
|
|
40
|
+
preorderReleaseTimeMillis->toStdString()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JNitroPreorderDetailsAndroid::javaobject> fromCpp(const NitroPreorderDetailsAndroid& value) {
|
|
50
|
+
using JSignature = JNitroPreorderDetailsAndroid(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
jni::make_jstring(value.preorderPresaleEndTimeMillis),
|
|
56
|
+
jni::make_jstring(value.preorderReleaseTimeMillis)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::iap
|
|
@@ -12,12 +12,25 @@
|
|
|
12
12
|
|
|
13
13
|
#include "IapPlatform.hpp"
|
|
14
14
|
#include "JIapPlatform.hpp"
|
|
15
|
+
#include "JNitroDiscountAmountAndroid.hpp"
|
|
16
|
+
#include "JNitroDiscountDisplayInfoAndroid.hpp"
|
|
17
|
+
#include "JNitroLimitedQuantityInfoAndroid.hpp"
|
|
15
18
|
#include "JNitroOneTimePurchaseOfferDetail.hpp"
|
|
19
|
+
#include "JNitroPreorderDetailsAndroid.hpp"
|
|
20
|
+
#include "JNitroRentalDetailsAndroid.hpp"
|
|
21
|
+
#include "JNitroValidTimeWindowAndroid.hpp"
|
|
16
22
|
#include "JPaymentModeIOS.hpp"
|
|
23
|
+
#include "NitroDiscountAmountAndroid.hpp"
|
|
24
|
+
#include "NitroDiscountDisplayInfoAndroid.hpp"
|
|
25
|
+
#include "NitroLimitedQuantityInfoAndroid.hpp"
|
|
17
26
|
#include "NitroOneTimePurchaseOfferDetail.hpp"
|
|
27
|
+
#include "NitroPreorderDetailsAndroid.hpp"
|
|
28
|
+
#include "NitroRentalDetailsAndroid.hpp"
|
|
29
|
+
#include "NitroValidTimeWindowAndroid.hpp"
|
|
18
30
|
#include "PaymentModeIOS.hpp"
|
|
19
31
|
#include <optional>
|
|
20
32
|
#include <string>
|
|
33
|
+
#include <vector>
|
|
21
34
|
|
|
22
35
|
namespace margelo::nitro::iap {
|
|
23
36
|
|
|
@@ -96,8 +109,8 @@ namespace margelo::nitro::iap {
|
|
|
96
109
|
jni::local_ref<jni::JString> freeTrialPeriodAndroid = this->getFieldValue(fieldFreeTrialPeriodAndroid);
|
|
97
110
|
static const auto fieldSubscriptionOfferDetailsAndroid = clazz->getField<jni::JString>("subscriptionOfferDetailsAndroid");
|
|
98
111
|
jni::local_ref<jni::JString> subscriptionOfferDetailsAndroid = this->getFieldValue(fieldSubscriptionOfferDetailsAndroid);
|
|
99
|
-
static const auto fieldOneTimePurchaseOfferDetailsAndroid = clazz->getField<JNitroOneTimePurchaseOfferDetail
|
|
100
|
-
jni::local_ref<JNitroOneTimePurchaseOfferDetail
|
|
112
|
+
static const auto fieldOneTimePurchaseOfferDetailsAndroid = clazz->getField<jni::JArrayClass<JNitroOneTimePurchaseOfferDetail>>("oneTimePurchaseOfferDetailsAndroid");
|
|
113
|
+
jni::local_ref<jni::JArrayClass<JNitroOneTimePurchaseOfferDetail>> oneTimePurchaseOfferDetailsAndroid = this->getFieldValue(fieldOneTimePurchaseOfferDetailsAndroid);
|
|
101
114
|
return NitroProduct(
|
|
102
115
|
id->toStdString(),
|
|
103
116
|
title->toStdString(),
|
|
@@ -128,7 +141,16 @@ namespace margelo::nitro::iap {
|
|
|
128
141
|
subscriptionPeriodAndroid != nullptr ? std::make_optional(subscriptionPeriodAndroid->toStdString()) : std::nullopt,
|
|
129
142
|
freeTrialPeriodAndroid != nullptr ? std::make_optional(freeTrialPeriodAndroid->toStdString()) : std::nullopt,
|
|
130
143
|
subscriptionOfferDetailsAndroid != nullptr ? std::make_optional(subscriptionOfferDetailsAndroid->toStdString()) : std::nullopt,
|
|
131
|
-
oneTimePurchaseOfferDetailsAndroid != nullptr ? std::make_optional(
|
|
144
|
+
oneTimePurchaseOfferDetailsAndroid != nullptr ? std::make_optional([&]() {
|
|
145
|
+
size_t __size = oneTimePurchaseOfferDetailsAndroid->size();
|
|
146
|
+
std::vector<NitroOneTimePurchaseOfferDetail> __vector;
|
|
147
|
+
__vector.reserve(__size);
|
|
148
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
149
|
+
auto __element = oneTimePurchaseOfferDetailsAndroid->getElement(__i);
|
|
150
|
+
__vector.push_back(__element->toCpp());
|
|
151
|
+
}
|
|
152
|
+
return __vector;
|
|
153
|
+
}()) : std::nullopt
|
|
132
154
|
);
|
|
133
155
|
}
|
|
134
156
|
|
|
@@ -138,7 +160,7 @@ namespace margelo::nitro::iap {
|
|
|
138
160
|
*/
|
|
139
161
|
[[maybe_unused]]
|
|
140
162
|
static jni::local_ref<JNitroProduct::javaobject> fromCpp(const NitroProduct& value) {
|
|
141
|
-
using JSignature = JNitroProduct(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JIapPlatform>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JPaymentModeIOS>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroOneTimePurchaseOfferDetail
|
|
163
|
+
using JSignature = JNitroProduct(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JIapPlatform>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JPaymentModeIOS>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNitroOneTimePurchaseOfferDetail>>);
|
|
142
164
|
static const auto clazz = javaClassStatic();
|
|
143
165
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
144
166
|
return create(
|
|
@@ -172,7 +194,15 @@ namespace margelo::nitro::iap {
|
|
|
172
194
|
value.subscriptionPeriodAndroid.has_value() ? jni::make_jstring(value.subscriptionPeriodAndroid.value()) : nullptr,
|
|
173
195
|
value.freeTrialPeriodAndroid.has_value() ? jni::make_jstring(value.freeTrialPeriodAndroid.value()) : nullptr,
|
|
174
196
|
value.subscriptionOfferDetailsAndroid.has_value() ? jni::make_jstring(value.subscriptionOfferDetailsAndroid.value()) : nullptr,
|
|
175
|
-
value.oneTimePurchaseOfferDetailsAndroid.has_value() ?
|
|
197
|
+
value.oneTimePurchaseOfferDetailsAndroid.has_value() ? [&]() {
|
|
198
|
+
size_t __size = value.oneTimePurchaseOfferDetailsAndroid.value().size();
|
|
199
|
+
jni::local_ref<jni::JArrayClass<JNitroOneTimePurchaseOfferDetail>> __array = jni::JArrayClass<JNitroOneTimePurchaseOfferDetail>::newArray(__size);
|
|
200
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
201
|
+
const auto& __element = value.oneTimePurchaseOfferDetailsAndroid.value()[__i];
|
|
202
|
+
__array->setElement(__i, *JNitroOneTimePurchaseOfferDetail::fromCpp(__element));
|
|
203
|
+
}
|
|
204
|
+
return __array;
|
|
205
|
+
}() : nullptr
|
|
176
206
|
);
|
|
177
207
|
}
|
|
178
208
|
};
|
|
@@ -122,6 +122,8 @@ namespace margelo::nitro::iap {
|
|
|
122
122
|
jni::local_ref<jni::JString> obfuscatedProfileIdAndroid = this->getFieldValue(fieldObfuscatedProfileIdAndroid);
|
|
123
123
|
static const auto fieldDeveloperPayloadAndroid = clazz->getField<jni::JString>("developerPayloadAndroid");
|
|
124
124
|
jni::local_ref<jni::JString> developerPayloadAndroid = this->getFieldValue(fieldDeveloperPayloadAndroid);
|
|
125
|
+
static const auto fieldIsSuspendedAndroid = clazz->getField<jni::JBoolean>("isSuspendedAndroid");
|
|
126
|
+
jni::local_ref<jni::JBoolean> isSuspendedAndroid = this->getFieldValue(fieldIsSuspendedAndroid);
|
|
125
127
|
return NitroPurchase(
|
|
126
128
|
id->toStdString(),
|
|
127
129
|
productId->toStdString(),
|
|
@@ -163,7 +165,8 @@ namespace margelo::nitro::iap {
|
|
|
163
165
|
packageNameAndroid != nullptr ? std::make_optional(packageNameAndroid->toStdString()) : std::nullopt,
|
|
164
166
|
obfuscatedAccountIdAndroid != nullptr ? std::make_optional(obfuscatedAccountIdAndroid->toStdString()) : std::nullopt,
|
|
165
167
|
obfuscatedProfileIdAndroid != nullptr ? std::make_optional(obfuscatedProfileIdAndroid->toStdString()) : std::nullopt,
|
|
166
|
-
developerPayloadAndroid != nullptr ? std::make_optional(developerPayloadAndroid->toStdString()) : std::nullopt
|
|
168
|
+
developerPayloadAndroid != nullptr ? std::make_optional(developerPayloadAndroid->toStdString()) : std::nullopt,
|
|
169
|
+
isSuspendedAndroid != nullptr ? std::make_optional(static_cast<bool>(isSuspendedAndroid->value())) : std::nullopt
|
|
167
170
|
);
|
|
168
171
|
}
|
|
169
172
|
|
|
@@ -173,7 +176,7 @@ namespace margelo::nitro::iap {
|
|
|
173
176
|
*/
|
|
174
177
|
[[maybe_unused]]
|
|
175
178
|
static jni::local_ref<JNitroPurchase::javaobject> fromCpp(const NitroPurchase& value) {
|
|
176
|
-
using JSignature = JNitroPurchase(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, double, jni::alias_ref<jni::JString>, jni::alias_ref<JIapPlatform>, jni::alias_ref<JIapStore>, double, jni::alias_ref<JPurchaseState>, jboolean, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroRenewalInfoIOS>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
179
|
+
using JSignature = JNitroPurchase(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, double, jni::alias_ref<jni::JString>, jni::alias_ref<JIapPlatform>, jni::alias_ref<JIapStore>, double, jni::alias_ref<JPurchaseState>, jboolean, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroRenewalInfoIOS>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>);
|
|
177
180
|
static const auto clazz = javaClassStatic();
|
|
178
181
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
179
182
|
return create(
|
|
@@ -218,7 +221,8 @@ namespace margelo::nitro::iap {
|
|
|
218
221
|
value.packageNameAndroid.has_value() ? jni::make_jstring(value.packageNameAndroid.value()) : nullptr,
|
|
219
222
|
value.obfuscatedAccountIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedAccountIdAndroid.value()) : nullptr,
|
|
220
223
|
value.obfuscatedProfileIdAndroid.has_value() ? jni::make_jstring(value.obfuscatedProfileIdAndroid.value()) : nullptr,
|
|
221
|
-
value.developerPayloadAndroid.has_value() ? jni::make_jstring(value.developerPayloadAndroid.value()) : nullptr
|
|
224
|
+
value.developerPayloadAndroid.has_value() ? jni::make_jstring(value.developerPayloadAndroid.value()) : nullptr,
|
|
225
|
+
value.isSuspendedAndroid.has_value() ? jni::JBoolean::valueOf(value.isSuspendedAndroid.value()) : nullptr
|
|
222
226
|
);
|
|
223
227
|
}
|
|
224
228
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroRentalDetailsAndroid.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 "NitroRentalDetailsAndroid.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::iap {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "NitroRentalDetailsAndroid" and the the Kotlin data class "NitroRentalDetailsAndroid".
|
|
22
|
+
*/
|
|
23
|
+
struct JNitroRentalDetailsAndroid final: public jni::JavaClass<JNitroRentalDetailsAndroid> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroRentalDetailsAndroid;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroRentalDetailsAndroid by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
NitroRentalDetailsAndroid toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldRentalExpirationPeriod = clazz->getField<jni::JString>("rentalExpirationPeriod");
|
|
36
|
+
jni::local_ref<jni::JString> rentalExpirationPeriod = this->getFieldValue(fieldRentalExpirationPeriod);
|
|
37
|
+
static const auto fieldRentalPeriod = clazz->getField<jni::JString>("rentalPeriod");
|
|
38
|
+
jni::local_ref<jni::JString> rentalPeriod = this->getFieldValue(fieldRentalPeriod);
|
|
39
|
+
return NitroRentalDetailsAndroid(
|
|
40
|
+
rentalExpirationPeriod != nullptr ? std::make_optional(rentalExpirationPeriod->toStdString()) : std::nullopt,
|
|
41
|
+
rentalPeriod->toStdString()
|
|
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<JNitroRentalDetailsAndroid::javaobject> fromCpp(const NitroRentalDetailsAndroid& value) {
|
|
51
|
+
using JSignature = JNitroRentalDetailsAndroid(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
52
|
+
static const auto clazz = javaClassStatic();
|
|
53
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
54
|
+
return create(
|
|
55
|
+
clazz,
|
|
56
|
+
value.rentalExpirationPeriod.has_value() ? jni::make_jstring(value.rentalExpirationPeriod.value()) : nullptr,
|
|
57
|
+
jni::make_jstring(value.rentalPeriod)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::iap
|