nitro-google-mobile-ads-bidmachine 0.0.0-stage → 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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/Package.swift +109 -0
  3. package/README.md +14 -2
  4. package/android/build.gradle +7 -0
  5. package/android/src/main/java/com/margelo/nitro/googlemobileadsbidmachine/HybridBidMachineMediation.kt +10 -0
  6. package/ios/HybridBidMachineMediation.swift +13 -0
  7. package/nitro.json +8 -0
  8. package/nitrogen/generated/.gitattributes +1 -0
  9. package/nitrogen/generated/android/NitroGoogleMobileAdsBidMachine+autolinking.cmake +27 -0
  10. package/nitrogen/generated/android/NitroGoogleMobileAdsBidMachine+autolinking.gradle +10 -0
  11. package/nitrogen/generated/android/NitroGoogleMobileAdsBidMachineOnLoad.cpp +18 -0
  12. package/nitrogen/generated/android/c++/JHybridBidMachineMediationSpec.cpp +70 -0
  13. package/nitrogen/generated/android/c++/include/NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpec.hpp +84 -0
  14. package/nitrogen/generated/android/c++/include/NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpecJavaPart.hpp +26 -0
  15. package/nitrogen/generated/android/include/NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachineOnLoad.hpp +13 -0
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemobileadsbidmachine/HybridBidMachineMediationSpec.kt +81 -0
  17. package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemobileadsbidmachine/NitroGoogleMobileAdsBidMachineOnLoad.kt +22 -0
  18. package/nitrogen/generated/apple/NitroGoogleMobileAdsBidMachine-Swift-Cxx-Bridge.cpp +20 -0
  19. package/nitrogen/generated/apple/NitroGoogleMobileAdsBidMachineAppleCxx/NitroGoogleMobileAdsBidMachineAppleCxx.cpp +9 -0
  20. package/nitrogen/generated/apple/NitroGoogleMobileAdsBidMachineAppleCxx/include/NitroGoogleMobileAdsBidMachineAppleCxx/NitroGoogleMobileAdsBidMachineAppleCxx.h +29 -0
  21. package/nitrogen/generated/apple/NitroGoogleMobileAdsBidMachineAutolinking.cpp +20 -0
  22. package/nitrogen/generated/apple/NitroGoogleMobileAdsBidMachineAutolinking.mm +24 -0
  23. package/nitrogen/generated/apple/c++/HybridBidMachineMediationSpecSwift.cpp +36 -0
  24. package/nitrogen/generated/apple/c++/HybridBidMachineMediationSpec_cxx-Swift.cpp +28 -0
  25. package/nitrogen/generated/apple/c++/include/NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachineAutolinking.hpp +13 -0
  26. package/nitrogen/generated/apple/c++/include/NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpecSwift.hpp +72 -0
  27. package/nitrogen/generated/apple/c++/include/NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpec_cxx-Swift.hpp +23 -0
  28. package/nitrogen/generated/apple/c++/include/NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachine-Swift-Cxx-Umbrella.hpp +33 -0
  29. package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
  30. package/nitrogen/generated/apple/swift/HybridBidMachineMediationSpec.swift +65 -0
  31. package/nitrogen/generated/apple/swift/HybridBidMachineMediationSpec_cxx.swift +138 -0
  32. package/nitrogen/generated/hybrid-classes.json +19 -0
  33. package/nitrogen/generated/shared/c++/NitroGoogleMobileAdsBidMachineCxxModule.cpp +2 -0
  34. package/nitrogen/generated/shared/c++/include/NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachineCxxModule.hpp +2 -0
  35. package/nitrogen/generated/shared/javascript/BidMachineMediation.cjs +19 -0
  36. package/nitrogen/generated/shared/javascript/BidMachineMediation.d.cts +9 -0
  37. package/package.json +42 -4
  38. package/src/BidMachineMediation.nitro.ts +11 -0
  39. package/src/index.ts +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kazutoyo Tokai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Package.swift ADDED
@@ -0,0 +1,109 @@
1
+ // swift-tools-version: 6.4
2
+
3
+ import Foundation
4
+ import PackageDescription
5
+
6
+ let name = "NitroGoogleMobileAdsBidMachine"
7
+ let generated = "nitrogen/generated"
8
+ let nitroDependencies: [Target.Dependency] = [
9
+ .product(name: "NitroModules", package: "nitro-core")
10
+ ]
11
+ let cxxSettings: [CXXSetting] = [
12
+ .define("DEBUG", .when(configuration: .debug)),
13
+ .define("NDEBUG", .when(configuration: .release)),
14
+ .disableWarning("nullability-extension"),
15
+ ]
16
+ let swiftSources = ["ios", "\(generated)/apple/swift"]
17
+ let bridgeSources = ["c++", "NitroGoogleMobileAdsBidMachine-Swift-Cxx-Bridge.cpp", "NitroGoogleMobileAdsBidMachineAutolinking.cpp"]
18
+ // Bare-host integration. Nitrogen generates the bindings; this manifest owns the targets.
19
+ let package = Package(
20
+ name: name,
21
+ platforms: [.iOS(.v16), .macOS(.v13)],
22
+ products: [
23
+ .library(name: name, targets: ["\(name)Cxx", name, "\(name)SwiftBridge"])
24
+ ],
25
+ dependencies: [
26
+ .package(path: "../nitro-core"),
27
+ .package(url: "https://github.com/googleads/googleads-mobile-ios-mediation-bidmachine.git", exact: "3.8.200"),
28
+ .package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", "13.0.0"..<"14.0.0"),
29
+ ],
30
+ targets: [
31
+ .target(
32
+ name: "\(name)Cxx",
33
+ dependencies: nitroDependencies,
34
+ path: "\(generated)/shared/c++",
35
+ exclude: ["include"],
36
+ publicHeadersPath: "include",
37
+ cxxSettings: cxxSettings
38
+ ),
39
+ .target(
40
+ name: "\(name)AppleCxx",
41
+ dependencies: [.target(name: "\(name)Cxx")] + nitroDependencies,
42
+ path: "\(generated)/apple/\(name)AppleCxx",
43
+ cxxSettings: cxxSettings
44
+ ),
45
+ .target(
46
+ name: name,
47
+ dependencies: [
48
+ .target(name: "\(name)AppleCxx"),
49
+ .product(name: "BidMachineAdapterTarget", package: "googleads-mobile-ios-mediation-bidmachine"),
50
+ .product(name: "GoogleMobileAds", package: "swift-package-manager-google-mobile-ads"),
51
+ ] + nitroDependencies,
52
+ path: ".",
53
+ exclude: excludes(in: ".", keeping: swiftSources),
54
+ sources: swiftSources,
55
+ cxxSettings: cxxSettings,
56
+ swiftSettings: [
57
+ // UIKit implementations run synchronously on the host's main thread.
58
+ .swiftLanguageMode(.v5),
59
+ .unsafeFlags(["-strict-concurrency=minimal"]),
60
+ .enableUpcomingFeature("InternalImportsByDefault"),
61
+ // TODO: Nitrogen's Swift for a spec with only static members uses `margelo.nitro`
62
+ // without importing NitroModulesAppleCxx, which this feature rejects. Re-enable once fixed.
63
+ .interoperabilityMode(.Cxx),
64
+ .unsafeFlags(["-Xfrontend", "-clang-header-expose-decls=has-expose-attr-or-stdlib"]),
65
+ .unsafeFlags([
66
+ "-Xfrontend", "-clang-header-expose-module",
67
+ "-Xfrontend", "NitroModules=NitroModules-Swift.h",
68
+ ]),
69
+ ],
70
+ // The adapter is a static archive, and GMA finds its class by name at runtime. Nothing
71
+ // references the class, so -ObjC keeps the linker from stripping it.
72
+ linkerSettings: [.unsafeFlags(["-ObjC"])]
73
+ ),
74
+ .target(
75
+ name: "\(name)SwiftBridge",
76
+ dependencies: [.target(name: name), .target(name: "\(name)AppleCxx")] + nitroDependencies,
77
+ path: "\(generated)/apple",
78
+ exclude: excludes(in: "\(generated)/apple", keeping: bridgeSources) + ["c++/include"],
79
+ sources: bridgeSources,
80
+ publicHeadersPath: "c++/include",
81
+ cxxSettings: cxxSettings + [
82
+ .unsafeFlags(["-I${GENERATED_MODULEMAP_DIR}", "-fno-modules"])
83
+ ]
84
+ ),
85
+ ],
86
+ cxxLanguageStandard: .cxx20
87
+ )
88
+
89
+ func excludes(in path: String, keeping sources: [String]) -> [String] {
90
+ var parents: Set<String> = [""]
91
+ for source in sources {
92
+ var components = source.split(separator: "/").dropLast()
93
+ while !components.isEmpty {
94
+ parents.insert(components.joined(separator: "/"))
95
+ components = components.dropLast()
96
+ }
97
+ }
98
+ let root = URL(fileURLWithPath: Context.packageDirectory).appendingPathComponent(path)
99
+ return parents.sorted().flatMap { parent in
100
+ let entries =
101
+ (try? FileManager.default.contentsOfDirectory(
102
+ atPath: root.appendingPathComponent(parent).path)) ?? []
103
+ return entries.sorted().compactMap { entry in
104
+ let entryPath = parent.isEmpty ? entry : "\(parent)/\(entry)"
105
+ return entry.hasPrefix(".") || sources.contains(entryPath) || parents.contains(entryPath)
106
+ ? nil : entryPath
107
+ }
108
+ }
109
+ }
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # nitro-google-mobile-ads-bidmachine
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Optional BidMachine mediation for [nitro-google-mobile-ads](https://github.com/kazutoyo/nitro-google-mobile-ads).
4
+
5
+ ```sh
6
+ bun add nitro-google-mobile-ads-bidmachine
7
+ ```
8
+
9
+ Follow the [mediation guide](https://github.com/kazutoyo/nitro-google-mobile-ads/blob/main/packages/nitro-google-mobile-ads/MEDIATION.md) for native setup and AdMob configuration.
10
+
11
+ ```ts
12
+ import { BidMachineMediation } from 'nitro-google-mobile-ads-bidmachine'
13
+
14
+ console.log(BidMachineMediation.adapterVersion)
15
+ ```
@@ -0,0 +1,7 @@
1
+ dependencies {
2
+ implementation("com.google.ads.mediation:bidmachine:3.8.0.1") {
3
+ // The Next-Gen SDK (from nitro-google-mobile-ads) contains the classes adapters need.
4
+ exclude group: "com.google.android.gms", module: "play-services-ads"
5
+ exclude group: "com.google.android.gms", module: "play-services-ads-lite"
6
+ }
7
+ }
@@ -0,0 +1,10 @@
1
+ package com.margelo.nitro.googlemobileadsbidmachine
2
+
3
+ import com.google.ads.mediation.bidmachine.BidMachineMediationAdapter
4
+
5
+ class HybridBidMachineMediation : HybridBidMachineMediationSpec() {
6
+ companion object : HybridBidMachineMediationSpec.Companion {
7
+ override val adapterVersion: String?
8
+ get() = BidMachineMediationAdapter().getVersionInfo().let { "${it.majorVersion}.${it.minorVersion}.${it.microVersion}" }
9
+ }
10
+ }
@@ -0,0 +1,13 @@
1
+ internal import Foundation
2
+ internal import GoogleMobileAds
3
+
4
+ final class HybridBidMachineMediation: HybridBidMachineMediationSpec {
5
+ static var adapterVersion: String? {
6
+ // The adapter's headers only forward-declare its class, so look it up the way GMA does.
7
+ guard let adapter = NSClassFromString("GADMediationAdapterBidMachine") as? any MediationAdapter.Type else {
8
+ return nil
9
+ }
10
+ let v = adapter.adapterVersion()
11
+ return "\(v.majorVersion).\(v.minorVersion).\(v.patchVersion)"
12
+ }
13
+ }
package/nitro.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://nitro.margelo.com/nitro.schema.json",
3
+ "environment": "bare",
4
+ "cxxNamespace": ["googlemobileadsbidmachine"],
5
+ "apple": { "moduleName": "NitroGoogleMobileAdsBidMachine" },
6
+ "android": { "namespace": ["googlemobileadsbidmachine"], "cxxLibName": "NitroGoogleMobileAdsBidMachine" },
7
+ "ignorePaths": ["**/node_modules", "**/.build", "**/.swiftpm"]
8
+ }
@@ -0,0 +1 @@
1
+ ** linguist-generated=true
@@ -0,0 +1,27 @@
1
+ #
2
+ # NitroGoogleMobileAdsBidMachine+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/margelo/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
+ #
7
+
8
+ target_compile_features(NitroGoogleMobileAdsBidMachine PUBLIC cxx_std_20)
9
+ target_include_directories(NitroGoogleMobileAdsBidMachine PRIVATE
10
+ "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/include"
11
+ "${CMAKE_CURRENT_LIST_DIR}/c++/include"
12
+ "${CMAKE_CURRENT_LIST_DIR}/include"
13
+ )
14
+ target_sources(NitroGoogleMobileAdsBidMachine PRIVATE
15
+ "${CMAKE_CURRENT_LIST_DIR}/NitroGoogleMobileAdsBidMachineOnLoad.cpp"
16
+ "${CMAKE_CURRENT_LIST_DIR}/../android/c++/JHybridBidMachineMediationSpec.cpp"
17
+ "${CMAKE_CURRENT_LIST_DIR}/../shared/c++/NitroGoogleMobileAdsBidMachineCxxModule.cpp"
18
+ )
19
+
20
+ find_package(fbjni REQUIRED CONFIG)
21
+ find_package(nitro-core REQUIRED CONFIG)
22
+
23
+ target_link_libraries(NitroGoogleMobileAdsBidMachine
24
+ fbjni::fbjni
25
+ nitro-core::NitroModules
26
+
27
+ )
@@ -0,0 +1,10 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachine+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ // Resolve beside this script so custom Nitrogen output directories work too.
9
+ def nitrogenDirectory = buildscript.sourceFile.parentFile
10
+ android.sourceSets.main.java.srcDirs += [new File(nitrogenDirectory, 'kotlin')]
@@ -0,0 +1,18 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachineOnLoad.hpp>
9
+ #include <NitroModules/HybridClassRegistry.hpp>
10
+ #include <NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpec.hpp>
11
+
12
+ namespace margelo::nitro::googlemobileadsbidmachine {
13
+ void registerAllNatives() {
14
+ margelo::nitro::googlemobileadsbidmachine::JHybridBidMachineMediationSpec::CxxPart::registerNatives();
15
+
16
+ HybridClassRegistry::registerHybridClass("googlemobileadsbidmachine.BidMachineMediation", JHybridBidMachineMediationSpec::Class::get());
17
+ }
18
+ }
@@ -0,0 +1,70 @@
1
+ ///
2
+ /// JHybridBidMachineMediationSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpec.hpp>
9
+ #include <NitroModules/JNIConverter+String.hpp>
10
+ #include <NitroModules/JSIConverter+JString.hpp>
11
+ #include <NitroModules/JNIConverter+Optional.hpp>
12
+ #include <NitroModules/JSIConverter+JOptional.hpp>
13
+
14
+ namespace margelo::nitro::googlemobileadsbidmachine {
15
+
16
+ JHybridBidMachineMediationSpec::~JHybridBidMachineMediationSpec() = default;
17
+
18
+ jni::local_ref<JOptional<jni::JString>> JHybridBidMachineMediationSpec::getAdapterVersion() {
19
+ static const auto __method = JHybridBidMachineMediationSpec::JavaPart::javaClassStatic()->getStaticMethod<jni::local_ref<JOptional<jni::JString>>()>("getAdapterVersion_cxx");
20
+ auto __result = __method(JHybridBidMachineMediationSpec::JavaPart::javaClassStatic());
21
+ return __result;
22
+ }
23
+
24
+ const std::shared_ptr<const HybridClass>& JHybridBidMachineMediationSpec::Class::get() {
25
+ static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
26
+ clazz.registerStaticHybridProperty("adapterVersion", &JHybridBidMachineMediationSpec::getAdapterVersion);
27
+ });
28
+ return hybridClass;
29
+ }
30
+
31
+ std::shared_ptr<JHybridBidMachineMediationSpec> JHybridBidMachineMediationSpecJavaPart::getJHybridBidMachineMediationSpec() {
32
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
33
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridBidMachineMediationSpec>(hybridObject);
34
+ if (castHybridObject == nullptr) [[unlikely]] {
35
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridBidMachineMediationSpec!");
36
+ }
37
+ return castHybridObject;
38
+ }
39
+
40
+ jni::local_ref<JHybridBidMachineMediationSpec::CxxPart::jhybriddata> JHybridBidMachineMediationSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
41
+ return makeCxxInstance(jThis);
42
+ }
43
+
44
+ jni::alias_ref<jni::JClass> JHybridBidMachineMediationSpec::CxxPart::getClass() {
45
+ static const auto __field = CxxPart::javaClassStatic()->getStaticField<jni::JClass>("implementationClass_cxx");
46
+ static const auto __class = jni::make_global(CxxPart::javaClassStatic()->getStaticFieldValue(__field));
47
+ return __class;
48
+ }
49
+
50
+ std::shared_ptr<JHybridObject> JHybridBidMachineMediationSpec::CxxPart::createHybridObject(jni::alias_ref<JHybridObject::JavaPart> javaPart) {
51
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridBidMachineMediationSpec::JavaPart>(javaPart);
52
+ if (castJavaPart == nullptr) [[unlikely]] {
53
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridBidMachineMediationSpec::JavaPart!");
54
+ }
55
+ return std::make_shared<JHybridBidMachineMediationSpec>(castJavaPart);
56
+ }
57
+
58
+ void JHybridBidMachineMediationSpec::CxxPart::registerNatives() {
59
+ registerHybrid({
60
+ makeNativeMethod("initHybrid", JHybridBidMachineMediationSpec::CxxPart::initHybrid),
61
+ });
62
+ }
63
+
64
+ // Properties
65
+
66
+
67
+ // Methods
68
+
69
+
70
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,84 @@
1
+ ///
2
+ /// JHybridBidMachineMediationSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <NitroModules/HybridClass.hpp>
12
+ #include <fbjni/fbjni.h>
13
+ #include <stdexcept>
14
+ #include <NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpecJavaPart.hpp>
15
+ #include <NitroModules/JNIConverter+String.hpp>
16
+ #include <NitroModules/JSIConverter+JString.hpp>
17
+ #include <NitroModules/JNIConverter+Optional.hpp>
18
+ #include <NitroModules/JSIConverter+JOptional.hpp>
19
+ #include <NitroGoogleMobileAdsBidMachine/private/JHybridBidMachineMediationSpec.hpp>
20
+
21
+ namespace margelo::nitro::googlemobileadsbidmachine {
22
+
23
+ namespace jni = facebook::jni;
24
+
25
+ class JHybridBidMachineMediationSpec final : public JHybridObject {
26
+ public:
27
+ struct Class {
28
+ using Base = JHybridObject::Class;
29
+ static constexpr const char* name = "BidMachineMediation";
30
+ static const std::shared_ptr<const HybridClass>& get();
31
+ };
32
+
33
+ public:
34
+ using JavaPart = JHybridBidMachineMediationSpecJavaPart;
35
+ struct CxxPart : public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
36
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/googlemobileadsbidmachine/HybridBidMachineMediationSpec$CxxPart;";
37
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
38
+ static void registerNatives();
39
+ static jni::alias_ref<jni::JClass> getClass();
40
+ using HybridBase::HybridBase;
41
+ protected:
42
+ std::shared_ptr<JHybridObject> createHybridObject(jni::alias_ref<JHybridObject::JavaPart> javaPart) override;
43
+ };
44
+
45
+ public:
46
+ explicit JHybridBidMachineMediationSpec(jni::alias_ref<JHybridBidMachineMediationSpec::JavaPart> javaPart):
47
+ JHybridObject(javaPart),
48
+ _javaPart(jni::static_ref_cast<JavaPart>(JHybridObject::getJavaPart())) {
49
+ #ifdef NITRO_DEBUG
50
+ if (!jni::isSameObject(_javaPart->getClass(), CxxPart::getClass())) [[unlikely]] {
51
+ throw std::runtime_error("BidMachineMediation requires its configured implementation when inheritance and multiple implementations are disabled.");
52
+ }
53
+ #endif
54
+ }
55
+ // Defined in the owning library so RTTI has one identity across modules.
56
+ ~JHybridBidMachineMediationSpec() override;
57
+
58
+ public:
59
+ inline jni::alias_ref<JHybridBidMachineMediationSpec::JavaPart> getJavaPart() const noexcept {
60
+ return _javaPart;
61
+ }
62
+
63
+ public:
64
+ // Properties
65
+
66
+
67
+ public:
68
+ // Methods
69
+
70
+
71
+ public:
72
+ // Constructor and static members
73
+ static jni::local_ref<JOptional<jni::JString>> getAdapterVersion();
74
+
75
+ protected:
76
+ const std::shared_ptr<const HybridClass>& getHybridClass() override {
77
+ return Class::get();
78
+ }
79
+
80
+ private:
81
+ jni::alias_ref<JHybridBidMachineMediationSpec::JavaPart> _javaPart;
82
+ };
83
+
84
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// JHybridBidMachineMediationSpecJavaPart.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include <memory>
13
+
14
+ namespace margelo::nitro::googlemobileadsbidmachine {
15
+
16
+ namespace jni = facebook::jni;
17
+
18
+ class JHybridBidMachineMediationSpec;
19
+
20
+ struct JHybridBidMachineMediationSpecJavaPart : public jni::JavaClass<JHybridBidMachineMediationSpecJavaPart, JHybridObject::JavaPart> {
21
+ using HybridType = JHybridBidMachineMediationSpec;
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/googlemobileadsbidmachine/HybridBidMachineMediationSpec;";
23
+ std::shared_ptr<JHybridBidMachineMediationSpec> getJHybridBidMachineMediationSpec();
24
+ };
25
+
26
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,13 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineOnLoad.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ namespace margelo::nitro::googlemobileadsbidmachine {
11
+ // Call inside facebook::jni::initialize() from JNI_OnLoad.
12
+ void registerAllNatives();
13
+ }
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.googlemobileadsbidmachine
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.googlemobileadsbidmachine.HybridBidMachineMediation
15
+ import com.margelo.nitro.core.HybridObject
16
+
17
+ /**
18
+ * A Kotlin class representing the BidMachineMediation HybridObject.
19
+ * Implement this abstract class to create Kotlin-based instances of BidMachineMediation.
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress(
24
+ "KotlinJniMissingFunction", "unused",
25
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
26
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
27
+ )
28
+ abstract class HybridBidMachineMediationSpec: HybridObject() {
29
+ // Properties
30
+
31
+
32
+ // Methods
33
+
34
+
35
+ // Default implementation of `HybridObject.toString()`
36
+ override fun toString(): String {
37
+ return "[HybridObject BidMachineMediation]"
38
+ }
39
+
40
+ // C++ backing class
41
+ @DoNotStrip
42
+ @Keep
43
+ protected open class CxxPart(javaPart: HybridBidMachineMediationSpec): HybridObject.CxxPart(javaPart) {
44
+ // C++ JHybridBidMachineMediationSpec::CxxPart::initHybrid(...)
45
+ @FastNative
46
+ external override fun initHybrid(): HybridData
47
+
48
+ companion object {
49
+ @DoNotStrip
50
+ @Keep
51
+ @JvmField
52
+ val implementationClass_cxx: Class<out HybridBidMachineMediationSpec> = HybridBidMachineMediation::class.java
53
+ }
54
+ }
55
+ override fun createCxxPart(): CxxPart {
56
+ return CxxPart(this)
57
+ }
58
+
59
+ interface Companion {
60
+ // Static Properties
61
+ val adapterVersion: String?
62
+
63
+ // Static Methods
64
+
65
+ }
66
+
67
+ protected companion object Bridge {
68
+ protected const val TAG = "HybridBidMachineMediationSpec"
69
+
70
+ private val implementationCompanion: Companion
71
+ get() = HybridBidMachineMediation
72
+
73
+ // Static properties
74
+ @JvmStatic
75
+ @DoNotStrip
76
+ @Keep
77
+ private fun getAdapterVersion_cxx(): String? {
78
+ return HybridBidMachineMediation.adapterVersion
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.googlemobileadsbidmachine
9
+
10
+ internal class NitroGoogleMobileAdsBidMachineOnLoad {
11
+ companion object {
12
+ private var didLoad = false
13
+
14
+ @JvmStatic
15
+ @Synchronized
16
+ fun initializeNative() {
17
+ if (didLoad) return
18
+ System.loadLibrary("NitroGoogleMobileAdsBidMachine")
19
+ didLoad = true
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachine-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+ #include <NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachine-Swift-Cxx-Umbrella.hpp>
8
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpecSwift.hpp>
9
+
10
+ namespace margelo::nitro::googlemobileadsbidmachine::swift_bridge {
11
+ std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ create_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(void* NON_NULL pointer) {
12
+ return std::make_shared<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>(::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx::fromUnsafe(pointer));
13
+ }
14
+
15
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(const std::shared_ptr<HybridObject>& value) {
16
+ auto wrapper = std::dynamic_pointer_cast<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>(value);
17
+ if (!wrapper) throw std::runtime_error("HybridBidMachineMediationSpec is not implemented in Swift");
18
+ return wrapper->getSwiftPart().toUnsafe();
19
+ }
20
+ } // namespace margelo::nitro::googlemobileadsbidmachine::swift_bridge
@@ -0,0 +1,9 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineAppleCxx.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ // Swift packages require at least one source file per C++ target.
9
+ #include <NitroGoogleMobileAdsBidMachineAppleCxx/NitroGoogleMobileAdsBidMachineAppleCxx.h>
@@ -0,0 +1,29 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineAppleCxx.h
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declaration of `HybridBidMachineMediationSpec_cxx` to properly resolve imports.
11
+ namespace NitroGoogleMobileAdsBidMachine { class HybridBidMachineMediationSpec_cxx; }
12
+ namespace swift { class String; }
13
+ #ifndef SWIFT_SWIFT_H
14
+ namespace swift { template <class T> class Optional; }
15
+ #endif
16
+ #include <NitroModules/HybridObject.hpp>
17
+ // Forward declaration of `HybridBidMachineMediationSpecSwift` to properly resolve imports.
18
+ namespace margelo::nitro::googlemobileadsbidmachine { class HybridBidMachineMediationSpecSwift; }
19
+ #include <NitroModules/NitroDefines.hpp>
20
+
21
+ namespace margelo::nitro::googlemobileadsbidmachine::swift_bridge {
22
+ using std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ = std::shared_ptr<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>;
23
+ using std__weak_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ = std::weak_ptr<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>;
24
+ inline std__weak_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ weakify_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(const std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_& value) {
25
+ return value;
26
+ }
27
+ std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ create_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(void* NON_NULL pointer);
28
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(const std::shared_ptr<HybridObject>& value);
29
+ } // namespace margelo::nitro::googlemobileadsbidmachine::swift_bridge
@@ -0,0 +1,20 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineAutolinking.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachineAutolinking.hpp>
9
+ #include <NitroModules/HybridClassRegistry.hpp>
10
+
11
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpecSwift.hpp>
12
+
13
+ namespace margelo::nitro::googlemobileadsbidmachine {
14
+ void registerHybridClasses() {
15
+ using namespace margelo::nitro;
16
+ using namespace margelo::nitro::googlemobileadsbidmachine;
17
+
18
+ HybridClassRegistry::registerHybridClass("googlemobileadsbidmachine.BidMachineMediation", HybridBidMachineMediationSpecSwift::Class::get());
19
+ }
20
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #include <NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachineAutolinking.hpp>
10
+
11
+ /**
12
+ * Registers all HybridObject classes of NitroGoogleMobileAdsBidMachine
13
+ * when the app loads, so JS can look them up by name.
14
+ */
15
+ @interface NitroGoogleMobileAdsBidMachineAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation NitroGoogleMobileAdsBidMachineAutolinking
19
+
20
+ + (void)load {
21
+ margelo::nitro::googlemobileadsbidmachine::registerHybridClasses();
22
+ }
23
+
24
+ @end
@@ -0,0 +1,36 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpecSwift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpecSwift.hpp>
9
+ #include <NitroModules/SwiftConverter.hpp>
10
+ #include <NitroModules/SwiftResult.hpp>
11
+ #include <optional>
12
+
13
+ namespace margelo::nitro::googlemobileadsbidmachine {
14
+
15
+ std::string HybridBidMachineMediationSpecSwift::toString() {
16
+ return SwiftConverter<std::string, swift::String>::fromSwift(_swiftPart.toString());
17
+ }
18
+
19
+ // Properties
20
+
21
+ // Methods
22
+
23
+ // Static properties
24
+
25
+ swift::Optional<swift::String> HybridBidMachineMediationSpecSwift::getAdapterVersion() {
26
+ return ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx::getAdapterVersion_NitroGoogleMobileAdsBidMachine_BidMachineMediation();
27
+ }
28
+
29
+ const std::shared_ptr<const HybridClass>& HybridBidMachineMediationSpecSwift::Class::get() {
30
+ static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
31
+ clazz.registerStaticHybridProperty("adapterVersion", &HybridBidMachineMediationSpecSwift::getAdapterVersion);
32
+ });
33
+ return hybridClass;
34
+ }
35
+
36
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,28 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpec_cxx-Swift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpec_cxx-Swift.hpp>
9
+ #include <NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachine-Swift-Cxx-Umbrella.hpp>
10
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpecSwift.hpp>
11
+
12
+ namespace margelo::nitro {
13
+
14
+ ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx JSIConverter<::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
15
+ auto hybridSpec = JSIConverter<std::shared_ptr<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>>::fromJSI(runtime, value);
16
+ return ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx::fromUnsafe(margelo::nitro::googlemobileadsbidmachine::swift_bridge::get_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(hybridSpec));
17
+ }
18
+
19
+ jsi::Value JSIConverter<::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx>::toJSI(jsi::Runtime& runtime, const ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx& value) {
20
+ auto hybridSpec = ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx::getCxxPart(value);
21
+ return JSIConverter<std::shared_ptr<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>>::toJSI(runtime, hybridSpec);
22
+ }
23
+
24
+ bool JSIConverter<::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
25
+ return JSIConverter<std::shared_ptr<margelo::nitro::googlemobileadsbidmachine::HybridBidMachineMediationSpecSwift>>::canConvert(runtime, value);
26
+ }
27
+
28
+ } // namespace margelo::nitro
@@ -0,0 +1,13 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachineAutolinking.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ namespace margelo::nitro::googlemobileadsbidmachine {
11
+ // Register all generated HybridObject classes
12
+ void registerHybridClasses();
13
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,72 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpecSwift.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/HybridObject.hpp>
11
+ #include <NitroModules/HybridClass.hpp>
12
+
13
+
14
+ // This implementation header is consumed only by C++ translation units.
15
+ #include <NitroGoogleMobileAdsBidMachine/private/NitroGoogleMobileAdsBidMachine-Swift-Cxx-Umbrella.hpp>
16
+
17
+ namespace margelo::nitro::googlemobileadsbidmachine {
18
+
19
+ /**
20
+ * The C++ part of HybridBidMachineMediationSpec_cxx.swift.
21
+ *
22
+ * HybridBidMachineMediationSpecSwift accesses the concrete Swift wrapper and registers
23
+ * its Swift signatures for JS. C++ callers use a separate adapter when needed.
24
+ */
25
+ class HybridBidMachineMediationSpecSwift final : public HybridObject {
26
+ public:
27
+ struct Class {
28
+ using Base = HybridObject::Class;
29
+ static constexpr const char* name = "BidMachineMediation";
30
+ static const std::shared_ptr<const HybridClass>& get();
31
+ };
32
+
33
+ public:
34
+ // Constructor from a Swift instance
35
+ explicit HybridBidMachineMediationSpecSwift(const ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx& swiftPart):
36
+ HybridObject(),
37
+ _swiftPart(swiftPart) { }
38
+
39
+ public:
40
+ // Get the Swift part
41
+ ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx& getSwiftPart() noexcept {
42
+ return _swiftPart;
43
+ }
44
+
45
+ // HybridObject overrides
46
+ size_t getExternalMemorySize() noexcept override {
47
+ return _swiftPart.getMemorySize();
48
+ }
49
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
50
+ auto value = std::dynamic_pointer_cast<HybridBidMachineMediationSpecSwift>(other);
51
+ return value && _swiftPart.equals(value->_swiftPart);
52
+ }
53
+ void dispose() override {
54
+ _swiftPart.dispose();
55
+ }
56
+ std::string toString() override;
57
+
58
+ // Properties
59
+ // Methods
60
+ // Static properties
61
+ static swift::Optional<swift::String> getAdapterVersion();
62
+
63
+ protected:
64
+ const std::shared_ptr<const HybridClass>& getHybridClass() override {
65
+ return Class::get();
66
+ }
67
+
68
+ private:
69
+ ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx _swiftPart;
70
+ };
71
+
72
+ } // namespace margelo::nitro::googlemobileadsbidmachine
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpec_cxx-Swift.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JSIConverter.hpp>
11
+ // Forward declaration of `HybridBidMachineMediationSpec_cxx` to properly resolve imports.
12
+ namespace NitroGoogleMobileAdsBidMachine { class HybridBidMachineMediationSpec_cxx; }
13
+
14
+ namespace margelo::nitro {
15
+
16
+ template <>
17
+ struct JSIConverter<::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx> {
18
+ static ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
19
+ static jsi::Value toJSI(jsi::Runtime& runtime, const ::NitroGoogleMobileAdsBidMachine::HybridBidMachineMediationSpec_cxx& value);
20
+ static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
21
+ };
22
+
23
+ } // namespace margelo::nitro
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// NitroGoogleMobileAdsBidMachine-Swift-Cxx-Umbrella.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Private C++ implementation includes. Never import this umbrella from Swift.
11
+ // Include Swift defined types. They define swift::Optional and swift::Array,
12
+ // which the C++ helpers below only forward-declare for Swift's importer.
13
+ #include <NitroModules/NitroModules-Swift-Cxx-Umbrella.hpp>
14
+
15
+ // C++ helpers for Swift
16
+ #include <NitroGoogleMobileAdsBidMachineAppleCxx/NitroGoogleMobileAdsBidMachineAppleCxx.h>
17
+
18
+ #if __has_include("NitroGoogleMobileAdsBidMachine-Swift.h")
19
+ // This header is generated by Xcode/Swift on every app build.
20
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroGoogleMobileAdsBidMachine".
21
+ #include "NitroGoogleMobileAdsBidMachine-Swift.h"
22
+ // Same as above, but used when building with frameworks (`use_frameworks`)
23
+ #elif __has_include(<NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachine-Swift.h>)
24
+ #include <NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachine-Swift.h>
25
+ #else
26
+ #error NitroGoogleMobileAdsBidMachine's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroGoogleMobileAdsBidMachine", and try building the app first.
27
+ #endif
28
+
29
+
30
+ #include <NitroGoogleMobileAdsBidMachine/private/HybridBidMachineMediationSpec_cxx-Swift.hpp>
31
+ #include <NitroModules/NitroModules-Swift-Cxx-Umbrella.hpp>
32
+ #include <NitroModules/JSIConverter+SwiftString.hpp>
33
+ #include <NitroModules/JSIConverter+SwiftOptional.hpp>
@@ -0,0 +1,12 @@
1
+ ///
2
+ /// module.modulemap
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ // Headers used by Swift belong to the AppleCxx module.
9
+ // This implementation target must not claim them through an umbrella directory.
10
+ module NitroGoogleMobileAdsBidMachineSwiftBridge {
11
+ requires cplusplus
12
+ }
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ public import NitroModules
9
+
10
+ /// See ``HybridBidMachineMediationSpec``
11
+ public protocol HybridBidMachineMediationSpec_protocol: HybridBidMachineMediationSpec_base, HybridObject {
12
+ // Constructor
13
+
14
+
15
+ // Properties
16
+
17
+
18
+ // Methods
19
+
20
+
21
+ // Static Properties
22
+ static var adapterVersion: String? { get }
23
+
24
+ // Static Methods
25
+
26
+ }
27
+
28
+ public extension HybridBidMachineMediationSpec_protocol {
29
+ /// Default implementation of ``HybridObject.toString``
30
+ func toString() -> String {
31
+ return "[HybridObject BidMachineMediation]"
32
+ }
33
+ }
34
+
35
+ /// See ``HybridBidMachineMediationSpec``
36
+ open class HybridBidMachineMediationSpec_base {
37
+ private weak var cxxWrapper: HybridBidMachineMediationSpec_cxx? = nil
38
+ public init() throws {
39
+ }
40
+ public final func getCxxWrapper() -> HybridBidMachineMediationSpec_cxx {
41
+ #if DEBUG
42
+ guard self is any HybridBidMachineMediationSpec else {
43
+ fatalError("`self` is not a `HybridBidMachineMediationSpec`! Did you accidentally inherit from `HybridBidMachineMediationSpec_base` instead of `HybridBidMachineMediationSpec`?")
44
+ }
45
+ #endif
46
+ if let cxxWrapper = self.cxxWrapper {
47
+ return cxxWrapper
48
+ } else {
49
+ let cxxWrapper = HybridBidMachineMediationSpec_cxx(self as! any HybridBidMachineMediationSpec)
50
+ self.cxxWrapper = cxxWrapper
51
+ return cxxWrapper
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * A Swift base-protocol representing the BidMachineMediation HybridObject.
58
+ * Implement this protocol to create Swift-based instances of BidMachineMediation.
59
+ * ```swift
60
+ * class HybridBidMachineMediation : HybridBidMachineMediationSpec {
61
+ * // ...
62
+ * }
63
+ * ```
64
+ */
65
+ public typealias HybridBidMachineMediationSpec = HybridBidMachineMediationSpec_protocol & HybridBidMachineMediationSpec_base
@@ -0,0 +1,138 @@
1
+ ///
2
+ /// HybridBidMachineMediationSpec_cxx.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+ internal import NitroModules
8
+ internal import CxxStdlib
9
+ internal import NitroGoogleMobileAdsBidMachineAppleCxx
10
+
11
+ /**
12
+ * A class implementation that bridges HybridBidMachineMediationSpec 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
+ @_expose(Cxx)
16
+ public final class HybridBidMachineMediationSpec_cxx {
17
+ /**
18
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::googlemobileadsbidmachine::swift_bridge`)
19
+ * from `NitroGoogleMobileAdsBidMachineAppleCxx/NitroGoogleMobileAdsBidMachineAppleCxx.h`.
20
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
21
+ */
22
+ public typealias bridge = margelo.nitro.googlemobileadsbidmachine.swift_bridge
23
+
24
+ /**
25
+ * Holds the Swift implementation of `HybridBidMachineMediationSpec`.
26
+ */
27
+ private let __implementation: HybridBidMachineMediation
28
+
29
+ /**
30
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
31
+ */
32
+ private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ = .init()
33
+
34
+ /**
35
+ * Create a new `HybridBidMachineMediationSpec_cxx` that wraps the given `HybridBidMachineMediationSpec`.
36
+ */
37
+ public init(_ implementation: any HybridBidMachineMediationSpec) {
38
+ guard let implementation = implementation as? HybridBidMachineMediation else {
39
+ preconditionFailure("BidMachineMediation selects HybridBidMachineMediation as its Swift implementation. Every instance must inherit HybridBidMachineMediation.")
40
+ }
41
+ self.__implementation = implementation
42
+
43
+ }
44
+
45
+ /**
46
+ * Get the actual `HybridBidMachineMediationSpec` instance this class wraps.
47
+ */
48
+ @inline(__always)
49
+ public func getHybridBidMachineMediationSpec() -> any HybridBidMachineMediationSpec {
50
+ return __implementation
51
+ }
52
+
53
+ /**
54
+ * Casts this instance to a retained unsafe raw pointer.
55
+ * This acquires one additional strong reference on the object!
56
+ */
57
+ public func toUnsafe() -> UnsafeMutableRawPointer {
58
+ return Unmanaged.passRetained(self).toOpaque()
59
+ }
60
+
61
+ /**
62
+ * Casts an unsafe pointer to a `HybridBidMachineMediationSpec_cxx`.
63
+ * The pointer has to be a retained opaque `Unmanaged<HybridBidMachineMediationSpec_cxx>`.
64
+ * This removes one strong reference from the object!
65
+ */
66
+ public class func fromUnsafe(pointer: UnsafeMutableRawPointer) -> HybridBidMachineMediationSpec_cxx {
67
+ return Unmanaged<HybridBidMachineMediationSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
68
+ }
69
+
70
+ /**
71
+ * Gets (or creates) the C++ part of this Hybrid Object.
72
+ * This handle keeps the original native object alive.
73
+ */
74
+ public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ {
75
+ let cached = __cxxPart.lock()
76
+ if cached.use_count() > 0 {
77
+ return cached
78
+ }
79
+ let value = bridge.create_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(self.toUnsafe())
80
+ __cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_(value)
81
+ return value
82
+ }
83
+
84
+
85
+
86
+ // A static borrowing accessor lets C++ pass a const reference without copying it.
87
+ // TODO: Remove this adapter and call the instance method directly once
88
+ // https://github.com/swiftlang/swift/pull/92862 is merged and supported by our Swift toolchain.
89
+ @_spi(NitroCxx)
90
+ public static func getCxxPart(_ value: borrowing HybridBidMachineMediationSpec_cxx) -> bridge.std__shared_ptr_margelo__nitro__googlemobileadsbidmachine__HybridBidMachineMediationSpec_ {
91
+ return value.getCxxPart()
92
+ }
93
+
94
+ /**
95
+ * Get the memory size of the Swift class (plus size of any other allocations)
96
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
97
+ */
98
+ @inline(__always)
99
+ public var memorySize: Int {
100
+ return MemoryHelper.getSizeOf(__implementation) + __implementation.memorySize
101
+ }
102
+
103
+ /**
104
+ * Compares this object with the given [other] object for reference equality.
105
+ */
106
+ @inline(__always)
107
+ public func equals(other: HybridBidMachineMediationSpec_cxx) -> Bool {
108
+ return __implementation === other.__implementation
109
+ }
110
+
111
+ /**
112
+ * Call dispose() on the Swift class.
113
+ * This _may_ be called manually from JS.
114
+ */
115
+ @inline(__always)
116
+ public func dispose() {
117
+ __implementation.dispose()
118
+ }
119
+
120
+ /**
121
+ * Call toString() on the Swift class.
122
+ */
123
+ @inline(__always)
124
+ public func toString() -> String {
125
+ return __implementation.toString()
126
+ }
127
+
128
+ // Properties
129
+
130
+ // Methods
131
+
132
+ // Static properties
133
+
134
+ public class func getAdapterVersion_NitroGoogleMobileAdsBidMachine_BidMachineMediation() -> String? {
135
+ let value = HybridBidMachineMediation.adapterVersion
136
+ return value
137
+ }
138
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": 2,
3
+ "classes": {
4
+ "BidMachineMediation": {
5
+ "android": {
6
+ "implementation": {
7
+ "className": "HybridBidMachineMediation"
8
+ },
9
+ "language": "kotlin"
10
+ },
11
+ "apple": {
12
+ "implementation": {
13
+ "className": "HybridBidMachineMediation"
14
+ },
15
+ "language": "swift"
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,2 @@
1
+ // Generated by nitrogen. Keeps the SwiftPM C++ module available to its Swift bridge.
2
+ #include <NitroGoogleMobileAdsBidMachine/NitroGoogleMobileAdsBidMachineCxxModule.hpp>
@@ -0,0 +1,2 @@
1
+ // Generated by nitrogen. Keeps the SwiftPM C++ module available to its Swift bridge.
2
+ #pragma once
@@ -0,0 +1,19 @@
1
+ ///
2
+ /// BidMachineMediation.cjs
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ const { NitroModules } = require('nitro-core')
9
+
10
+ let hybridClass
11
+
12
+ module.exports = {
13
+ get BidMachineMediation() {
14
+ if (hybridClass === undefined) {
15
+ hybridClass = NitroModules.getHybridClass('googlemobileadsbidmachine.BidMachineMediation')
16
+ }
17
+ return hybridClass
18
+ },
19
+ }
@@ -0,0 +1,9 @@
1
+ ///
2
+ /// BidMachineMediation.d.cts
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ // The spec's `export declare class BidMachineMediation` types this runtime export.
9
+ export {}
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "nitro-google-mobile-ads-bidmachine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "BidMachine mediation adapter for nitro-google-mobile-ads",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": "./src/index.ts",
9
+ "./package.json": "./package.json"
10
+ },
11
+ "imports": {
12
+ "#nitro/*": "./nitrogen/generated/shared/javascript/*.cjs"
13
+ },
14
+ "files": [
15
+ "src",
16
+ "Package.swift",
17
+ "ios",
18
+ "android",
19
+ "nitrogen/generated",
20
+ "nitro.json"
21
+ ],
22
+ "scripts": {
23
+ "typecheck": "tsc --noEmit",
24
+ "specs": "bun run --bun nitrogen",
25
+ "prepack": "bun run specs"
26
+ },
27
+ "peerDependencies": {
28
+ "nitro-core": ">=1.0.0-alpha.nightly.137.gd4793c40b8b8",
29
+ "nitro-google-mobile-ads": "^0.1.0 || ^0.2.0"
30
+ },
31
+ "devDependencies": {
32
+ "nitro-core": "1.0.0-alpha.nightly.137.gd4793c40b8b8",
33
+ "nitrogen": "1.0.0-alpha.nightly.137.gd4793c40b8b8",
34
+ "typescript": "7.0.2"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/kazutoyo/nitro-google-mobile-ads.git",
39
+ "directory": "packages/nitro-google-mobile-ads-bidmachine"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
44
+ }
@@ -0,0 +1,11 @@
1
+ import { Android, iOS, type HybridObject } from 'nitro-core'
2
+
3
+ export * from '#nitro/BidMachineMediation'
4
+
5
+ /** The BidMachine mediation adapter linked into the app. */
6
+ @iOS({ language: 'swift', implementation: { className: 'HybridBidMachineMediation' } })
7
+ @Android({ language: 'kotlin', implementation: { className: 'HybridBidMachineMediation' } })
8
+ export declare class BidMachineMediation extends HybridObject {
9
+ /** The adapter version, as reported by the native SDK, or `undefined` if the adapter is not linked. */
10
+ static readonly adapterVersion: string | undefined
11
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { BidMachineMediation } from './BidMachineMediation.nitro'