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,193 @@
1
+ ///
2
+ /// HybridLiftoffAdsSpec_cxx.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
+ /**
12
+ * A class implementation that bridges HybridLiftoffAdsSpec over to C++.
13
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
+ *
15
+ * Also, some Swift types need to be bridged with special handling:
16
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
+ */
20
+ open class HybridLiftoffAdsSpec_cxx {
21
+ /**
22
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::liftoffads::bridge::swift`)
23
+ * from `NitroLiftoffAds-Swift-Cxx-Bridge.hpp`.
24
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
25
+ */
26
+ public typealias bridge = margelo.nitro.liftoffads.bridge.swift
27
+
28
+ /**
29
+ * Holds an instance of the `HybridLiftoffAdsSpec` Swift protocol.
30
+ */
31
+ private var __implementation: any HybridLiftoffAdsSpec
32
+
33
+ /**
34
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
35
+ */
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridLiftoffAdsSpec_
37
+
38
+ /**
39
+ * Create a new `HybridLiftoffAdsSpec_cxx` that wraps the given `HybridLiftoffAdsSpec`.
40
+ * All properties and methods bridge to C++ types.
41
+ */
42
+ public init(_ implementation: any HybridLiftoffAdsSpec) {
43
+ self.__implementation = implementation
44
+ self.__cxxPart = .init()
45
+ /* no base class */
46
+ }
47
+
48
+ /**
49
+ * Get the actual `HybridLiftoffAdsSpec` instance this class wraps.
50
+ */
51
+ @inline(__always)
52
+ public func getHybridLiftoffAdsSpec() -> any HybridLiftoffAdsSpec {
53
+ return __implementation
54
+ }
55
+
56
+ /**
57
+ * Casts this instance to a retained unsafe raw pointer.
58
+ * This acquires one additional strong reference on the object!
59
+ */
60
+ public func toUnsafe() -> UnsafeMutableRawPointer {
61
+ return Unmanaged.passRetained(self).toOpaque()
62
+ }
63
+
64
+ /**
65
+ * Casts an unsafe pointer to a `HybridLiftoffAdsSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridLiftoffAdsSpec_cxx>`.
67
+ * This removes one strong reference from the object!
68
+ */
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLiftoffAdsSpec_cxx {
70
+ return Unmanaged<HybridLiftoffAdsSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
+ }
72
+
73
+ /**
74
+ * Gets (or creates) the C++ part of this Hybrid Object.
75
+ * The C++ part is a `std::shared_ptr<HybridLiftoffAdsSpec>`.
76
+ */
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridLiftoffAdsSpec_ {
78
+ let cachedCxxPart = self.__cxxPart.lock()
79
+ if cachedCxxPart.__convertToBool() {
80
+ return cachedCxxPart
81
+ } else {
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridLiftoffAdsSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridLiftoffAdsSpec_(newCxxPart)
84
+ return newCxxPart
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /**
91
+ * Get the memory size of the Swift class (plus size of any other allocations)
92
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
93
+ */
94
+ @inline(__always)
95
+ public var memorySize: Int {
96
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
+ }
98
+
99
+ /**
100
+ * Call dispose() on the Swift class.
101
+ * This _may_ be called manually from JS.
102
+ */
103
+ @inline(__always)
104
+ public func dispose() {
105
+ self.__implementation.dispose()
106
+ }
107
+
108
+ // Properties
109
+
110
+
111
+ // Methods
112
+ @inline(__always)
113
+ public final func initialize(appId: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
114
+ do {
115
+ let __result = try self.__implementation.initialize(appId: String(appId))
116
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
117
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
118
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
119
+ __result
120
+ .then({ __result in __promiseHolder.resolve() })
121
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
122
+ return __promise
123
+ }()
124
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
125
+ } catch (let __error) {
126
+ let __exceptionPtr = __error.toCpp()
127
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
128
+ }
129
+ }
130
+
131
+ @inline(__always)
132
+ public final func setGDPRConsent(optIn: Bool, consentMessageVersion: std.string) -> bridge.Result_void_ {
133
+ do {
134
+ try self.__implementation.setGDPRConsent(optIn: optIn, consentMessageVersion: String(consentMessageVersion))
135
+ return bridge.create_Result_void_()
136
+ } catch (let __error) {
137
+ let __exceptionPtr = __error.toCpp()
138
+ return bridge.create_Result_void_(__exceptionPtr)
139
+ }
140
+ }
141
+
142
+ @inline(__always)
143
+ public final func setCCPAConsent(optIn: Bool) -> bridge.Result_void_ {
144
+ do {
145
+ try self.__implementation.setCCPAConsent(optIn: optIn)
146
+ return bridge.create_Result_void_()
147
+ } catch (let __error) {
148
+ let __exceptionPtr = __error.toCpp()
149
+ return bridge.create_Result_void_(__exceptionPtr)
150
+ }
151
+ }
152
+
153
+ @inline(__always)
154
+ public final func setCOPPA(isUserCoppa: Bool) -> bridge.Result_void_ {
155
+ do {
156
+ try self.__implementation.setCOPPA(isUserCoppa: isUserCoppa)
157
+ return bridge.create_Result_void_()
158
+ } catch (let __error) {
159
+ let __exceptionPtr = __error.toCpp()
160
+ return bridge.create_Result_void_(__exceptionPtr)
161
+ }
162
+ }
163
+
164
+ @inline(__always)
165
+ public final func createInterstitialAd(placementId: std.string) -> bridge.Result_std__shared_ptr_HybridLiftoffInterstitialAdSpec__ {
166
+ do {
167
+ let __result = try self.__implementation.createInterstitialAd(placementId: String(placementId))
168
+ let __resultCpp = { () -> bridge.std__shared_ptr_HybridLiftoffInterstitialAdSpec_ in
169
+ let __cxxWrapped = __result.getCxxWrapper()
170
+ return __cxxWrapped.getCxxPart()
171
+ }()
172
+ return bridge.create_Result_std__shared_ptr_HybridLiftoffInterstitialAdSpec__(__resultCpp)
173
+ } catch (let __error) {
174
+ let __exceptionPtr = __error.toCpp()
175
+ return bridge.create_Result_std__shared_ptr_HybridLiftoffInterstitialAdSpec__(__exceptionPtr)
176
+ }
177
+ }
178
+
179
+ @inline(__always)
180
+ public final func createRewardedAd(placementId: std.string) -> bridge.Result_std__shared_ptr_HybridLiftoffRewardedAdSpec__ {
181
+ do {
182
+ let __result = try self.__implementation.createRewardedAd(placementId: String(placementId))
183
+ let __resultCpp = { () -> bridge.std__shared_ptr_HybridLiftoffRewardedAdSpec_ in
184
+ let __cxxWrapped = __result.getCxxWrapper()
185
+ return __cxxWrapped.getCxxPart()
186
+ }()
187
+ return bridge.create_Result_std__shared_ptr_HybridLiftoffRewardedAdSpec__(__resultCpp)
188
+ } catch (let __error) {
189
+ let __exceptionPtr = __error.toCpp()
190
+ return bridge.create_Result_std__shared_ptr_HybridLiftoffRewardedAdSpec__(__exceptionPtr)
191
+ }
192
+ }
193
+ }
@@ -0,0 +1,53 @@
1
+ ///
2
+ /// HybridLiftoffInterstitialAdSpec.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 ``HybridLiftoffInterstitialAdSpec``
12
+ public protocol HybridLiftoffInterstitialAdSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func load() throws -> Void
18
+ func show(options: LiftoffAdShowOptions?) throws -> Promise<Void>
19
+ func addAdEventListener(eventType: LiftoffAdEventType, listener: @escaping (_ payload: LiftoffAdEventPayload?) -> Void) throws -> Double
20
+ func removeAdEventListener(subscriptionId: Double) throws -> Void
21
+ func removeAllListeners() throws -> Void
22
+ }
23
+
24
+ /// See ``HybridLiftoffInterstitialAdSpec``
25
+ open class HybridLiftoffInterstitialAdSpec_base {
26
+ private weak var cxxWrapper: HybridLiftoffInterstitialAdSpec_cxx? = nil
27
+ public init() { }
28
+ public func getCxxWrapper() -> HybridLiftoffInterstitialAdSpec_cxx {
29
+ #if DEBUG
30
+ guard self is HybridLiftoffInterstitialAdSpec else {
31
+ fatalError("`self` is not a `HybridLiftoffInterstitialAdSpec`! Did you accidentally inherit from `HybridLiftoffInterstitialAdSpec_base` instead of `HybridLiftoffInterstitialAdSpec`?")
32
+ }
33
+ #endif
34
+ if let cxxWrapper = self.cxxWrapper {
35
+ return cxxWrapper
36
+ } else {
37
+ let cxxWrapper = HybridLiftoffInterstitialAdSpec_cxx(self as! HybridLiftoffInterstitialAdSpec)
38
+ self.cxxWrapper = cxxWrapper
39
+ return cxxWrapper
40
+ }
41
+ }
42
+ }
43
+
44
+ /**
45
+ * A Swift base-protocol representing the LiftoffInterstitialAd HybridObject.
46
+ * Implement this protocol to create Swift-based instances of LiftoffInterstitialAd.
47
+ * ```swift
48
+ * class HybridLiftoffInterstitialAd : HybridLiftoffInterstitialAdSpec {
49
+ * // ...
50
+ * }
51
+ * ```
52
+ */
53
+ public typealias HybridLiftoffInterstitialAdSpec = HybridLiftoffInterstitialAdSpec_protocol & HybridLiftoffInterstitialAdSpec_base
@@ -0,0 +1,193 @@
1
+ ///
2
+ /// HybridLiftoffInterstitialAdSpec_cxx.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
+ /**
12
+ * A class implementation that bridges HybridLiftoffInterstitialAdSpec over to C++.
13
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
+ *
15
+ * Also, some Swift types need to be bridged with special handling:
16
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
+ */
20
+ open class HybridLiftoffInterstitialAdSpec_cxx {
21
+ /**
22
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::liftoffads::bridge::swift`)
23
+ * from `NitroLiftoffAds-Swift-Cxx-Bridge.hpp`.
24
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
25
+ */
26
+ public typealias bridge = margelo.nitro.liftoffads.bridge.swift
27
+
28
+ /**
29
+ * Holds an instance of the `HybridLiftoffInterstitialAdSpec` Swift protocol.
30
+ */
31
+ private var __implementation: any HybridLiftoffInterstitialAdSpec
32
+
33
+ /**
34
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
35
+ */
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridLiftoffInterstitialAdSpec_
37
+
38
+ /**
39
+ * Create a new `HybridLiftoffInterstitialAdSpec_cxx` that wraps the given `HybridLiftoffInterstitialAdSpec`.
40
+ * All properties and methods bridge to C++ types.
41
+ */
42
+ public init(_ implementation: any HybridLiftoffInterstitialAdSpec) {
43
+ self.__implementation = implementation
44
+ self.__cxxPart = .init()
45
+ /* no base class */
46
+ }
47
+
48
+ /**
49
+ * Get the actual `HybridLiftoffInterstitialAdSpec` instance this class wraps.
50
+ */
51
+ @inline(__always)
52
+ public func getHybridLiftoffInterstitialAdSpec() -> any HybridLiftoffInterstitialAdSpec {
53
+ return __implementation
54
+ }
55
+
56
+ /**
57
+ * Casts this instance to a retained unsafe raw pointer.
58
+ * This acquires one additional strong reference on the object!
59
+ */
60
+ public func toUnsafe() -> UnsafeMutableRawPointer {
61
+ return Unmanaged.passRetained(self).toOpaque()
62
+ }
63
+
64
+ /**
65
+ * Casts an unsafe pointer to a `HybridLiftoffInterstitialAdSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridLiftoffInterstitialAdSpec_cxx>`.
67
+ * This removes one strong reference from the object!
68
+ */
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLiftoffInterstitialAdSpec_cxx {
70
+ return Unmanaged<HybridLiftoffInterstitialAdSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
+ }
72
+
73
+ /**
74
+ * Gets (or creates) the C++ part of this Hybrid Object.
75
+ * The C++ part is a `std::shared_ptr<HybridLiftoffInterstitialAdSpec>`.
76
+ */
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridLiftoffInterstitialAdSpec_ {
78
+ let cachedCxxPart = self.__cxxPart.lock()
79
+ if cachedCxxPart.__convertToBool() {
80
+ return cachedCxxPart
81
+ } else {
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridLiftoffInterstitialAdSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridLiftoffInterstitialAdSpec_(newCxxPart)
84
+ return newCxxPart
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /**
91
+ * Get the memory size of the Swift class (plus size of any other allocations)
92
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
93
+ */
94
+ @inline(__always)
95
+ public var memorySize: Int {
96
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
+ }
98
+
99
+ /**
100
+ * Call dispose() on the Swift class.
101
+ * This _may_ be called manually from JS.
102
+ */
103
+ @inline(__always)
104
+ public func dispose() {
105
+ self.__implementation.dispose()
106
+ }
107
+
108
+ // Properties
109
+
110
+
111
+ // Methods
112
+ @inline(__always)
113
+ public final func load() -> bridge.Result_void_ {
114
+ do {
115
+ try self.__implementation.load()
116
+ return bridge.create_Result_void_()
117
+ } catch (let __error) {
118
+ let __exceptionPtr = __error.toCpp()
119
+ return bridge.create_Result_void_(__exceptionPtr)
120
+ }
121
+ }
122
+
123
+ @inline(__always)
124
+ public final func show(options: bridge.std__optional_LiftoffAdShowOptions_) -> bridge.Result_std__shared_ptr_Promise_void___ {
125
+ do {
126
+ let __result = try self.__implementation.show(options: { () -> LiftoffAdShowOptions? in
127
+ if bridge.has_value_std__optional_LiftoffAdShowOptions_(options) {
128
+ let __unwrapped = bridge.get_std__optional_LiftoffAdShowOptions_(options)
129
+ return __unwrapped
130
+ } else {
131
+ return nil
132
+ }
133
+ }())
134
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
135
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
136
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
137
+ __result
138
+ .then({ __result in __promiseHolder.resolve() })
139
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
140
+ return __promise
141
+ }()
142
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
143
+ } catch (let __error) {
144
+ let __exceptionPtr = __error.toCpp()
145
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
146
+ }
147
+ }
148
+
149
+ @inline(__always)
150
+ public final func addAdEventListener(eventType: Int32, listener: bridge.Func_void_std__optional_LiftoffAdEventPayload_) -> bridge.Result_double_ {
151
+ do {
152
+ let __result = try self.__implementation.addAdEventListener(eventType: margelo.nitro.liftoffads.LiftoffAdEventType(rawValue: eventType)!, listener: { () -> (LiftoffAdEventPayload?) -> Void in
153
+ let __wrappedFunction = bridge.wrap_Func_void_std__optional_LiftoffAdEventPayload_(listener)
154
+ return { (__payload: LiftoffAdEventPayload?) -> Void in
155
+ __wrappedFunction.call({ () -> bridge.std__optional_LiftoffAdEventPayload_ in
156
+ if let __unwrappedValue = __payload {
157
+ return bridge.create_std__optional_LiftoffAdEventPayload_(__unwrappedValue)
158
+ } else {
159
+ return .init()
160
+ }
161
+ }())
162
+ }
163
+ }())
164
+ let __resultCpp = __result
165
+ return bridge.create_Result_double_(__resultCpp)
166
+ } catch (let __error) {
167
+ let __exceptionPtr = __error.toCpp()
168
+ return bridge.create_Result_double_(__exceptionPtr)
169
+ }
170
+ }
171
+
172
+ @inline(__always)
173
+ public final func removeAdEventListener(subscriptionId: Double) -> bridge.Result_void_ {
174
+ do {
175
+ try self.__implementation.removeAdEventListener(subscriptionId: subscriptionId)
176
+ return bridge.create_Result_void_()
177
+ } catch (let __error) {
178
+ let __exceptionPtr = __error.toCpp()
179
+ return bridge.create_Result_void_(__exceptionPtr)
180
+ }
181
+ }
182
+
183
+ @inline(__always)
184
+ public final func removeAllListeners() -> bridge.Result_void_ {
185
+ do {
186
+ try self.__implementation.removeAllListeners()
187
+ return bridge.create_Result_void_()
188
+ } catch (let __error) {
189
+ let __exceptionPtr = __error.toCpp()
190
+ return bridge.create_Result_void_(__exceptionPtr)
191
+ }
192
+ }
193
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// HybridLiftoffRewardedAdSpec.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 ``HybridLiftoffRewardedAdSpec``
12
+ public protocol HybridLiftoffRewardedAdSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func load() throws -> Void
18
+ func setUserId(userId: String) throws -> Void
19
+ func show(options: LiftoffAdShowOptions?) throws -> Promise<Void>
20
+ func addAdEventListener(eventType: LiftoffAdEventType, listener: @escaping (_ payload: LiftoffAdEventPayload?) -> Void) throws -> Double
21
+ func removeAdEventListener(subscriptionId: Double) throws -> Void
22
+ func removeAllListeners() throws -> Void
23
+ }
24
+
25
+ /// See ``HybridLiftoffRewardedAdSpec``
26
+ open class HybridLiftoffRewardedAdSpec_base {
27
+ private weak var cxxWrapper: HybridLiftoffRewardedAdSpec_cxx? = nil
28
+ public init() { }
29
+ public func getCxxWrapper() -> HybridLiftoffRewardedAdSpec_cxx {
30
+ #if DEBUG
31
+ guard self is HybridLiftoffRewardedAdSpec else {
32
+ fatalError("`self` is not a `HybridLiftoffRewardedAdSpec`! Did you accidentally inherit from `HybridLiftoffRewardedAdSpec_base` instead of `HybridLiftoffRewardedAdSpec`?")
33
+ }
34
+ #endif
35
+ if let cxxWrapper = self.cxxWrapper {
36
+ return cxxWrapper
37
+ } else {
38
+ let cxxWrapper = HybridLiftoffRewardedAdSpec_cxx(self as! HybridLiftoffRewardedAdSpec)
39
+ self.cxxWrapper = cxxWrapper
40
+ return cxxWrapper
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * A Swift base-protocol representing the LiftoffRewardedAd HybridObject.
47
+ * Implement this protocol to create Swift-based instances of LiftoffRewardedAd.
48
+ * ```swift
49
+ * class HybridLiftoffRewardedAd : HybridLiftoffRewardedAdSpec {
50
+ * // ...
51
+ * }
52
+ * ```
53
+ */
54
+ public typealias HybridLiftoffRewardedAdSpec = HybridLiftoffRewardedAdSpec_protocol & HybridLiftoffRewardedAdSpec_base
@@ -0,0 +1,204 @@
1
+ ///
2
+ /// HybridLiftoffRewardedAdSpec_cxx.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
+ /**
12
+ * A class implementation that bridges HybridLiftoffRewardedAdSpec over to C++.
13
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
+ *
15
+ * Also, some Swift types need to be bridged with special handling:
16
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
+ */
20
+ open class HybridLiftoffRewardedAdSpec_cxx {
21
+ /**
22
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::liftoffads::bridge::swift`)
23
+ * from `NitroLiftoffAds-Swift-Cxx-Bridge.hpp`.
24
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
25
+ */
26
+ public typealias bridge = margelo.nitro.liftoffads.bridge.swift
27
+
28
+ /**
29
+ * Holds an instance of the `HybridLiftoffRewardedAdSpec` Swift protocol.
30
+ */
31
+ private var __implementation: any HybridLiftoffRewardedAdSpec
32
+
33
+ /**
34
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
35
+ */
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridLiftoffRewardedAdSpec_
37
+
38
+ /**
39
+ * Create a new `HybridLiftoffRewardedAdSpec_cxx` that wraps the given `HybridLiftoffRewardedAdSpec`.
40
+ * All properties and methods bridge to C++ types.
41
+ */
42
+ public init(_ implementation: any HybridLiftoffRewardedAdSpec) {
43
+ self.__implementation = implementation
44
+ self.__cxxPart = .init()
45
+ /* no base class */
46
+ }
47
+
48
+ /**
49
+ * Get the actual `HybridLiftoffRewardedAdSpec` instance this class wraps.
50
+ */
51
+ @inline(__always)
52
+ public func getHybridLiftoffRewardedAdSpec() -> any HybridLiftoffRewardedAdSpec {
53
+ return __implementation
54
+ }
55
+
56
+ /**
57
+ * Casts this instance to a retained unsafe raw pointer.
58
+ * This acquires one additional strong reference on the object!
59
+ */
60
+ public func toUnsafe() -> UnsafeMutableRawPointer {
61
+ return Unmanaged.passRetained(self).toOpaque()
62
+ }
63
+
64
+ /**
65
+ * Casts an unsafe pointer to a `HybridLiftoffRewardedAdSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridLiftoffRewardedAdSpec_cxx>`.
67
+ * This removes one strong reference from the object!
68
+ */
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLiftoffRewardedAdSpec_cxx {
70
+ return Unmanaged<HybridLiftoffRewardedAdSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
+ }
72
+
73
+ /**
74
+ * Gets (or creates) the C++ part of this Hybrid Object.
75
+ * The C++ part is a `std::shared_ptr<HybridLiftoffRewardedAdSpec>`.
76
+ */
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridLiftoffRewardedAdSpec_ {
78
+ let cachedCxxPart = self.__cxxPart.lock()
79
+ if cachedCxxPart.__convertToBool() {
80
+ return cachedCxxPart
81
+ } else {
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridLiftoffRewardedAdSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridLiftoffRewardedAdSpec_(newCxxPart)
84
+ return newCxxPart
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /**
91
+ * Get the memory size of the Swift class (plus size of any other allocations)
92
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
93
+ */
94
+ @inline(__always)
95
+ public var memorySize: Int {
96
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
+ }
98
+
99
+ /**
100
+ * Call dispose() on the Swift class.
101
+ * This _may_ be called manually from JS.
102
+ */
103
+ @inline(__always)
104
+ public func dispose() {
105
+ self.__implementation.dispose()
106
+ }
107
+
108
+ // Properties
109
+
110
+
111
+ // Methods
112
+ @inline(__always)
113
+ public final func load() -> bridge.Result_void_ {
114
+ do {
115
+ try self.__implementation.load()
116
+ return bridge.create_Result_void_()
117
+ } catch (let __error) {
118
+ let __exceptionPtr = __error.toCpp()
119
+ return bridge.create_Result_void_(__exceptionPtr)
120
+ }
121
+ }
122
+
123
+ @inline(__always)
124
+ public final func setUserId(userId: std.string) -> bridge.Result_void_ {
125
+ do {
126
+ try self.__implementation.setUserId(userId: String(userId))
127
+ return bridge.create_Result_void_()
128
+ } catch (let __error) {
129
+ let __exceptionPtr = __error.toCpp()
130
+ return bridge.create_Result_void_(__exceptionPtr)
131
+ }
132
+ }
133
+
134
+ @inline(__always)
135
+ public final func show(options: bridge.std__optional_LiftoffAdShowOptions_) -> bridge.Result_std__shared_ptr_Promise_void___ {
136
+ do {
137
+ let __result = try self.__implementation.show(options: { () -> LiftoffAdShowOptions? in
138
+ if bridge.has_value_std__optional_LiftoffAdShowOptions_(options) {
139
+ let __unwrapped = bridge.get_std__optional_LiftoffAdShowOptions_(options)
140
+ return __unwrapped
141
+ } else {
142
+ return nil
143
+ }
144
+ }())
145
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
146
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
147
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
148
+ __result
149
+ .then({ __result in __promiseHolder.resolve() })
150
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
151
+ return __promise
152
+ }()
153
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
154
+ } catch (let __error) {
155
+ let __exceptionPtr = __error.toCpp()
156
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
157
+ }
158
+ }
159
+
160
+ @inline(__always)
161
+ public final func addAdEventListener(eventType: Int32, listener: bridge.Func_void_std__optional_LiftoffAdEventPayload_) -> bridge.Result_double_ {
162
+ do {
163
+ let __result = try self.__implementation.addAdEventListener(eventType: margelo.nitro.liftoffads.LiftoffAdEventType(rawValue: eventType)!, listener: { () -> (LiftoffAdEventPayload?) -> Void in
164
+ let __wrappedFunction = bridge.wrap_Func_void_std__optional_LiftoffAdEventPayload_(listener)
165
+ return { (__payload: LiftoffAdEventPayload?) -> Void in
166
+ __wrappedFunction.call({ () -> bridge.std__optional_LiftoffAdEventPayload_ in
167
+ if let __unwrappedValue = __payload {
168
+ return bridge.create_std__optional_LiftoffAdEventPayload_(__unwrappedValue)
169
+ } else {
170
+ return .init()
171
+ }
172
+ }())
173
+ }
174
+ }())
175
+ let __resultCpp = __result
176
+ return bridge.create_Result_double_(__resultCpp)
177
+ } catch (let __error) {
178
+ let __exceptionPtr = __error.toCpp()
179
+ return bridge.create_Result_double_(__exceptionPtr)
180
+ }
181
+ }
182
+
183
+ @inline(__always)
184
+ public final func removeAdEventListener(subscriptionId: Double) -> bridge.Result_void_ {
185
+ do {
186
+ try self.__implementation.removeAdEventListener(subscriptionId: subscriptionId)
187
+ return bridge.create_Result_void_()
188
+ } catch (let __error) {
189
+ let __exceptionPtr = __error.toCpp()
190
+ return bridge.create_Result_void_(__exceptionPtr)
191
+ }
192
+ }
193
+
194
+ @inline(__always)
195
+ public final func removeAllListeners() -> bridge.Result_void_ {
196
+ do {
197
+ try self.__implementation.removeAllListeners()
198
+ return bridge.create_Result_void_()
199
+ } catch (let __error) {
200
+ let __exceptionPtr = __error.toCpp()
201
+ return bridge.create_Result_void_(__exceptionPtr)
202
+ }
203
+ }
204
+ }