react-native-liftoffads 0.0.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.
Files changed (95) hide show
  1. package/LICENSE +20 -0
  2. package/NitroLiftoffAds.podspec +26 -0
  3. package/README.md +61 -0
  4. package/android/CMakeLists.txt +20 -0
  5. package/android/build.gradle +132 -0
  6. package/android/consumer-rules.pro +2 -0
  7. package/android/fix-prefab.gradle +46 -0
  8. package/android/gradle.properties +5 -0
  9. package/android/src/main/AndroidManifest.xml +1 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +7 -0
  11. package/android/src/main/java/com/margelo/nitro/liftoffads/HybridLiftoffAds.kt +121 -0
  12. package/android/src/main/java/com/margelo/nitro/liftoffads/HybridLiftoffInterstitialAd.kt +96 -0
  13. package/android/src/main/java/com/margelo/nitro/liftoffads/HybridLiftoffRewardedAd.kt +104 -0
  14. package/android/src/main/java/com/margelo/nitro/liftoffads/LiftoffAdEventEmitter.kt +51 -0
  15. package/android/src/main/java/com/margelo/nitro/liftoffads/LiftoffAndroidUtils.kt +54 -0
  16. package/android/src/main/java/com/margelo/nitro/liftoffads/NitroLiftoffAdsPackage.java +27 -0
  17. package/ios/HybridLiftoffAds.swift +113 -0
  18. package/ios/HybridLiftoffInterstitialAd.swift +98 -0
  19. package/ios/HybridLiftoffRewardedAd.swift +100 -0
  20. package/ios/LiftoffSupport.swift +106 -0
  21. package/lib/module/index.js +169 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/module/index.test.js +205 -0
  24. package/lib/module/index.test.js.map +1 -0
  25. package/lib/module/package.json +1 -0
  26. package/lib/module/specs/LiftoffAds.nitro.js +4 -0
  27. package/lib/module/specs/LiftoffAds.nitro.js.map +1 -0
  28. package/lib/typescript/package.json +1 -0
  29. package/lib/typescript/src/index.d.ts +72 -0
  30. package/lib/typescript/src/index.d.ts.map +1 -0
  31. package/lib/typescript/src/index.test.d.ts +2 -0
  32. package/lib/typescript/src/index.test.d.ts.map +1 -0
  33. package/lib/typescript/src/specs/LiftoffAds.nitro.d.ts +46 -0
  34. package/lib/typescript/src/specs/LiftoffAds.nitro.d.ts.map +1 -0
  35. package/nitro.json +18 -0
  36. package/nitrogen/generated/android/NitroLiftoffAds+autolinking.cmake +85 -0
  37. package/nitrogen/generated/android/NitroLiftoffAds+autolinking.gradle +27 -0
  38. package/nitrogen/generated/android/NitroLiftoffAdsOnLoad.cpp +50 -0
  39. package/nitrogen/generated/android/NitroLiftoffAdsOnLoad.hpp +25 -0
  40. package/nitrogen/generated/android/c++/JFunc_void_std__optional_LiftoffAdEventPayload_.hpp +78 -0
  41. package/nitrogen/generated/android/c++/JHybridLiftoffAdsSpec.cpp +88 -0
  42. package/nitrogen/generated/android/c++/JHybridLiftoffAdsSpec.hpp +69 -0
  43. package/nitrogen/generated/android/c++/JHybridLiftoffInterstitialAdSpec.cpp +89 -0
  44. package/nitrogen/generated/android/c++/JHybridLiftoffInterstitialAdSpec.hpp +68 -0
  45. package/nitrogen/generated/android/c++/JHybridLiftoffRewardedAdSpec.cpp +93 -0
  46. package/nitrogen/generated/android/c++/JHybridLiftoffRewardedAdSpec.hpp +69 -0
  47. package/nitrogen/generated/android/c++/JLiftoffAdEventPayload.hpp +58 -0
  48. package/nitrogen/generated/android/c++/JLiftoffAdEventType.hpp +77 -0
  49. package/nitrogen/generated/android/c++/JLiftoffAdShowOptions.hpp +53 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/Func_void_std__optional_LiftoffAdEventPayload_.kt +81 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/HybridLiftoffAdsSpec.kt +72 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/HybridLiftoffInterstitialAdSpec.kt +73 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/HybridLiftoffRewardedAdSpec.kt +77 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/LiftoffAdEventPayload.kt +32 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/LiftoffAdEventType.kt +27 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/LiftoffAdShowOptions.kt +29 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/liftoffads/NitroLiftoffAdsOnLoad.kt +35 -0
  58. package/nitrogen/generated/ios/NitroLiftoffAds+autolinking.rb +60 -0
  59. package/nitrogen/generated/ios/NitroLiftoffAds-Swift-Cxx-Bridge.cpp +90 -0
  60. package/nitrogen/generated/ios/NitroLiftoffAds-Swift-Cxx-Bridge.hpp +285 -0
  61. package/nitrogen/generated/ios/NitroLiftoffAds-Swift-Cxx-Umbrella.hpp +66 -0
  62. package/nitrogen/generated/ios/NitroLiftoffAdsAutolinking.mm +33 -0
  63. package/nitrogen/generated/ios/NitroLiftoffAdsAutolinking.swift +25 -0
  64. package/nitrogen/generated/ios/c++/HybridLiftoffAdsSpecSwift.cpp +11 -0
  65. package/nitrogen/generated/ios/c++/HybridLiftoffAdsSpecSwift.hpp +114 -0
  66. package/nitrogen/generated/ios/c++/HybridLiftoffInterstitialAdSpecSwift.cpp +11 -0
  67. package/nitrogen/generated/ios/c++/HybridLiftoffInterstitialAdSpecSwift.hpp +110 -0
  68. package/nitrogen/generated/ios/c++/HybridLiftoffRewardedAdSpecSwift.cpp +11 -0
  69. package/nitrogen/generated/ios/c++/HybridLiftoffRewardedAdSpecSwift.hpp +116 -0
  70. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  71. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  72. package/nitrogen/generated/ios/swift/Func_void_std__optional_LiftoffAdEventPayload_.swift +54 -0
  73. package/nitrogen/generated/ios/swift/HybridLiftoffAdsSpec.swift +54 -0
  74. package/nitrogen/generated/ios/swift/HybridLiftoffAdsSpec_cxx.swift +193 -0
  75. package/nitrogen/generated/ios/swift/HybridLiftoffInterstitialAdSpec.swift +53 -0
  76. package/nitrogen/generated/ios/swift/HybridLiftoffInterstitialAdSpec_cxx.swift +193 -0
  77. package/nitrogen/generated/ios/swift/HybridLiftoffRewardedAdSpec.swift +54 -0
  78. package/nitrogen/generated/ios/swift/HybridLiftoffRewardedAdSpec_cxx.swift +204 -0
  79. package/nitrogen/generated/ios/swift/LiftoffAdEventPayload.swift +77 -0
  80. package/nitrogen/generated/ios/swift/LiftoffAdEventType.swift +64 -0
  81. package/nitrogen/generated/ios/swift/LiftoffAdShowOptions.swift +47 -0
  82. package/nitrogen/generated/shared/c++/HybridLiftoffAdsSpec.cpp +26 -0
  83. package/nitrogen/generated/shared/c++/HybridLiftoffAdsSpec.hpp +74 -0
  84. package/nitrogen/generated/shared/c++/HybridLiftoffInterstitialAdSpec.cpp +25 -0
  85. package/nitrogen/generated/shared/c++/HybridLiftoffInterstitialAdSpec.hpp +76 -0
  86. package/nitrogen/generated/shared/c++/HybridLiftoffRewardedAdSpec.cpp +26 -0
  87. package/nitrogen/generated/shared/c++/HybridLiftoffRewardedAdSpec.hpp +78 -0
  88. package/nitrogen/generated/shared/c++/LiftoffAdEventPayload.hpp +72 -0
  89. package/nitrogen/generated/shared/c++/LiftoffAdEventType.hpp +100 -0
  90. package/nitrogen/generated/shared/c++/LiftoffAdShowOptions.hpp +67 -0
  91. package/package.json +173 -0
  92. package/react-native.config.js +8 -0
  93. package/src/index.test.ts +257 -0
  94. package/src/index.ts +307 -0
  95. package/src/specs/LiftoffAds.nitro.ts +67 -0
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// HybridLiftoffRewardedAdSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridLiftoffRewardedAdSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::liftoffads {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridLiftoffRewardedAdSpec: public jni::HybridClass<JHybridLiftoffRewardedAdSpec, JHybridObject>,
22
+ public virtual HybridLiftoffRewardedAdSpec {
23
+ public:
24
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/liftoffads/HybridLiftoffRewardedAdSpec;";
25
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
+ static void registerNatives();
27
+
28
+ protected:
29
+ // C++ constructor (called from Java via `initHybrid()`)
30
+ explicit JHybridLiftoffRewardedAdSpec(jni::alias_ref<jhybridobject> jThis) :
31
+ HybridObject(HybridLiftoffRewardedAdSpec::TAG),
32
+ HybridBase(jThis),
33
+ _javaPart(jni::make_global(jThis)) {}
34
+
35
+ public:
36
+ ~JHybridLiftoffRewardedAdSpec() override {
37
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
38
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
+ }
40
+
41
+ public:
42
+ size_t getExternalMemorySize() noexcept override;
43
+ void dispose() noexcept override;
44
+
45
+ public:
46
+ inline const jni::global_ref<JHybridLiftoffRewardedAdSpec::javaobject>& getJavaPart() const noexcept {
47
+ return _javaPart;
48
+ }
49
+
50
+ public:
51
+ // Properties
52
+
53
+
54
+ public:
55
+ // Methods
56
+ void load() override;
57
+ void setUserId(const std::string& userId) override;
58
+ std::shared_ptr<Promise<void>> show(const std::optional<LiftoffAdShowOptions>& options) override;
59
+ double addAdEventListener(LiftoffAdEventType eventType, const std::function<void(const std::optional<LiftoffAdEventPayload>& /* payload */)>& listener) override;
60
+ void removeAdEventListener(double subscriptionId) override;
61
+ void removeAllListeners() override;
62
+
63
+ private:
64
+ friend HybridBase;
65
+ using HybridBase::HybridBase;
66
+ jni::global_ref<JHybridLiftoffRewardedAdSpec::javaobject> _javaPart;
67
+ };
68
+
69
+ } // namespace margelo::nitro::liftoffads
@@ -0,0 +1,58 @@
1
+ ///
2
+ /// JLiftoffAdEventPayload.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "LiftoffAdEventPayload.hpp"
12
+
13
+ #include <optional>
14
+ #include <string>
15
+
16
+ namespace margelo::nitro::liftoffads {
17
+
18
+ using namespace facebook;
19
+
20
+ /**
21
+ * The C++ JNI bridge between the C++ struct "LiftoffAdEventPayload" and the the Kotlin data class "LiftoffAdEventPayload".
22
+ */
23
+ struct JLiftoffAdEventPayload final: public jni::JavaClass<JLiftoffAdEventPayload> {
24
+ public:
25
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/liftoffads/LiftoffAdEventPayload;";
26
+
27
+ public:
28
+ /**
29
+ * Convert this Java/Kotlin-based struct to the C++ struct LiftoffAdEventPayload by copying all values to C++.
30
+ */
31
+ [[maybe_unused]]
32
+ [[nodiscard]]
33
+ LiftoffAdEventPayload toCpp() const {
34
+ static const auto clazz = javaClassStatic();
35
+ static const auto fieldErrorCode = clazz->getField<jni::JDouble>("errorCode");
36
+ jni::local_ref<jni::JDouble> errorCode = this->getFieldValue(fieldErrorCode);
37
+ static const auto fieldErrorMessage = clazz->getField<jni::JString>("errorMessage");
38
+ jni::local_ref<jni::JString> errorMessage = this->getFieldValue(fieldErrorMessage);
39
+ return LiftoffAdEventPayload(
40
+ errorCode != nullptr ? std::make_optional(errorCode->value()) : std::nullopt,
41
+ errorMessage != nullptr ? std::make_optional(errorMessage->toStdString()) : std::nullopt
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<JLiftoffAdEventPayload::javaobject> fromCpp(const LiftoffAdEventPayload& value) {
51
+ return newInstance(
52
+ value.errorCode.has_value() ? jni::JDouble::valueOf(value.errorCode.value()) : nullptr,
53
+ value.errorMessage.has_value() ? jni::make_jstring(value.errorMessage.value()) : nullptr
54
+ );
55
+ }
56
+ };
57
+
58
+ } // namespace margelo::nitro::liftoffads
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// JLiftoffAdEventType.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "LiftoffAdEventType.hpp"
12
+
13
+ namespace margelo::nitro::liftoffads {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "LiftoffAdEventType" and the the Kotlin enum "LiftoffAdEventType".
19
+ */
20
+ struct JLiftoffAdEventType final: public jni::JavaClass<JLiftoffAdEventType> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/liftoffads/LiftoffAdEventType;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum LiftoffAdEventType.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ LiftoffAdEventType toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<LiftoffAdEventType>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JLiftoffAdEventType> fromCpp(LiftoffAdEventType value) {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldLOADED = clazz->getStaticField<JLiftoffAdEventType>("LOADED");
45
+ static const auto fieldERROR = clazz->getStaticField<JLiftoffAdEventType>("ERROR");
46
+ static const auto fieldOPENED = clazz->getStaticField<JLiftoffAdEventType>("OPENED");
47
+ static const auto fieldPAID = clazz->getStaticField<JLiftoffAdEventType>("PAID");
48
+ static const auto fieldCLICKED = clazz->getStaticField<JLiftoffAdEventType>("CLICKED");
49
+ static const auto fieldCLOSED = clazz->getStaticField<JLiftoffAdEventType>("CLOSED");
50
+ static const auto fieldREWARDED_LOADED = clazz->getStaticField<JLiftoffAdEventType>("REWARDED_LOADED");
51
+ static const auto fieldREWARDED_EARNED_REWARD = clazz->getStaticField<JLiftoffAdEventType>("REWARDED_EARNED_REWARD");
52
+
53
+ switch (value) {
54
+ case LiftoffAdEventType::LOADED:
55
+ return clazz->getStaticFieldValue(fieldLOADED);
56
+ case LiftoffAdEventType::ERROR:
57
+ return clazz->getStaticFieldValue(fieldERROR);
58
+ case LiftoffAdEventType::OPENED:
59
+ return clazz->getStaticFieldValue(fieldOPENED);
60
+ case LiftoffAdEventType::PAID:
61
+ return clazz->getStaticFieldValue(fieldPAID);
62
+ case LiftoffAdEventType::CLICKED:
63
+ return clazz->getStaticFieldValue(fieldCLICKED);
64
+ case LiftoffAdEventType::CLOSED:
65
+ return clazz->getStaticFieldValue(fieldCLOSED);
66
+ case LiftoffAdEventType::REWARDED_LOADED:
67
+ return clazz->getStaticFieldValue(fieldREWARDED_LOADED);
68
+ case LiftoffAdEventType::REWARDED_EARNED_REWARD:
69
+ return clazz->getStaticFieldValue(fieldREWARDED_EARNED_REWARD);
70
+ default:
71
+ std::string stringValue = std::to_string(static_cast<int>(value));
72
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
73
+ }
74
+ }
75
+ };
76
+
77
+ } // namespace margelo::nitro::liftoffads
@@ -0,0 +1,53 @@
1
+ ///
2
+ /// JLiftoffAdShowOptions.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "LiftoffAdShowOptions.hpp"
12
+
13
+ #include <optional>
14
+
15
+ namespace margelo::nitro::liftoffads {
16
+
17
+ using namespace facebook;
18
+
19
+ /**
20
+ * The C++ JNI bridge between the C++ struct "LiftoffAdShowOptions" and the the Kotlin data class "LiftoffAdShowOptions".
21
+ */
22
+ struct JLiftoffAdShowOptions final: public jni::JavaClass<JLiftoffAdShowOptions> {
23
+ public:
24
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/liftoffads/LiftoffAdShowOptions;";
25
+
26
+ public:
27
+ /**
28
+ * Convert this Java/Kotlin-based struct to the C++ struct LiftoffAdShowOptions by copying all values to C++.
29
+ */
30
+ [[maybe_unused]]
31
+ [[nodiscard]]
32
+ LiftoffAdShowOptions toCpp() const {
33
+ static const auto clazz = javaClassStatic();
34
+ static const auto fieldImmersiveModeEnabled = clazz->getField<jni::JBoolean>("immersiveModeEnabled");
35
+ jni::local_ref<jni::JBoolean> immersiveModeEnabled = this->getFieldValue(fieldImmersiveModeEnabled);
36
+ return LiftoffAdShowOptions(
37
+ immersiveModeEnabled != nullptr ? std::make_optional(static_cast<bool>(immersiveModeEnabled->value())) : std::nullopt
38
+ );
39
+ }
40
+
41
+ public:
42
+ /**
43
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
44
+ */
45
+ [[maybe_unused]]
46
+ static jni::local_ref<JLiftoffAdShowOptions::javaobject> fromCpp(const LiftoffAdShowOptions& value) {
47
+ return newInstance(
48
+ value.immersiveModeEnabled.has_value() ? jni::JBoolean::valueOf(value.immersiveModeEnabled.value()) : nullptr
49
+ );
50
+ }
51
+ };
52
+
53
+ } // namespace margelo::nitro::liftoffads
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// Func_void_std__optional_LiftoffAdEventPayload_.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+ import dalvik.annotation.optimization.FastNative
15
+
16
+
17
+ /**
18
+ * Represents the JavaScript callback `(payload: optional) => void`.
19
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
+ * or in Kotlin/Java (in which case it is a native callback).
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress("ClassName", "RedundantUnitReturnType")
25
+ fun interface Func_void_std__optional_LiftoffAdEventPayload_: (LiftoffAdEventPayload?) -> Unit {
26
+ /**
27
+ * Call the given JS callback.
28
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ override fun invoke(payload: LiftoffAdEventPayload?): Unit
33
+ }
34
+
35
+ /**
36
+ * Represents the JavaScript callback `(payload: optional) => void`.
37
+ * This is implemented in C++, via a `std::function<...>`.
38
+ * The callback might be coming from JS.
39
+ */
40
+ @DoNotStrip
41
+ @Keep
42
+ @Suppress(
43
+ "KotlinJniMissingFunction", "unused",
44
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
+ )
47
+ class Func_void_std__optional_LiftoffAdEventPayload__cxx: Func_void_std__optional_LiftoffAdEventPayload_ {
48
+ @DoNotStrip
49
+ @Keep
50
+ private val mHybridData: HybridData
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ private constructor(hybridData: HybridData) {
55
+ mHybridData = hybridData
56
+ }
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ override fun invoke(payload: LiftoffAdEventPayload?): Unit
61
+ = invoke_cxx(payload)
62
+
63
+ @FastNative
64
+ private external fun invoke_cxx(payload: LiftoffAdEventPayload?): Unit
65
+ }
66
+
67
+ /**
68
+ * Represents the JavaScript callback `(payload: optional) => void`.
69
+ * This is implemented in Java/Kotlin, via a `(LiftoffAdEventPayload?) -> Unit`.
70
+ * The callback is always coming from native.
71
+ */
72
+ @DoNotStrip
73
+ @Keep
74
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
+ class Func_void_std__optional_LiftoffAdEventPayload__java(private val function: (LiftoffAdEventPayload?) -> Unit): Func_void_std__optional_LiftoffAdEventPayload_ {
76
+ @DoNotStrip
77
+ @Keep
78
+ override fun invoke(payload: LiftoffAdEventPayload?): Unit {
79
+ return this.function(payload)
80
+ }
81
+ }
@@ -0,0 +1,72 @@
1
+ ///
2
+ /// HybridLiftoffAdsSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+
15
+ /**
16
+ * A Kotlin class representing the LiftoffAds HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of LiftoffAds.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridLiftoffAdsSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Properties
40
+
41
+
42
+ // Methods
43
+ @DoNotStrip
44
+ @Keep
45
+ abstract fun initialize(appId: String): Promise<Unit>
46
+
47
+ @DoNotStrip
48
+ @Keep
49
+ abstract fun setGDPRConsent(optIn: Boolean, consentMessageVersion: String): Unit
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ abstract fun setCCPAConsent(optIn: Boolean): Unit
54
+
55
+ @DoNotStrip
56
+ @Keep
57
+ abstract fun setCOPPA(isUserCoppa: Boolean): Unit
58
+
59
+ @DoNotStrip
60
+ @Keep
61
+ abstract fun createInterstitialAd(placementId: String): HybridLiftoffInterstitialAdSpec
62
+
63
+ @DoNotStrip
64
+ @Keep
65
+ abstract fun createRewardedAd(placementId: String): HybridLiftoffRewardedAdSpec
66
+
67
+ private external fun initHybrid(): HybridData
68
+
69
+ companion object {
70
+ private const val TAG = "HybridLiftoffAdsSpec"
71
+ }
72
+ }
@@ -0,0 +1,73 @@
1
+ ///
2
+ /// HybridLiftoffInterstitialAdSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+
15
+ /**
16
+ * A Kotlin class representing the LiftoffInterstitialAd HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of LiftoffInterstitialAd.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridLiftoffInterstitialAdSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Properties
40
+
41
+
42
+ // Methods
43
+ @DoNotStrip
44
+ @Keep
45
+ abstract fun load(): Unit
46
+
47
+ @DoNotStrip
48
+ @Keep
49
+ abstract fun show(options: LiftoffAdShowOptions?): Promise<Unit>
50
+
51
+ abstract fun addAdEventListener(eventType: LiftoffAdEventType, listener: (payload: LiftoffAdEventPayload?) -> Unit): Double
52
+
53
+ @DoNotStrip
54
+ @Keep
55
+ private fun addAdEventListener_cxx(eventType: LiftoffAdEventType, listener: Func_void_std__optional_LiftoffAdEventPayload_): Double {
56
+ val __result = addAdEventListener(eventType, listener)
57
+ return __result
58
+ }
59
+
60
+ @DoNotStrip
61
+ @Keep
62
+ abstract fun removeAdEventListener(subscriptionId: Double): Unit
63
+
64
+ @DoNotStrip
65
+ @Keep
66
+ abstract fun removeAllListeners(): Unit
67
+
68
+ private external fun initHybrid(): HybridData
69
+
70
+ companion object {
71
+ private const val TAG = "HybridLiftoffInterstitialAdSpec"
72
+ }
73
+ }
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// HybridLiftoffRewardedAdSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+
15
+ /**
16
+ * A Kotlin class representing the LiftoffRewardedAd HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of LiftoffRewardedAd.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridLiftoffRewardedAdSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Properties
40
+
41
+
42
+ // Methods
43
+ @DoNotStrip
44
+ @Keep
45
+ abstract fun load(): Unit
46
+
47
+ @DoNotStrip
48
+ @Keep
49
+ abstract fun setUserId(userId: String): Unit
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ abstract fun show(options: LiftoffAdShowOptions?): Promise<Unit>
54
+
55
+ abstract fun addAdEventListener(eventType: LiftoffAdEventType, listener: (payload: LiftoffAdEventPayload?) -> Unit): Double
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ private fun addAdEventListener_cxx(eventType: LiftoffAdEventType, listener: Func_void_std__optional_LiftoffAdEventPayload_): Double {
60
+ val __result = addAdEventListener(eventType, listener)
61
+ return __result
62
+ }
63
+
64
+ @DoNotStrip
65
+ @Keep
66
+ abstract fun removeAdEventListener(subscriptionId: Double): Unit
67
+
68
+ @DoNotStrip
69
+ @Keep
70
+ abstract fun removeAllListeners(): Unit
71
+
72
+ private external fun initHybrid(): HybridData
73
+
74
+ companion object {
75
+ private const val TAG = "HybridLiftoffRewardedAdSpec"
76
+ }
77
+ }
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// LiftoffAdEventPayload.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "LiftoffAdEventPayload".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class LiftoffAdEventPayload
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val errorCode: Double?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val errorMessage: String?
30
+ ) {
31
+ /* main constructor */
32
+ }
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// LiftoffAdEventType.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "LiftoffAdEventType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class LiftoffAdEventType(@DoNotStrip @Keep val value: Int) {
19
+ LOADED(0),
20
+ ERROR(1),
21
+ OPENED(2),
22
+ PAID(3),
23
+ CLICKED(4),
24
+ CLOSED(5),
25
+ REWARDED_LOADED(6),
26
+ REWARDED_EARNED_REWARD(7);
27
+ }
@@ -0,0 +1,29 @@
1
+ ///
2
+ /// LiftoffAdShowOptions.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "LiftoffAdShowOptions".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class LiftoffAdShowOptions
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val immersiveModeEnabled: Boolean?
27
+ ) {
28
+ /* main constructor */
29
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// NitroLiftoffAdsOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.liftoffads
9
+
10
+ import android.util.Log
11
+
12
+ internal class NitroLiftoffAdsOnLoad {
13
+ companion object {
14
+ private const val TAG = "NitroLiftoffAdsOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "NitroLiftoffAds".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading NitroLiftoffAds C++ library...")
25
+ System.loadLibrary("NitroLiftoffAds")
26
+ Log.i(TAG, "Successfully loaded NitroLiftoffAds C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load NitroLiftoffAds C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }