@omp343/rn-ad-mediation 0.1.0 → 0.1.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.
@@ -0,0 +1,46 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.facebook.fbreact.specs;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.ReactApplicationContext;
17
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
+ import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
+ import javax.annotation.Nonnull;
21
+ import javax.annotation.Nullable;
22
+
23
+ public abstract class NativeRnAdMediationSpec extends ReactContextBaseJavaModule implements TurboModule {
24
+ public static final String NAME = "RnAdMediation";
25
+
26
+ public NativeRnAdMediationSpec(ReactApplicationContext reactContext) {
27
+ super(reactContext);
28
+ }
29
+
30
+ @Override
31
+ public @Nonnull String getName() {
32
+ return NAME;
33
+ }
34
+
35
+ @ReactMethod
36
+ @DoNotStrip
37
+ public abstract void initialize(String admobAppId, @Nullable String unityGameId, @Nullable String applovinKey, @Nullable String ironsourceKey);
38
+
39
+ @ReactMethod
40
+ @DoNotStrip
41
+ public abstract void showBanner();
42
+
43
+ @ReactMethod
44
+ @DoNotStrip
45
+ public abstract void showInterstitial();
46
+ }
@@ -0,0 +1,28 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RnAdMediation/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RnAdMediation
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RnAdMediation PUBLIC . react/renderer/components/RnAdMediation)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RnAdMediation
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_reactnative_options(react_codegen_RnAdMediation PRIVATE)
@@ -0,0 +1,44 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RnAdMediation.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeRnAdMediationSpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "initialize", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeRnAdMediationSpecJSI_showBanner(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "showBanner", "()V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeRnAdMediationSpecJSI_showInterstitial(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "showInterstitial", "()V", args, count, cachedMethodId);
28
+ }
29
+
30
+ NativeRnAdMediationSpecJSI::NativeRnAdMediationSpecJSI(const JavaTurboModule::InitParams &params)
31
+ : JavaTurboModule(params) {
32
+ methodMap_["initialize"] = MethodMetadata {4, __hostFunction_NativeRnAdMediationSpecJSI_initialize};
33
+ methodMap_["showBanner"] = MethodMetadata {0, __hostFunction_NativeRnAdMediationSpecJSI_showBanner};
34
+ methodMap_["showInterstitial"] = MethodMetadata {0, __hostFunction_NativeRnAdMediationSpecJSI_showInterstitial};
35
+ }
36
+
37
+ std::shared_ptr<TurboModule> RnAdMediation_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
38
+ if (moduleName == "RnAdMediation") {
39
+ return std::make_shared<NativeRnAdMediationSpecJSI>(params);
40
+ }
41
+ return nullptr;
42
+ }
43
+
44
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeRnAdMediation'
21
+ */
22
+ class JSI_EXPORT NativeRnAdMediationSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeRnAdMediationSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RnAdMediation_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+ template <typename T>
19
+ class JSI_EXPORT NativeRnAdMediationCxxSpec : public TurboModule {
20
+ public:
21
+ static constexpr std::string_view kModuleName = "RnAdMediation";
22
+
23
+ protected:
24
+ NativeRnAdMediationCxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{NativeRnAdMediationCxxSpec::kModuleName}, jsInvoker) {
25
+ methodMap_["initialize"] = MethodMetadata {.argCount = 4, .invoker = __initialize};
26
+ methodMap_["showBanner"] = MethodMetadata {.argCount = 0, .invoker = __showBanner};
27
+ methodMap_["showInterstitial"] = MethodMetadata {.argCount = 0, .invoker = __showInterstitial};
28
+ }
29
+
30
+ private:
31
+ static jsi::Value __initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
+ static_assert(
33
+ bridging::getParameterCount(&T::initialize) == 5,
34
+ "Expected initialize(...) to have 5 parameters");
35
+ bridging::callFromJs<void>(rt, &T::initialize, static_cast<NativeRnAdMediationCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
36
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
37
+ count <= 1 || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asString(rt)),
38
+ count <= 2 || args[2].isUndefined() ? std::nullopt : std::make_optional(args[2].asString(rt)),
39
+ count <= 3 || args[3].isUndefined() ? std::nullopt : std::make_optional(args[3].asString(rt)));return jsi::Value::undefined();
40
+ }
41
+
42
+ static jsi::Value __showBanner(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
43
+ static_assert(
44
+ bridging::getParameterCount(&T::showBanner) == 1,
45
+ "Expected showBanner(...) to have 1 parameters");
46
+ bridging::callFromJs<void>(rt, &T::showBanner, static_cast<NativeRnAdMediationCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
47
+ }
48
+
49
+ static jsi::Value __showInterstitial(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
50
+ static_assert(
51
+ bridging::getParameterCount(&T::showInterstitial) == 1,
52
+ "Expected showInterstitial(...) to have 1 parameters");
53
+ bridging::callFromJs<void>(rt, &T::showInterstitial, static_cast<NativeRnAdMediationCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
54
+ }
55
+ };
56
+
57
+ } // namespace facebook::react
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeRnAdMediation.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAMpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeRnAdMediation.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAcpE,eAAeA,mBAAmB,CAACC,YAAY,CAC7C,eACF,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import RnAdMediation from "./NativeRnAdMediation.js";
4
- export function multiply(a, b) {
5
- return RnAdMediation.multiply(a, b);
6
- }
3
+ import NativeRnAdMediation from "./specs/NativeRnAdMediation.js";
4
+ export const initialize = (admobAppId, unityGameId, applovinKey, ironsourceKey) => NativeRnAdMediation.initialize(admobAppId, unityGameId, applovinKey, ironsourceKey);
5
+ export const showBanner = () => NativeRnAdMediation.showBanner();
6
+ export const showInterstitial = () => NativeRnAdMediation.showInterstitial();
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RnAdMediation","multiply","a","b"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,0BAAuB;AAEjD,OAAO,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOH,aAAa,CAACC,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"names":["NativeRnAdMediation","initialize","admobAppId","unityGameId","applovinKey","ironsourceKey","showBanner","showInterstitial"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,mBAAmB,MAAM,gCAA6B;AAE7D,OAAO,MAAMC,UAAU,GAAGA,CACxBC,UAAkB,EAClBC,WAAoB,EACpBC,WAAoB,EACpBC,aAAsB,KAEtBL,mBAAmB,CAACC,UAAU,CAC5BC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,aACF,CAAC;AAEH,OAAO,MAAMC,UAAU,GAAGA,CAAA,KACxBN,mBAAmB,CAACM,UAAU,CAAC,CAAC;AAElC,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAC9BP,mBAAmB,CAACO,gBAAgB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('RnAdMediation');
5
+ //# sourceMappingURL=NativeRnAdMediation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\..\\src","sources":["specs/NativeRnAdMediation.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAclD,eAAeA,mBAAmB,CAACC,YAAY,CAC7C,eACF,CAAC","ignoreList":[]}
@@ -1,6 +1,8 @@
1
1
  import { type TurboModule } from 'react-native';
2
2
  export interface Spec extends TurboModule {
3
- multiply(a: number, b: number): number;
3
+ initialize(admobAppId: string, unityGameId?: string, applovinKey?: string, ironsourceKey?: string): void;
4
+ showBanner(): void;
5
+ showInterstitial(): void;
4
6
  }
5
7
  declare const _default: Spec;
6
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRnAdMediation.d.ts","sourceRoot":"","sources":["../../../src/NativeRnAdMediation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;;AAED,wBAAuE"}
1
+ {"version":3,"file":"NativeRnAdMediation.d.ts","sourceRoot":"","sources":["../../../src/NativeRnAdMediation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAAC;IAER,UAAU,IAAI,IAAI,CAAC;IACnB,gBAAgB,IAAI,IAAI,CAAC;CAC1B;;AAED,wBAEE"}
@@ -1,2 +1,4 @@
1
- export declare function multiply(a: number, b: number): number;
1
+ export declare const initialize: (admobAppId: string, unityGameId?: string, applovinKey?: string, ironsourceKey?: string) => void;
2
+ export declare const showBanner: () => void;
3
+ export declare const showInterstitial: () => void;
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GACrB,YAAY,MAAM,EAClB,cAAc,MAAM,EACpB,cAAc,MAAM,EACpB,gBAAgB,MAAM,SAOrB,CAAC;AAEJ,eAAO,MAAM,UAAU,YACW,CAAC;AAEnC,eAAO,MAAM,gBAAgB,YACW,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ initialize(admobAppId: string, unityGameId?: string, applovinKey?: string, ironsourceKey?: string): void;
4
+ showBanner(): void;
5
+ showInterstitial(): void;
6
+ }
7
+ declare const _default: Spec;
8
+ export default _default;
9
+ //# sourceMappingURL=NativeRnAdMediation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeRnAdMediation.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeRnAdMediation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAAC;IAER,UAAU,IAAI,IAAI,CAAC;IACnB,gBAAgB,IAAI,IAAI,CAAC;CAC1B;;AAED,wBAEE"}
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@omp343/rn-ad-mediation",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React Native ad mediation wrapper",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "source": "./src/index.tsx",
9
+ "source": "./src/index.ts",
10
10
  "types": "./lib/typescript/src/index.d.ts",
11
11
  "default": "./lib/module/index.js"
12
12
  },
13
13
  "./package.json": "./package.json"
14
14
  },
15
+
15
16
  "files": [
16
17
  "src",
17
18
  "lib",
@@ -110,14 +111,15 @@
110
111
  ]
111
112
  },
112
113
  "codegenConfig": {
113
- "name": "RnAdMediationSpec",
114
- "type": "modules",
115
- "jsSrcsDir": "src",
116
- "android": {
117
- "javaPackageName": "com.rnadmediation"
118
- }
119
- },
120
- "prettier": {
114
+ "name": "RnAdMediation",
115
+ "type": "modules",
116
+ "jsSrcsDir": "src/specs",
117
+ "android": {
118
+ "javaPackageName": "com.rnadmediation"
119
+ }
120
+ }
121
+ ,
122
+ "prettier": {
121
123
  "quoteProps": "consistent",
122
124
  "singleQuote": true,
123
125
  "tabWidth": 2,
@@ -1,7 +1,17 @@
1
1
  import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
2
 
3
3
  export interface Spec extends TurboModule {
4
- multiply(a: number, b: number): number;
4
+ initialize(
5
+ admobAppId: string,
6
+ unityGameId?: string,
7
+ applovinKey?: string,
8
+ ironsourceKey?: string
9
+ ): void;
10
+
11
+ showBanner(): void;
12
+ showInterstitial(): void;
5
13
  }
6
14
 
7
- export default TurboModuleRegistry.getEnforcing<Spec>('RnAdMediation');
15
+ export default TurboModuleRegistry.getEnforcing<Spec>(
16
+ 'RnAdMediation'
17
+ );
package/src/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ import NativeRnAdMediation from './specs/NativeRnAdMediation';
2
+
3
+ export const initialize = (
4
+ admobAppId: string,
5
+ unityGameId?: string,
6
+ applovinKey?: string,
7
+ ironsourceKey?: string
8
+ ) =>
9
+ NativeRnAdMediation.initialize(
10
+ admobAppId,
11
+ unityGameId,
12
+ applovinKey,
13
+ ironsourceKey
14
+ );
15
+
16
+ export const showBanner = () =>
17
+ NativeRnAdMediation.showBanner();
18
+
19
+ export const showInterstitial = () =>
20
+ NativeRnAdMediation.showInterstitial();
@@ -0,0 +1,18 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ initialize(
6
+ admobAppId: string,
7
+ unityGameId?: string,
8
+ applovinKey?: string,
9
+ ironsourceKey?: string
10
+ ): void;
11
+
12
+ showBanner(): void;
13
+ showInterstitial(): void;
14
+ }
15
+
16
+ export default TurboModuleRegistry.getEnforcing<Spec>(
17
+ 'RnAdMediation'
18
+ );
package/src/index.tsx DELETED
@@ -1,5 +0,0 @@
1
- import RnAdMediation from './NativeRnAdMediation';
2
-
3
- export function multiply(a: number, b: number): number {
4
- return RnAdMediation.multiply(a, b);
5
- }