react-native-levelplayads 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/LICENSE +20 -0
  2. package/NitroLevelPlayAds.podspec +28 -0
  3. package/README.md +52 -0
  4. package/android/CMakeLists.txt +20 -0
  5. package/android/build.gradle +130 -0
  6. package/android/consumer-rules.pro +3 -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/levelplayads/HybridLevelPlayAds.kt +287 -0
  12. package/android/src/main/java/com/margelo/nitro/levelplayads/LevelPlayAndroidUtils.kt +30 -0
  13. package/android/src/main/java/com/margelo/nitro/levelplayads/NitroLevelPlayAdsPackage.java +27 -0
  14. package/ios/HybridLevelPlayAds.swift +274 -0
  15. package/ios/LevelPlayAdsSupport.swift +74 -0
  16. package/lib/module/index.js +31 -0
  17. package/lib/module/index.js.map +1 -0
  18. package/lib/module/index.test.js +78 -0
  19. package/lib/module/index.test.js.map +1 -0
  20. package/lib/module/package.json +1 -0
  21. package/lib/module/specs/LevelPlayAds.nitro.js +4 -0
  22. package/lib/module/specs/LevelPlayAds.nitro.js.map +1 -0
  23. package/lib/typescript/package.json +1 -0
  24. package/lib/typescript/src/index.d.ts +16 -0
  25. package/lib/typescript/src/index.d.ts.map +1 -0
  26. package/lib/typescript/src/index.test.d.ts +2 -0
  27. package/lib/typescript/src/index.test.d.ts.map +1 -0
  28. package/lib/typescript/src/specs/LevelPlayAds.nitro.d.ts +18 -0
  29. package/lib/typescript/src/specs/LevelPlayAds.nitro.d.ts.map +1 -0
  30. package/nitro.json +18 -0
  31. package/nitrogen/generated/android/NitroLevelPlayAds+autolinking.cmake +81 -0
  32. package/nitrogen/generated/android/NitroLevelPlayAds+autolinking.gradle +27 -0
  33. package/nitrogen/generated/android/NitroLevelPlayAdsOnLoad.cpp +44 -0
  34. package/nitrogen/generated/android/NitroLevelPlayAdsOnLoad.hpp +25 -0
  35. package/nitrogen/generated/android/c++/JHybridLevelPlayAdsSpec.cpp +112 -0
  36. package/nitrogen/generated/android/c++/JHybridLevelPlayAdsSpec.hpp +69 -0
  37. package/nitrogen/generated/android/c++/JLevelPlayAdShowResult.hpp +54 -0
  38. package/nitrogen/generated/android/c++/JLevelPlayAdShowState.hpp +59 -0
  39. package/nitrogen/generated/android/c++/JLevelPlayAdType.hpp +59 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/levelplayads/HybridLevelPlayAdsSpec.kt +72 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/levelplayads/LevelPlayAdShowResult.kt +29 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/levelplayads/LevelPlayAdShowState.kt +21 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/levelplayads/LevelPlayAdType.kt +21 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/levelplayads/NitroLevelPlayAdsOnLoad.kt +35 -0
  45. package/nitrogen/generated/ios/NitroLevelPlayAds+autolinking.rb +60 -0
  46. package/nitrogen/generated/ios/NitroLevelPlayAds-Swift-Cxx-Bridge.cpp +56 -0
  47. package/nitrogen/generated/ios/NitroLevelPlayAds-Swift-Cxx-Bridge.hpp +168 -0
  48. package/nitrogen/generated/ios/NitroLevelPlayAds-Swift-Cxx-Umbrella.hpp +54 -0
  49. package/nitrogen/generated/ios/NitroLevelPlayAdsAutolinking.mm +33 -0
  50. package/nitrogen/generated/ios/NitroLevelPlayAdsAutolinking.swift +25 -0
  51. package/nitrogen/generated/ios/c++/HybridLevelPlayAdsSpecSwift.cpp +11 -0
  52. package/nitrogen/generated/ios/c++/HybridLevelPlayAdsSpecSwift.hpp +116 -0
  53. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  54. package/nitrogen/generated/ios/swift/Func_void_LevelPlayAdShowResult.swift +47 -0
  55. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  56. package/nitrogen/generated/ios/swift/HybridLevelPlayAdsSpec.swift +54 -0
  57. package/nitrogen/generated/ios/swift/HybridLevelPlayAdsSpec_cxx.swift +201 -0
  58. package/nitrogen/generated/ios/swift/LevelPlayAdShowResult.swift +35 -0
  59. package/nitrogen/generated/ios/swift/LevelPlayAdShowState.swift +40 -0
  60. package/nitrogen/generated/ios/swift/LevelPlayAdType.swift +40 -0
  61. package/nitrogen/generated/shared/c++/HybridLevelPlayAdsSpec.cpp +26 -0
  62. package/nitrogen/generated/shared/c++/HybridLevelPlayAdsSpec.hpp +73 -0
  63. package/nitrogen/generated/shared/c++/LevelPlayAdShowResult.hpp +68 -0
  64. package/nitrogen/generated/shared/c++/LevelPlayAdShowState.hpp +76 -0
  65. package/nitrogen/generated/shared/c++/LevelPlayAdType.hpp +76 -0
  66. package/package.json +170 -0
  67. package/react-native.config.js +8 -0
  68. package/src/index.test.ts +119 -0
  69. package/src/index.ts +71 -0
  70. package/src/specs/LevelPlayAds.nitro.ts +26 -0
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// NitroLevelPlayAds-Swift-Cxx-Bridge.cpp
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
+ #include "NitroLevelPlayAds-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridLevelPlayAdsSpecSwift.hpp"
12
+ #include "NitroLevelPlayAds-Swift-Cxx-Umbrella.hpp"
13
+
14
+ namespace margelo::nitro::levelplayads::bridge::swift {
15
+
16
+ // pragma MARK: std::function<void()>
17
+ Func_void create_Func_void(void* _Nonnull swiftClosureWrapper) noexcept {
18
+ auto swiftClosure = NitroLevelPlayAds::Func_void::fromUnsafe(swiftClosureWrapper);
19
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
20
+ swiftClosure.call();
21
+ };
22
+ }
23
+
24
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
25
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper) noexcept {
26
+ auto swiftClosure = NitroLevelPlayAds::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
27
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
28
+ swiftClosure.call(error);
29
+ };
30
+ }
31
+
32
+ // pragma MARK: std::function<void(const LevelPlayAdShowResult& /* result */)>
33
+ Func_void_LevelPlayAdShowResult create_Func_void_LevelPlayAdShowResult(void* _Nonnull swiftClosureWrapper) noexcept {
34
+ auto swiftClosure = NitroLevelPlayAds::Func_void_LevelPlayAdShowResult::fromUnsafe(swiftClosureWrapper);
35
+ return [swiftClosure = std::move(swiftClosure)](const LevelPlayAdShowResult& result) mutable -> void {
36
+ swiftClosure.call(result);
37
+ };
38
+ }
39
+
40
+ // pragma MARK: std::shared_ptr<HybridLevelPlayAdsSpec>
41
+ std::shared_ptr<HybridLevelPlayAdsSpec> create_std__shared_ptr_HybridLevelPlayAdsSpec_(void* _Nonnull swiftUnsafePointer) noexcept {
42
+ NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx swiftPart = NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx::fromUnsafe(swiftUnsafePointer);
43
+ return std::make_shared<margelo::nitro::levelplayads::HybridLevelPlayAdsSpecSwift>(swiftPart);
44
+ }
45
+ void* _Nonnull get_std__shared_ptr_HybridLevelPlayAdsSpec_(std__shared_ptr_HybridLevelPlayAdsSpec_ cppType) noexcept {
46
+ std::shared_ptr<margelo::nitro::levelplayads::HybridLevelPlayAdsSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::levelplayads::HybridLevelPlayAdsSpecSwift>(cppType);
47
+ #ifdef NITRO_DEBUG
48
+ if (swiftWrapper == nullptr) [[unlikely]] {
49
+ throw std::runtime_error("Class \"HybridLevelPlayAdsSpec\" is not implemented in Swift!");
50
+ }
51
+ #endif
52
+ NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
53
+ return swiftPart.toUnsafe();
54
+ }
55
+
56
+ } // namespace margelo::nitro::levelplayads::bridge::swift
@@ -0,0 +1,168 @@
1
+ ///
2
+ /// NitroLevelPlayAds-Swift-Cxx-Bridge.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridLevelPlayAdsSpec` to properly resolve imports.
12
+ namespace margelo::nitro::levelplayads { class HybridLevelPlayAdsSpec; }
13
+ // Forward declaration of `LevelPlayAdShowResult` to properly resolve imports.
14
+ namespace margelo::nitro::levelplayads { struct LevelPlayAdShowResult; }
15
+ // Forward declaration of `LevelPlayAdShowState` to properly resolve imports.
16
+ namespace margelo::nitro::levelplayads { enum class LevelPlayAdShowState; }
17
+
18
+ // Forward declarations of Swift defined types
19
+ // Forward declaration of `HybridLevelPlayAdsSpec_cxx` to properly resolve imports.
20
+ namespace NitroLevelPlayAds { class HybridLevelPlayAdsSpec_cxx; }
21
+
22
+ // Include C++ defined types
23
+ #include "HybridLevelPlayAdsSpec.hpp"
24
+ #include "LevelPlayAdShowResult.hpp"
25
+ #include "LevelPlayAdShowState.hpp"
26
+ #include <NitroModules/Promise.hpp>
27
+ #include <NitroModules/PromiseHolder.hpp>
28
+ #include <NitroModules/Result.hpp>
29
+ #include <exception>
30
+ #include <functional>
31
+ #include <memory>
32
+
33
+ /**
34
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
35
+ * as well as helper functions to interact with those C++ types from Swift.
36
+ */
37
+ namespace margelo::nitro::levelplayads::bridge::swift {
38
+
39
+ // pragma MARK: std::shared_ptr<Promise<void>>
40
+ /**
41
+ * Specialized version of `std::shared_ptr<Promise<void>>`.
42
+ */
43
+ using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
44
+ inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
45
+ return Promise<void>::create();
46
+ }
47
+ inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
48
+ return PromiseHolder<void>(std::move(promise));
49
+ }
50
+
51
+ // pragma MARK: std::function<void()>
52
+ /**
53
+ * Specialized version of `std::function<void()>`.
54
+ */
55
+ using Func_void = std::function<void()>;
56
+ /**
57
+ * Wrapper class for a `std::function<void()>`, this can be used from Swift.
58
+ */
59
+ class Func_void_Wrapper final {
60
+ public:
61
+ explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
62
+ inline void call() const noexcept {
63
+ _function->operator()();
64
+ }
65
+ private:
66
+ std::unique_ptr<std::function<void()>> _function;
67
+ } SWIFT_NONCOPYABLE;
68
+ Func_void create_Func_void(void* _Nonnull swiftClosureWrapper) noexcept;
69
+ inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
70
+ return Func_void_Wrapper(std::move(value));
71
+ }
72
+
73
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
74
+ /**
75
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
76
+ */
77
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
78
+ /**
79
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
80
+ */
81
+ class Func_void_std__exception_ptr_Wrapper final {
82
+ public:
83
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
84
+ inline void call(std::exception_ptr error) const noexcept {
85
+ _function->operator()(error);
86
+ }
87
+ private:
88
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
89
+ } SWIFT_NONCOPYABLE;
90
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper) noexcept;
91
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
92
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
93
+ }
94
+
95
+ // pragma MARK: std::shared_ptr<Promise<LevelPlayAdShowResult>>
96
+ /**
97
+ * Specialized version of `std::shared_ptr<Promise<LevelPlayAdShowResult>>`.
98
+ */
99
+ using std__shared_ptr_Promise_LevelPlayAdShowResult__ = std::shared_ptr<Promise<LevelPlayAdShowResult>>;
100
+ inline std::shared_ptr<Promise<LevelPlayAdShowResult>> create_std__shared_ptr_Promise_LevelPlayAdShowResult__() noexcept {
101
+ return Promise<LevelPlayAdShowResult>::create();
102
+ }
103
+ inline PromiseHolder<LevelPlayAdShowResult> wrap_std__shared_ptr_Promise_LevelPlayAdShowResult__(std::shared_ptr<Promise<LevelPlayAdShowResult>> promise) noexcept {
104
+ return PromiseHolder<LevelPlayAdShowResult>(std::move(promise));
105
+ }
106
+
107
+ // pragma MARK: std::function<void(const LevelPlayAdShowResult& /* result */)>
108
+ /**
109
+ * Specialized version of `std::function<void(const LevelPlayAdShowResult&)>`.
110
+ */
111
+ using Func_void_LevelPlayAdShowResult = std::function<void(const LevelPlayAdShowResult& /* result */)>;
112
+ /**
113
+ * Wrapper class for a `std::function<void(const LevelPlayAdShowResult& / * result * /)>`, this can be used from Swift.
114
+ */
115
+ class Func_void_LevelPlayAdShowResult_Wrapper final {
116
+ public:
117
+ explicit Func_void_LevelPlayAdShowResult_Wrapper(std::function<void(const LevelPlayAdShowResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const LevelPlayAdShowResult& /* result */)>>(std::move(func))) {}
118
+ inline void call(LevelPlayAdShowResult result) const noexcept {
119
+ _function->operator()(result);
120
+ }
121
+ private:
122
+ std::unique_ptr<std::function<void(const LevelPlayAdShowResult& /* result */)>> _function;
123
+ } SWIFT_NONCOPYABLE;
124
+ Func_void_LevelPlayAdShowResult create_Func_void_LevelPlayAdShowResult(void* _Nonnull swiftClosureWrapper) noexcept;
125
+ inline Func_void_LevelPlayAdShowResult_Wrapper wrap_Func_void_LevelPlayAdShowResult(Func_void_LevelPlayAdShowResult value) noexcept {
126
+ return Func_void_LevelPlayAdShowResult_Wrapper(std::move(value));
127
+ }
128
+
129
+ // pragma MARK: std::shared_ptr<HybridLevelPlayAdsSpec>
130
+ /**
131
+ * Specialized version of `std::shared_ptr<HybridLevelPlayAdsSpec>`.
132
+ */
133
+ using std__shared_ptr_HybridLevelPlayAdsSpec_ = std::shared_ptr<HybridLevelPlayAdsSpec>;
134
+ std::shared_ptr<HybridLevelPlayAdsSpec> create_std__shared_ptr_HybridLevelPlayAdsSpec_(void* _Nonnull swiftUnsafePointer) noexcept;
135
+ void* _Nonnull get_std__shared_ptr_HybridLevelPlayAdsSpec_(std__shared_ptr_HybridLevelPlayAdsSpec_ cppType) noexcept;
136
+
137
+ // pragma MARK: std::weak_ptr<HybridLevelPlayAdsSpec>
138
+ using std__weak_ptr_HybridLevelPlayAdsSpec_ = std::weak_ptr<HybridLevelPlayAdsSpec>;
139
+ inline std__weak_ptr_HybridLevelPlayAdsSpec_ weakify_std__shared_ptr_HybridLevelPlayAdsSpec_(const std::shared_ptr<HybridLevelPlayAdsSpec>& strong) noexcept { return strong; }
140
+
141
+ // pragma MARK: Result<std::shared_ptr<Promise<void>>>
142
+ using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
143
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
144
+ return Result<std::shared_ptr<Promise<void>>>::withValue(value);
145
+ }
146
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
147
+ return Result<std::shared_ptr<Promise<void>>>::withError(error);
148
+ }
149
+
150
+ // pragma MARK: Result<std::shared_ptr<Promise<LevelPlayAdShowResult>>>
151
+ using Result_std__shared_ptr_Promise_LevelPlayAdShowResult___ = Result<std::shared_ptr<Promise<LevelPlayAdShowResult>>>;
152
+ inline Result_std__shared_ptr_Promise_LevelPlayAdShowResult___ create_Result_std__shared_ptr_Promise_LevelPlayAdShowResult___(const std::shared_ptr<Promise<LevelPlayAdShowResult>>& value) noexcept {
153
+ return Result<std::shared_ptr<Promise<LevelPlayAdShowResult>>>::withValue(value);
154
+ }
155
+ inline Result_std__shared_ptr_Promise_LevelPlayAdShowResult___ create_Result_std__shared_ptr_Promise_LevelPlayAdShowResult___(const std::exception_ptr& error) noexcept {
156
+ return Result<std::shared_ptr<Promise<LevelPlayAdShowResult>>>::withError(error);
157
+ }
158
+
159
+ // pragma MARK: Result<void>
160
+ using Result_void_ = Result<void>;
161
+ inline Result_void_ create_Result_void_() noexcept {
162
+ return Result<void>::withValue();
163
+ }
164
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
165
+ return Result<void>::withError(error);
166
+ }
167
+
168
+ } // namespace margelo::nitro::levelplayads::bridge::swift
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// NitroLevelPlayAds-Swift-Cxx-Umbrella.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridLevelPlayAdsSpec` to properly resolve imports.
12
+ namespace margelo::nitro::levelplayads { class HybridLevelPlayAdsSpec; }
13
+ // Forward declaration of `LevelPlayAdShowResult` to properly resolve imports.
14
+ namespace margelo::nitro::levelplayads { struct LevelPlayAdShowResult; }
15
+ // Forward declaration of `LevelPlayAdShowState` to properly resolve imports.
16
+ namespace margelo::nitro::levelplayads { enum class LevelPlayAdShowState; }
17
+ // Forward declaration of `LevelPlayAdType` to properly resolve imports.
18
+ namespace margelo::nitro::levelplayads { enum class LevelPlayAdType; }
19
+
20
+ // Include C++ defined types
21
+ #include "HybridLevelPlayAdsSpec.hpp"
22
+ #include "LevelPlayAdShowResult.hpp"
23
+ #include "LevelPlayAdShowState.hpp"
24
+ #include "LevelPlayAdType.hpp"
25
+ #include <NitroModules/Promise.hpp>
26
+ #include <NitroModules/Result.hpp>
27
+ #include <exception>
28
+ #include <memory>
29
+ #include <string>
30
+
31
+ // C++ helpers for Swift
32
+ #include "NitroLevelPlayAds-Swift-Cxx-Bridge.hpp"
33
+
34
+ // Common C++ types used in Swift
35
+ #include <NitroModules/ArrayBufferHolder.hpp>
36
+ #include <NitroModules/AnyMapUtils.hpp>
37
+ #include <NitroModules/RuntimeError.hpp>
38
+ #include <NitroModules/DateToChronoDate.hpp>
39
+
40
+ // Forward declarations of Swift defined types
41
+ // Forward declaration of `HybridLevelPlayAdsSpec_cxx` to properly resolve imports.
42
+ namespace NitroLevelPlayAds { class HybridLevelPlayAdsSpec_cxx; }
43
+
44
+ // Include Swift defined types
45
+ #if __has_include("NitroLevelPlayAds-Swift.h")
46
+ // This header is generated by Xcode/Swift on every app build.
47
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroLevelPlayAds".
48
+ #include "NitroLevelPlayAds-Swift.h"
49
+ // Same as above, but used when building with frameworks (`use_frameworks`)
50
+ #elif __has_include(<NitroLevelPlayAds/NitroLevelPlayAds-Swift.h>)
51
+ #include <NitroLevelPlayAds/NitroLevelPlayAds-Swift.h>
52
+ #else
53
+ #error NitroLevelPlayAds's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroLevelPlayAds", and try building the app first.
54
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// NitroLevelPlayAdsAutolinking.mm
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
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "NitroLevelPlayAds-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridLevelPlayAdsSpecSwift.hpp"
14
+
15
+ @interface NitroLevelPlayAdsAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation NitroLevelPlayAdsAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::levelplayads;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "LevelPlayAds",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridLevelPlayAdsSpec> hybridObject = NitroLevelPlayAds::NitroLevelPlayAdsAutolinking::createLevelPlayAds();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// NitroLevelPlayAdsAutolinking.swift
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
+ public final class NitroLevelPlayAdsAutolinking {
9
+ public typealias bridge = margelo.nitro.levelplayads.bridge.swift
10
+
11
+ /**
12
+ * Creates an instance of a Swift class that implements `HybridLevelPlayAdsSpec`,
13
+ * and wraps it in a Swift class that can directly interop with C++ (`HybridLevelPlayAdsSpec_cxx`)
14
+ *
15
+ * This is generated by Nitrogen and will initialize the class specified
16
+ * in the `"autolinking"` property of `nitro.json` (in this case, `HybridLevelPlayAds`).
17
+ */
18
+ public static func createLevelPlayAds() -> bridge.std__shared_ptr_HybridLevelPlayAdsSpec_ {
19
+ let hybridObject = HybridLevelPlayAds()
20
+ return { () -> bridge.std__shared_ptr_HybridLevelPlayAdsSpec_ in
21
+ let __cxxWrapped = hybridObject.getCxxWrapper()
22
+ return __cxxWrapped.getCxxPart()
23
+ }()
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridLevelPlayAdsSpecSwift.cpp
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
+ #include "HybridLevelPlayAdsSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::levelplayads {
11
+ } // namespace margelo::nitro::levelplayads
@@ -0,0 +1,116 @@
1
+ ///
2
+ /// HybridLevelPlayAdsSpecSwift.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 "HybridLevelPlayAdsSpec.hpp"
11
+
12
+ // Forward declaration of `HybridLevelPlayAdsSpec_cxx` to properly resolve imports.
13
+ namespace NitroLevelPlayAds { class HybridLevelPlayAdsSpec_cxx; }
14
+
15
+ // Forward declaration of `LevelPlayAdType` to properly resolve imports.
16
+ namespace margelo::nitro::levelplayads { enum class LevelPlayAdType; }
17
+ // Forward declaration of `LevelPlayAdShowResult` to properly resolve imports.
18
+ namespace margelo::nitro::levelplayads { struct LevelPlayAdShowResult; }
19
+ // Forward declaration of `LevelPlayAdShowState` to properly resolve imports.
20
+ namespace margelo::nitro::levelplayads { enum class LevelPlayAdShowState; }
21
+
22
+ #include <NitroModules/Promise.hpp>
23
+ #include <string>
24
+ #include "LevelPlayAdType.hpp"
25
+ #include "LevelPlayAdShowResult.hpp"
26
+ #include "LevelPlayAdShowState.hpp"
27
+
28
+ #include "NitroLevelPlayAds-Swift-Cxx-Umbrella.hpp"
29
+
30
+ namespace margelo::nitro::levelplayads {
31
+
32
+ /**
33
+ * The C++ part of HybridLevelPlayAdsSpec_cxx.swift.
34
+ *
35
+ * HybridLevelPlayAdsSpecSwift (C++) accesses HybridLevelPlayAdsSpec_cxx (Swift), and might
36
+ * contain some additional bridging code for C++ <> Swift interop.
37
+ *
38
+ * Since this obviously introduces an overhead, I hope at some point in
39
+ * the future, HybridLevelPlayAdsSpec_cxx can directly inherit from the C++ class HybridLevelPlayAdsSpec
40
+ * to simplify the whole structure and memory management.
41
+ */
42
+ class HybridLevelPlayAdsSpecSwift: public virtual HybridLevelPlayAdsSpec {
43
+ public:
44
+ // Constructor from a Swift instance
45
+ explicit HybridLevelPlayAdsSpecSwift(const NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx& swiftPart):
46
+ HybridObject(HybridLevelPlayAdsSpec::TAG),
47
+ _swiftPart(swiftPart) { }
48
+
49
+ public:
50
+ // Get the Swift part
51
+ inline NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx& getSwiftPart() noexcept {
52
+ return _swiftPart;
53
+ }
54
+
55
+ public:
56
+ inline size_t getExternalMemorySize() noexcept override {
57
+ return _swiftPart.getMemorySize();
58
+ }
59
+ void dispose() noexcept override {
60
+ _swiftPart.dispose();
61
+ }
62
+
63
+ public:
64
+ // Properties
65
+
66
+
67
+ public:
68
+ // Methods
69
+ inline std::shared_ptr<Promise<void>> initialize(const std::string& appKey, bool testMode) override {
70
+ auto __result = _swiftPart.initialize(appKey, std::forward<decltype(testMode)>(testMode));
71
+ if (__result.hasError()) [[unlikely]] {
72
+ std::rethrow_exception(__result.error());
73
+ }
74
+ auto __value = std::move(__result.value());
75
+ return __value;
76
+ }
77
+ inline std::shared_ptr<Promise<void>> load(LevelPlayAdType adType, const std::string& adUnitId) override {
78
+ auto __result = _swiftPart.load(static_cast<int>(adType), adUnitId);
79
+ if (__result.hasError()) [[unlikely]] {
80
+ std::rethrow_exception(__result.error());
81
+ }
82
+ auto __value = std::move(__result.value());
83
+ return __value;
84
+ }
85
+ inline std::shared_ptr<Promise<LevelPlayAdShowResult>> show(LevelPlayAdType adType, const std::string& adUnitId) override {
86
+ auto __result = _swiftPart.show(static_cast<int>(adType), adUnitId);
87
+ if (__result.hasError()) [[unlikely]] {
88
+ std::rethrow_exception(__result.error());
89
+ }
90
+ auto __value = std::move(__result.value());
91
+ return __value;
92
+ }
93
+ inline void setGDPRConsent(bool optIn) override {
94
+ auto __result = _swiftPart.setGDPRConsent(std::forward<decltype(optIn)>(optIn));
95
+ if (__result.hasError()) [[unlikely]] {
96
+ std::rethrow_exception(__result.error());
97
+ }
98
+ }
99
+ inline void setCCPAConsent(bool optIn) override {
100
+ auto __result = _swiftPart.setCCPAConsent(std::forward<decltype(optIn)>(optIn));
101
+ if (__result.hasError()) [[unlikely]] {
102
+ std::rethrow_exception(__result.error());
103
+ }
104
+ }
105
+ inline void setCOPPA(bool isCoppa) override {
106
+ auto __result = _swiftPart.setCOPPA(std::forward<decltype(isCoppa)>(isCoppa));
107
+ if (__result.hasError()) [[unlikely]] {
108
+ std::rethrow_exception(__result.error());
109
+ }
110
+ }
111
+
112
+ private:
113
+ NitroLevelPlayAds::HybridLevelPlayAdsSpec_cxx _swiftPart;
114
+ };
115
+
116
+ } // namespace margelo::nitro::levelplayads
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void.swift
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
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `() -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void {
16
+ public typealias bridge = margelo.nitro.levelplayads.bridge.swift
17
+
18
+ private let closure: () -> Void
19
+
20
+ public init(_ closure: @escaping () -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call() -> Void {
26
+ self.closure()
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
45
+ return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_LevelPlayAdShowResult.swift
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
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: LevelPlayAdShowResult) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_LevelPlayAdShowResult {
16
+ public typealias bridge = margelo.nitro.levelplayads.bridge.swift
17
+
18
+ private let closure: (_ value: LevelPlayAdShowResult) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: LevelPlayAdShowResult) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: LevelPlayAdShowResult) -> Void {
26
+ self.closure(value)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_LevelPlayAdShowResult`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_LevelPlayAdShowResult>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_LevelPlayAdShowResult {
45
+ return Unmanaged<Func_void_LevelPlayAdShowResult>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__exception_ptr.swift
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
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ error: Error) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__exception_ptr {
16
+ public typealias bridge = margelo.nitro.levelplayads.bridge.swift
17
+
18
+ private let closure: (_ error: Error) -> Void
19
+
20
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(error: std.exception_ptr) -> Void {
26
+ self.closure(RuntimeError.from(cppError: error))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
45
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// HybridLevelPlayAdsSpec.swift
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
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridLevelPlayAdsSpec``
12
+ public protocol HybridLevelPlayAdsSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func initialize(appKey: String, testMode: Bool) throws -> Promise<Void>
18
+ func load(adType: LevelPlayAdType, adUnitId: String) throws -> Promise<Void>
19
+ func show(adType: LevelPlayAdType, adUnitId: String) throws -> Promise<LevelPlayAdShowResult>
20
+ func setGDPRConsent(optIn: Bool) throws -> Void
21
+ func setCCPAConsent(optIn: Bool) throws -> Void
22
+ func setCOPPA(isCoppa: Bool) throws -> Void
23
+ }
24
+
25
+ /// See ``HybridLevelPlayAdsSpec``
26
+ open class HybridLevelPlayAdsSpec_base {
27
+ private weak var cxxWrapper: HybridLevelPlayAdsSpec_cxx? = nil
28
+ public init() { }
29
+ public func getCxxWrapper() -> HybridLevelPlayAdsSpec_cxx {
30
+ #if DEBUG
31
+ guard self is HybridLevelPlayAdsSpec else {
32
+ fatalError("`self` is not a `HybridLevelPlayAdsSpec`! Did you accidentally inherit from `HybridLevelPlayAdsSpec_base` instead of `HybridLevelPlayAdsSpec`?")
33
+ }
34
+ #endif
35
+ if let cxxWrapper = self.cxxWrapper {
36
+ return cxxWrapper
37
+ } else {
38
+ let cxxWrapper = HybridLevelPlayAdsSpec_cxx(self as! HybridLevelPlayAdsSpec)
39
+ self.cxxWrapper = cxxWrapper
40
+ return cxxWrapper
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * A Swift base-protocol representing the LevelPlayAds HybridObject.
47
+ * Implement this protocol to create Swift-based instances of LevelPlayAds.
48
+ * ```swift
49
+ * class HybridLevelPlayAds : HybridLevelPlayAdsSpec {
50
+ * // ...
51
+ * }
52
+ * ```
53
+ */
54
+ public typealias HybridLevelPlayAdsSpec = HybridLevelPlayAdsSpec_protocol & HybridLevelPlayAdsSpec_base