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,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalLinkLaunchModeAndroid.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (ExternalLinkLaunchModeAndroid).
|
|
30
|
+
*/
|
|
31
|
+
enum class ExternalLinkLaunchModeAndroid {
|
|
32
|
+
UNSPECIFIED SWIFT_NAME(unspecified) = 0,
|
|
33
|
+
LAUNCH_IN_EXTERNAL_BROWSER_OR_APP SWIFT_NAME(launchInExternalBrowserOrApp) = 1,
|
|
34
|
+
CALLER_WILL_LAUNCH_LINK SWIFT_NAME(callerWillLaunchLink) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ ExternalLinkLaunchModeAndroid <> JS ExternalLinkLaunchModeAndroid (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid> final {
|
|
44
|
+
static inline margelo::nitro::iap::ExternalLinkLaunchModeAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("unspecified"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::UNSPECIFIED;
|
|
48
|
+
case hashString("launch-in-external-browser-or-app"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::LAUNCH_IN_EXTERNAL_BROWSER_OR_APP;
|
|
49
|
+
case hashString("caller-will-launch-link"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::CALLER_WILL_LAUNCH_LINK;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ExternalLinkLaunchModeAndroid - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::ExternalLinkLaunchModeAndroid arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
|
|
57
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::LAUNCH_IN_EXTERNAL_BROWSER_OR_APP: return JSIConverter<std::string>::toJSI(runtime, "launch-in-external-browser-or-app");
|
|
58
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::CALLER_WILL_LAUNCH_LINK: return JSIConverter<std::string>::toJSI(runtime, "caller-will-launch-link");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert ExternalLinkLaunchModeAndroid to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("unspecified"):
|
|
71
|
+
case hashString("launch-in-external-browser-or-app"):
|
|
72
|
+
case hashString("caller-will-launch-link"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalLinkTypeAndroid.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (ExternalLinkTypeAndroid).
|
|
30
|
+
*/
|
|
31
|
+
enum class ExternalLinkTypeAndroid {
|
|
32
|
+
UNSPECIFIED SWIFT_NAME(unspecified) = 0,
|
|
33
|
+
LINK_TO_DIGITAL_CONTENT_OFFER SWIFT_NAME(linkToDigitalContentOffer) = 1,
|
|
34
|
+
LINK_TO_APP_DOWNLOAD SWIFT_NAME(linkToAppDownload) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ ExternalLinkTypeAndroid <> JS ExternalLinkTypeAndroid (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid> final {
|
|
44
|
+
static inline margelo::nitro::iap::ExternalLinkTypeAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("unspecified"): return margelo::nitro::iap::ExternalLinkTypeAndroid::UNSPECIFIED;
|
|
48
|
+
case hashString("link-to-digital-content-offer"): return margelo::nitro::iap::ExternalLinkTypeAndroid::LINK_TO_DIGITAL_CONTENT_OFFER;
|
|
49
|
+
case hashString("link-to-app-download"): return margelo::nitro::iap::ExternalLinkTypeAndroid::LINK_TO_APP_DOWNLOAD;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ExternalLinkTypeAndroid - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::ExternalLinkTypeAndroid arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::ExternalLinkTypeAndroid::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
|
|
57
|
+
case margelo::nitro::iap::ExternalLinkTypeAndroid::LINK_TO_DIGITAL_CONTENT_OFFER: return JSIConverter<std::string>::toJSI(runtime, "link-to-digital-content-offer");
|
|
58
|
+
case margelo::nitro::iap::ExternalLinkTypeAndroid::LINK_TO_APP_DOWNLOAD: return JSIConverter<std::string>::toJSI(runtime, "link-to-app-download");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert ExternalLinkTypeAndroid to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("unspecified"):
|
|
71
|
+
case hashString("link-to-digital-content-offer"):
|
|
72
|
+
case hashString("link-to-app-download"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -58,6 +58,10 @@ namespace margelo::nitro::iap {
|
|
|
58
58
|
prototype.registerHybridMethod("createAlternativeBillingTokenAndroid", &HybridRnIapSpec::createAlternativeBillingTokenAndroid);
|
|
59
59
|
prototype.registerHybridMethod("addUserChoiceBillingListenerAndroid", &HybridRnIapSpec::addUserChoiceBillingListenerAndroid);
|
|
60
60
|
prototype.registerHybridMethod("removeUserChoiceBillingListenerAndroid", &HybridRnIapSpec::removeUserChoiceBillingListenerAndroid);
|
|
61
|
+
prototype.registerHybridMethod("enableBillingProgramAndroid", &HybridRnIapSpec::enableBillingProgramAndroid);
|
|
62
|
+
prototype.registerHybridMethod("isBillingProgramAvailableAndroid", &HybridRnIapSpec::isBillingProgramAvailableAndroid);
|
|
63
|
+
prototype.registerHybridMethod("createBillingProgramReportingDetailsAndroid", &HybridRnIapSpec::createBillingProgramReportingDetailsAndroid);
|
|
64
|
+
prototype.registerHybridMethod("launchExternalLinkAndroid", &HybridRnIapSpec::launchExternalLinkAndroid);
|
|
61
65
|
prototype.registerHybridMethod("canPresentExternalPurchaseNoticeIOS", &HybridRnIapSpec::canPresentExternalPurchaseNoticeIOS);
|
|
62
66
|
prototype.registerHybridMethod("presentExternalPurchaseNoticeSheetIOS", &HybridRnIapSpec::presentExternalPurchaseNoticeSheetIOS);
|
|
63
67
|
prototype.registerHybridMethod("presentExternalPurchaseLinkIOS", &HybridRnIapSpec::presentExternalPurchaseLinkIOS);
|
|
@@ -49,6 +49,14 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderProps; }
|
|
|
49
49
|
namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
50
50
|
// Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
|
|
51
51
|
namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
52
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
53
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
54
|
+
// Forward declaration of `NitroBillingProgramAvailabilityResultAndroid` to properly resolve imports.
|
|
55
|
+
namespace margelo::nitro::iap { struct NitroBillingProgramAvailabilityResultAndroid; }
|
|
56
|
+
// Forward declaration of `NitroBillingProgramReportingDetailsAndroid` to properly resolve imports.
|
|
57
|
+
namespace margelo::nitro::iap { struct NitroBillingProgramReportingDetailsAndroid; }
|
|
58
|
+
// Forward declaration of `NitroLaunchExternalLinkParamsAndroid` to properly resolve imports.
|
|
59
|
+
namespace margelo::nitro::iap { struct NitroLaunchExternalLinkParamsAndroid; }
|
|
52
60
|
// Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
|
|
53
61
|
namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
|
|
54
62
|
// Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
|
|
@@ -78,6 +86,10 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
|
78
86
|
#include "NitroVerifyPurchaseWithProviderProps.hpp"
|
|
79
87
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
80
88
|
#include "UserChoiceBillingDetails.hpp"
|
|
89
|
+
#include "BillingProgramAndroid.hpp"
|
|
90
|
+
#include "NitroBillingProgramAvailabilityResultAndroid.hpp"
|
|
91
|
+
#include "NitroBillingProgramReportingDetailsAndroid.hpp"
|
|
92
|
+
#include "NitroLaunchExternalLinkParamsAndroid.hpp"
|
|
81
93
|
#include "ExternalPurchaseNoticeResultIOS.hpp"
|
|
82
94
|
#include "ExternalPurchaseLinkResultIOS.hpp"
|
|
83
95
|
|
|
@@ -156,6 +168,10 @@ namespace margelo::nitro::iap {
|
|
|
156
168
|
virtual std::shared_ptr<Promise<std::optional<std::string>>> createAlternativeBillingTokenAndroid(const std::optional<std::string>& sku) = 0;
|
|
157
169
|
virtual void addUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) = 0;
|
|
158
170
|
virtual void removeUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) = 0;
|
|
171
|
+
virtual void enableBillingProgramAndroid(BillingProgramAndroid program) = 0;
|
|
172
|
+
virtual std::shared_ptr<Promise<NitroBillingProgramAvailabilityResultAndroid>> isBillingProgramAvailableAndroid(BillingProgramAndroid program) = 0;
|
|
173
|
+
virtual std::shared_ptr<Promise<NitroBillingProgramReportingDetailsAndroid>> createBillingProgramReportingDetailsAndroid(BillingProgramAndroid program) = 0;
|
|
174
|
+
virtual std::shared_ptr<Promise<bool>> launchExternalLinkAndroid(const NitroLaunchExternalLinkParamsAndroid& params) = 0;
|
|
159
175
|
virtual std::shared_ptr<Promise<bool>> canPresentExternalPurchaseNoticeIOS() = 0;
|
|
160
176
|
virtual std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> presentExternalPurchaseNoticeSheetIOS() = 0;
|
|
161
177
|
virtual std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> presentExternalPurchaseLinkIOS(const std::string& url) = 0;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramAvailabilityResultAndroid.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "BillingProgramAndroid.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::iap {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (NitroBillingProgramAvailabilityResultAndroid).
|
|
35
|
+
*/
|
|
36
|
+
struct NitroBillingProgramAvailabilityResultAndroid {
|
|
37
|
+
public:
|
|
38
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
39
|
+
bool isAvailable SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
NitroBillingProgramAvailabilityResultAndroid() = default;
|
|
43
|
+
explicit NitroBillingProgramAvailabilityResultAndroid(BillingProgramAndroid billingProgram, bool isAvailable): billingProgram(billingProgram), isAvailable(isAvailable) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::iap
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ NitroBillingProgramAvailabilityResultAndroid <> JS NitroBillingProgramAvailabilityResultAndroid (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid> final {
|
|
53
|
+
static inline margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid(
|
|
56
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
57
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isAvailable"))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid& arg) {
|
|
61
|
+
jsi::Object obj(runtime);
|
|
62
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
63
|
+
obj.setProperty(runtime, "isAvailable", JSIConverter<bool>::toJSI(runtime, arg.isAvailable));
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
67
|
+
if (!value.isObject()) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
jsi::Object obj = value.getObject(runtime);
|
|
71
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
75
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isAvailable"))) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramReportingDetailsAndroid.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "BillingProgramAndroid.hpp"
|
|
30
|
+
#include <string>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::iap {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (NitroBillingProgramReportingDetailsAndroid).
|
|
36
|
+
*/
|
|
37
|
+
struct NitroBillingProgramReportingDetailsAndroid {
|
|
38
|
+
public:
|
|
39
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
40
|
+
std::string externalTransactionToken SWIFT_PRIVATE;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
NitroBillingProgramReportingDetailsAndroid() = default;
|
|
44
|
+
explicit NitroBillingProgramReportingDetailsAndroid(BillingProgramAndroid billingProgram, std::string externalTransactionToken): billingProgram(billingProgram), externalTransactionToken(externalTransactionToken) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace margelo::nitro::iap
|
|
48
|
+
|
|
49
|
+
namespace margelo::nitro {
|
|
50
|
+
|
|
51
|
+
// C++ NitroBillingProgramReportingDetailsAndroid <> JS NitroBillingProgramReportingDetailsAndroid (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid> final {
|
|
54
|
+
static inline margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid(
|
|
57
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
58
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "externalTransactionToken"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
64
|
+
obj.setProperty(runtime, "externalTransactionToken", JSIConverter<std::string>::toJSI(runtime, arg.externalTransactionToken));
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isObject()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
jsi::Object obj = value.getObject(runtime);
|
|
72
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "externalTransactionToken"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroDiscountAmountAndroid.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (NitroDiscountAmountAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct NitroDiscountAmountAndroid {
|
|
36
|
+
public:
|
|
37
|
+
std::string discountAmountMicros SWIFT_PRIVATE;
|
|
38
|
+
std::string formattedDiscountAmount SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroDiscountAmountAndroid() = default;
|
|
42
|
+
explicit NitroDiscountAmountAndroid(std::string discountAmountMicros, std::string formattedDiscountAmount): discountAmountMicros(discountAmountMicros), formattedDiscountAmount(formattedDiscountAmount) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroDiscountAmountAndroid <> JS NitroDiscountAmountAndroid (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroDiscountAmountAndroid> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroDiscountAmountAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroDiscountAmountAndroid(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "discountAmountMicros")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "formattedDiscountAmount"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroDiscountAmountAndroid& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "discountAmountMicros", JSIConverter<std::string>::toJSI(runtime, arg.discountAmountMicros));
|
|
62
|
+
obj.setProperty(runtime, "formattedDiscountAmount", JSIConverter<std::string>::toJSI(runtime, arg.formattedDiscountAmount));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "discountAmountMicros"))) return false;
|
|
74
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "formattedDiscountAmount"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroDiscountDisplayInfoAndroid.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `NitroDiscountAmountAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { struct NitroDiscountAmountAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "NitroDiscountAmountAndroid.hpp"
|
|
30
|
+
#include <optional>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::iap {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (NitroDiscountDisplayInfoAndroid).
|
|
36
|
+
*/
|
|
37
|
+
struct NitroDiscountDisplayInfoAndroid {
|
|
38
|
+
public:
|
|
39
|
+
std::optional<NitroDiscountAmountAndroid> discountAmount SWIFT_PRIVATE;
|
|
40
|
+
std::optional<double> percentageDiscount SWIFT_PRIVATE;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
NitroDiscountDisplayInfoAndroid() = default;
|
|
44
|
+
explicit NitroDiscountDisplayInfoAndroid(std::optional<NitroDiscountAmountAndroid> discountAmount, std::optional<double> percentageDiscount): discountAmount(discountAmount), percentageDiscount(percentageDiscount) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace margelo::nitro::iap
|
|
48
|
+
|
|
49
|
+
namespace margelo::nitro {
|
|
50
|
+
|
|
51
|
+
// C++ NitroDiscountDisplayInfoAndroid <> JS NitroDiscountDisplayInfoAndroid (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<margelo::nitro::iap::NitroDiscountDisplayInfoAndroid> final {
|
|
54
|
+
static inline margelo::nitro::iap::NitroDiscountDisplayInfoAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return margelo::nitro::iap::NitroDiscountDisplayInfoAndroid(
|
|
57
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "discountAmount")),
|
|
58
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "percentageDiscount"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroDiscountDisplayInfoAndroid& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "discountAmount", JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::toJSI(runtime, arg.discountAmount));
|
|
64
|
+
obj.setProperty(runtime, "percentageDiscount", JSIConverter<std::optional<double>>::toJSI(runtime, arg.percentageDiscount));
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isObject()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
jsi::Object obj = value.getObject(runtime);
|
|
72
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountAmountAndroid>>::canConvert(runtime, obj.getProperty(runtime, "discountAmount"))) return false;
|
|
76
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "percentageDiscount"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLaunchExternalLinkParamsAndroid.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
// Forward declaration of `ExternalLinkLaunchModeAndroid` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class ExternalLinkLaunchModeAndroid; }
|
|
30
|
+
// Forward declaration of `ExternalLinkTypeAndroid` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::iap { enum class ExternalLinkTypeAndroid; }
|
|
32
|
+
|
|
33
|
+
#include "BillingProgramAndroid.hpp"
|
|
34
|
+
#include "ExternalLinkLaunchModeAndroid.hpp"
|
|
35
|
+
#include "ExternalLinkTypeAndroid.hpp"
|
|
36
|
+
#include <string>
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::iap {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (NitroLaunchExternalLinkParamsAndroid).
|
|
42
|
+
*/
|
|
43
|
+
struct NitroLaunchExternalLinkParamsAndroid {
|
|
44
|
+
public:
|
|
45
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
46
|
+
ExternalLinkLaunchModeAndroid launchMode SWIFT_PRIVATE;
|
|
47
|
+
ExternalLinkTypeAndroid linkType SWIFT_PRIVATE;
|
|
48
|
+
std::string linkUri SWIFT_PRIVATE;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
NitroLaunchExternalLinkParamsAndroid() = default;
|
|
52
|
+
explicit NitroLaunchExternalLinkParamsAndroid(BillingProgramAndroid billingProgram, ExternalLinkLaunchModeAndroid launchMode, ExternalLinkTypeAndroid linkType, std::string linkUri): billingProgram(billingProgram), launchMode(launchMode), linkType(linkType), linkUri(linkUri) {}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::iap
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ NitroLaunchExternalLinkParamsAndroid <> JS NitroLaunchExternalLinkParamsAndroid (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid> final {
|
|
62
|
+
static inline margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid(
|
|
65
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
66
|
+
JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::fromJSI(runtime, obj.getProperty(runtime, "launchMode")),
|
|
67
|
+
JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::fromJSI(runtime, obj.getProperty(runtime, "linkType")),
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkUri"))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
74
|
+
obj.setProperty(runtime, "launchMode", JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::toJSI(runtime, arg.launchMode));
|
|
75
|
+
obj.setProperty(runtime, "linkType", JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::toJSI(runtime, arg.linkType));
|
|
76
|
+
obj.setProperty(runtime, "linkUri", JSIConverter<std::string>::toJSI(runtime, arg.linkUri));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
88
|
+
if (!JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::canConvert(runtime, obj.getProperty(runtime, "launchMode"))) return false;
|
|
89
|
+
if (!JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::canConvert(runtime, obj.getProperty(runtime, "linkType"))) return false;
|
|
90
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkUri"))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|