@omp343/rn-ad-mediation 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.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Om Patel
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # rn-ad-mediation
2
+
3
+ React Native ad mediation wrapper
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install rn-ad-mediation
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { multiply } from 'rn-ad-mediation';
18
+
19
+ // ...
20
+
21
+ const result = multiply(3, 7);
22
+ ```
23
+
24
+
25
+ ## Contributing
26
+
27
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
28
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
29
+ - [Code of conduct](CODE_OF_CONDUCT.md)
30
+
31
+ ## License
32
+
33
+ MIT
34
+
35
+ ---
36
+
37
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "RnAdMediation"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/ompatel585/rn-ad-mediation.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
@@ -0,0 +1,66 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = { name ->
3
+ return rootProject.ext.has(name)
4
+ ? rootProject.ext.get(name)
5
+ : project.properties["RnAdMediation_" + name]
6
+ }
7
+
8
+ repositories {
9
+ google()
10
+ mavenCentral()
11
+ maven { url "https://jitpack.io" }
12
+ }
13
+
14
+ dependencies {
15
+ classpath "com.android.tools.build:gradle:8.7.2"
16
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
17
+ }
18
+ }
19
+
20
+ apply plugin: "com.android.library"
21
+ apply plugin: "kotlin-android"
22
+ apply plugin: "com.facebook.react"
23
+
24
+ def getExtOrIntegerDefault(name) {
25
+ return rootProject.ext.has(name)
26
+ ? rootProject.ext.get(name)
27
+ : project.properties["RnAdMediation_" + name].toInteger()
28
+ }
29
+
30
+ android {
31
+ namespace "com.rnadmediation"
32
+
33
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
34
+
35
+ defaultConfig {
36
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
37
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
38
+ }
39
+
40
+ buildTypes {
41
+ release {
42
+ minifyEnabled false
43
+ }
44
+ }
45
+
46
+ compileOptions {
47
+ sourceCompatibility JavaVersion.VERSION_1_8
48
+ targetCompatibility JavaVersion.VERSION_1_8
49
+ }
50
+ }
51
+
52
+ repositories {
53
+ google()
54
+ mavenCentral()
55
+ maven { url "https://jitpack.io" }
56
+ }
57
+
58
+ def kotlin_version = getExtOrDefault("kotlinVersion")
59
+
60
+ dependencies {
61
+ implementation "com.facebook.react:react-android"
62
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
63
+
64
+ // ✅ YOUR ANDROID MEDIATION SDK (FINAL)
65
+ implementation "com.github.ompatel585:AdMediationSDK2:v1.0.5"
66
+ }
@@ -0,0 +1,5 @@
1
+ RnAdMediation_kotlinVersion=2.0.21
2
+ RnAdMediation_minSdkVersion=24
3
+ RnAdMediation_targetSdkVersion=34
4
+ RnAdMediation_compileSdkVersion=35
5
+ RnAdMediation_ndkVersion=27.1.12297006
@@ -0,0 +1,31 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ const { RnAdMediation } = NativeModules;
4
+
5
+ type InitConfig = {
6
+ admobAppId: string;
7
+ unityGameId?: string;
8
+ applovinKey?: string;
9
+ ironsourceKey?: string;
10
+ };
11
+
12
+ export function initialize(config: InitConfig) {
13
+ if (!RnAdMediation) {
14
+ throw new Error('RnAdMediation native module not linked');
15
+ }
16
+
17
+ RnAdMediation.initialize(
18
+ config.admobAppId,
19
+ config.unityGameId ?? null,
20
+ config.applovinKey ?? null,
21
+ config.ironsourceKey ?? null
22
+ );
23
+ }
24
+
25
+ export function showBanner() {
26
+ RnAdMediation.showBanner();
27
+ }
28
+
29
+ export function showInterstitial() {
30
+ RnAdMediation.showInterstitial();
31
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,48 @@
1
+ package com.rnadmediation
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.bridge.ReactMethod
5
+ import com.facebook.react.module.annotations.ReactModule
6
+ import com.yourcompany.adsdk.AdMediation
7
+
8
+ @ReactModule(name = RnAdMediationModule.NAME)
9
+ class RnAdMediationModule(
10
+ reactContext: ReactApplicationContext
11
+ ) : NativeRnAdMediationSpec(reactContext) {
12
+
13
+ override fun getName(): String = NAME
14
+
15
+ @ReactMethod
16
+ override fun initialize(
17
+ admobAppId: String,
18
+ unityGameId: String?,
19
+ applovinKey: String?,
20
+ ironsourceKey: String?
21
+ ) {
22
+ AdMediation.initialize(
23
+ reactContext,
24
+ admobAppId,
25
+ unityGameId,
26
+ applovinKey,
27
+ ironsourceKey
28
+ )
29
+ }
30
+
31
+ @ReactMethod
32
+ override fun showBanner() {
33
+ currentActivity?.let {
34
+ AdMediation.showBanner(it)
35
+ }
36
+ }
37
+
38
+ @ReactMethod
39
+ override fun showInterstitial() {
40
+ currentActivity?.let {
41
+ AdMediation.showInterstitial(it)
42
+ }
43
+ }
44
+
45
+ companion object {
46
+ const val NAME = "RnAdMediation"
47
+ }
48
+ }
@@ -0,0 +1,33 @@
1
+ package com.rnadmediation
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import java.util.HashMap
9
+
10
+ class RnAdMediationPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == RnAdMediationModule.NAME) {
13
+ RnAdMediationModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ moduleInfos[RnAdMediationModule.NAME] = ReactModuleInfo(
23
+ RnAdMediationModule.NAME,
24
+ RnAdMediationModule.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ false, // isCxxModule
28
+ true // isTurboModule
29
+ )
30
+ moduleInfos
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,5 @@
1
+ #import <RnAdMediationSpec/RnAdMediationSpec.h>
2
+
3
+ @interface RnAdMediation : NSObject <NativeRnAdMediationSpec>
4
+
5
+ @end
@@ -0,0 +1,21 @@
1
+ #import "RnAdMediation.h"
2
+
3
+ @implementation RnAdMediation
4
+ - (NSNumber *)multiply:(double)a b:(double)b {
5
+ NSNumber *result = @(a * b);
6
+
7
+ return result;
8
+ }
9
+
10
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
11
+ (const facebook::react::ObjCTurboModule::InitParams &)params
12
+ {
13
+ return std::make_shared<facebook::react::NativeRnAdMediationSpecJSI>(params);
14
+ }
15
+
16
+ + (NSString *)moduleName
17
+ {
18
+ return @"RnAdMediation";
19
+ }
20
+
21
+ @end
@@ -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":["NativeRnAdMediation.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAMpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ import RnAdMediation from "./NativeRnAdMediation.js";
4
+ export function multiply(a, b) {
5
+ return RnAdMediation.multiply(a, b);
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,11 @@
1
+ type InitConfig = {
2
+ admobAppId: string;
3
+ unityGameId?: string;
4
+ applovinKey?: string;
5
+ ironsourceKey?: string;
6
+ };
7
+ export declare function initialize(config: InitConfig): void;
8
+ export declare function showBanner(): void;
9
+ export declare function showInterstitial(): void;
10
+ export {};
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../android/src/index.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,QAW5C;AAED,wBAAgB,UAAU,SAEzB;AAED,wBAAgB,gBAAgB,SAE/B"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,7 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ multiply(a: number, b: number): number;
4
+ }
5
+ declare const _default: Spec;
6
+ export default _default;
7
+ //# sourceMappingURL=NativeRnAdMediation.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export declare function multiply(a: number, b: number): number;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/package.json ADDED
@@ -0,0 +1,169 @@
1
+ {
2
+ "name": "@omp343/rn-ad-mediation",
3
+ "version": "0.1.0",
4
+ "description": "React Native ad mediation wrapper",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace rn-ad-mediation-example",
36
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
37
+ "prepare": "bob build",
38
+ "typecheck": "tsc",
39
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
40
+ "test": "jest",
41
+ "release": "release-it --only-version"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/ompatel585/rn-ad-mediation.git"
51
+ },
52
+ "author": "Om Patel <ompatel34003@gmail.com> (https://github.com/ompatel585)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/ompatel585/rn-ad-mediation/issues"
56
+ },
57
+ "homepage": "https://github.com/ompatel585/rn-ad-mediation#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@commitlint/config-conventional": "^19.8.1",
63
+ "@eslint/compat": "^1.3.2",
64
+ "@eslint/eslintrc": "^3.3.1",
65
+ "@eslint/js": "^9.35.0",
66
+ "@react-native/babel-preset": "0.83.0",
67
+ "@react-native/eslint-config": "0.83.0",
68
+ "@release-it/conventional-changelog": "^10.0.1",
69
+ "@types/jest": "^29.5.14",
70
+ "@types/react": "^19.2.0",
71
+ "commitlint": "^19.8.1",
72
+ "del-cli": "^6.0.0",
73
+ "eslint": "^9.35.0",
74
+ "eslint-config-prettier": "^10.1.8",
75
+ "eslint-plugin-prettier": "^5.5.4",
76
+ "jest": "^29.7.0",
77
+ "lefthook": "^2.0.3",
78
+ "prettier": "^2.8.8",
79
+ "react": "19.2.0",
80
+ "react-native": "0.83.0",
81
+ "react-native-builder-bob": "^0.40.13",
82
+ "release-it": "^19.0.4",
83
+ "turbo": "^2.5.6",
84
+ "typescript": "^5.9.2"
85
+ },
86
+ "peerDependencies": {
87
+ "react": "*",
88
+ "react-native": "*"
89
+ },
90
+ "workspaces": [
91
+ "example"
92
+ ],
93
+ "packageManager": "yarn@4.11.0",
94
+ "react-native-builder-bob": {
95
+ "source": "src",
96
+ "output": "lib",
97
+ "targets": [
98
+ [
99
+ "module",
100
+ {
101
+ "esm": true
102
+ }
103
+ ],
104
+ [
105
+ "typescript",
106
+ {
107
+ "project": "tsconfig.build.json"
108
+ }
109
+ ]
110
+ ]
111
+ },
112
+ "codegenConfig": {
113
+ "name": "RnAdMediationSpec",
114
+ "type": "modules",
115
+ "jsSrcsDir": "src",
116
+ "android": {
117
+ "javaPackageName": "com.rnadmediation"
118
+ }
119
+ },
120
+ "prettier": {
121
+ "quoteProps": "consistent",
122
+ "singleQuote": true,
123
+ "tabWidth": 2,
124
+ "trailingComma": "es5",
125
+ "useTabs": false
126
+ },
127
+ "jest": {
128
+ "preset": "react-native",
129
+ "modulePathIgnorePatterns": [
130
+ "<rootDir>/example/node_modules",
131
+ "<rootDir>/lib/"
132
+ ]
133
+ },
134
+ "commitlint": {
135
+ "extends": [
136
+ "@commitlint/config-conventional"
137
+ ]
138
+ },
139
+ "release-it": {
140
+ "git": {
141
+ "commitMessage": "chore: release ${version}",
142
+ "tagName": "v${version}"
143
+ },
144
+ "npm": {
145
+ "publish": true
146
+ },
147
+ "github": {
148
+ "release": true
149
+ },
150
+ "plugins": {
151
+ "@release-it/conventional-changelog": {
152
+ "preset": {
153
+ "name": "angular"
154
+ }
155
+ }
156
+ }
157
+ },
158
+ "create-react-native-library": {
159
+ "type": "turbo-module",
160
+ "languages": "kotlin-objc",
161
+ "tools": [
162
+ "eslint",
163
+ "jest",
164
+ "lefthook",
165
+ "release-it"
166
+ ],
167
+ "version": "0.56.0"
168
+ }
169
+ }
@@ -0,0 +1,7 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+
3
+ export interface Spec extends TurboModule {
4
+ multiply(a: number, b: number): number;
5
+ }
6
+
7
+ export default TurboModuleRegistry.getEnforcing<Spec>('RnAdMediation');
package/src/index.tsx ADDED
@@ -0,0 +1,5 @@
1
+ import RnAdMediation from './NativeRnAdMediation';
2
+
3
+ export function multiply(a: number, b: number): number {
4
+ return RnAdMediation.multiply(a, b);
5
+ }