@omp343/rn-ad-mediation 0.1.2 → 0.1.4

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.
@@ -43,4 +43,8 @@ public abstract class NativeRnAdMediationSpec extends ReactContextBaseJavaModule
43
43
  @ReactMethod
44
44
  @DoNotStrip
45
45
  public abstract void showInterstitial();
46
+
47
+ @ReactMethod
48
+ @DoNotStrip
49
+ public abstract void showRewarded();
46
50
  }
@@ -27,11 +27,17 @@ static facebook::jsi::Value __hostFunction_NativeRnAdMediationSpecJSI_showInters
27
27
  return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "showInterstitial", "()V", args, count, cachedMethodId);
28
28
  }
29
29
 
30
+ static facebook::jsi::Value __hostFunction_NativeRnAdMediationSpecJSI_showRewarded(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "showRewarded", "()V", args, count, cachedMethodId);
33
+ }
34
+
30
35
  NativeRnAdMediationSpecJSI::NativeRnAdMediationSpecJSI(const JavaTurboModule::InitParams &params)
31
36
  : JavaTurboModule(params) {
32
37
  methodMap_["initialize"] = MethodMetadata {4, __hostFunction_NativeRnAdMediationSpecJSI_initialize};
33
38
  methodMap_["showBanner"] = MethodMetadata {0, __hostFunction_NativeRnAdMediationSpecJSI_showBanner};
34
39
  methodMap_["showInterstitial"] = MethodMetadata {0, __hostFunction_NativeRnAdMediationSpecJSI_showInterstitial};
40
+ methodMap_["showRewarded"] = MethodMetadata {0, __hostFunction_NativeRnAdMediationSpecJSI_showRewarded};
35
41
  }
36
42
 
37
43
  std::shared_ptr<TurboModule> RnAdMediation_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
@@ -25,6 +25,7 @@ protected:
25
25
  methodMap_["initialize"] = MethodMetadata {.argCount = 4, .invoker = __initialize};
26
26
  methodMap_["showBanner"] = MethodMetadata {.argCount = 0, .invoker = __showBanner};
27
27
  methodMap_["showInterstitial"] = MethodMetadata {.argCount = 0, .invoker = __showInterstitial};
28
+ methodMap_["showRewarded"] = MethodMetadata {.argCount = 0, .invoker = __showRewarded};
28
29
  }
29
30
 
30
31
  private:
@@ -52,6 +53,13 @@ private:
52
53
  "Expected showInterstitial(...) to have 1 parameters");
53
54
  bridging::callFromJs<void>(rt, &T::showInterstitial, static_cast<NativeRnAdMediationCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
54
55
  }
56
+
57
+ static jsi::Value __showRewarded(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
58
+ static_assert(
59
+ bridging::getParameterCount(&T::showRewarded) == 1,
60
+ "Expected showRewarded(...) to have 1 parameters");
61
+ bridging::callFromJs<void>(rt, &T::showRewarded, static_cast<NativeRnAdMediationCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
62
+ }
55
63
  };
56
64
 
57
65
  } // namespace facebook::react
@@ -34,6 +34,12 @@ class RnAdMediationModule(
34
34
  AdMediation.showBanner(it)
35
35
  }
36
36
  }
37
+ @ReactMethod
38
+ override fun showRewarded() {
39
+ currentActivity?.let {
40
+ AdMediation.showRewarded(it)
41
+ }
42
+ }
37
43
 
38
44
  @ReactMethod
39
45
  override fun showInterstitial() {
@@ -5,10 +5,13 @@ import com.facebook.react.bridge.NativeModule
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.module.model.ReactModuleInfo
7
7
  import com.facebook.react.module.model.ReactModuleInfoProvider
8
- import java.util.HashMap
9
8
 
10
9
  class RnAdMediationPackage : BaseReactPackage() {
11
- override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
10
+
11
+ override fun getModule(
12
+ name: String,
13
+ reactContext: ReactApplicationContext
14
+ ): NativeModule? {
12
15
  return if (name == RnAdMediationModule.NAME) {
13
16
  RnAdMediationModule(reactContext)
14
17
  } else {
@@ -18,16 +21,16 @@ class RnAdMediationPackage : BaseReactPackage() {
18
21
 
19
22
  override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
23
  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
24
+ mapOf(
25
+ RnAdMediationModule.NAME to ReactModuleInfo(
26
+ RnAdMediationModule.NAME,
27
+ RnAdMediationModule.NAME,
28
+ false, // canOverrideExistingModule
29
+ false, // needsEagerInit
30
+ false, // isCxxModule
31
+ true // isTurboModule
32
+ )
29
33
  )
30
- moduleInfos
31
34
  }
32
35
  }
33
36
  }
@@ -4,4 +4,5 @@ import NativeRnAdMediation from "./specs/NativeRnAdMediation.js";
4
4
  export const initialize = (admobAppId, unityGameId, applovinKey, ironsourceKey) => NativeRnAdMediation.initialize(admobAppId, unityGameId, applovinKey, ironsourceKey);
5
5
  export const showBanner = () => NativeRnAdMediation.showBanner();
6
6
  export const showInterstitial = () => NativeRnAdMediation.showInterstitial();
7
+ export const showRewarded = () => NativeRnAdMediation.showRewarded();
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"names":["NativeRnAdMediation","initialize","admobAppId","unityGameId","applovinKey","ironsourceKey","showBanner","showInterstitial","showRewarded"],"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;AAExC,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAC1BR,mBAAmB,CAACQ,YAAY,CAAC,CAAC","ignoreList":[]}
@@ -1 +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
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\..\\src","sources":["specs/NativeRnAdMediation.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAelD,eAAeA,mBAAmB,CAACC,YAAY,CAC7C,eACF,CAAC","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  export declare const initialize: (admobAppId: string, unityGameId?: string, applovinKey?: string, ironsourceKey?: string) => void;
2
2
  export declare const showBanner: () => void;
3
3
  export declare const showInterstitial: () => void;
4
+ export declare const showRewarded: () => void;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;AAEzC,eAAO,MAAM,YAAY,YACW,CAAC"}
@@ -3,6 +3,7 @@ export interface Spec extends TurboModule {
3
3
  initialize(admobAppId: string, unityGameId?: string, applovinKey?: string, ironsourceKey?: string): void;
4
4
  showBanner(): void;
5
5
  showInterstitial(): void;
6
+ showRewarded(): void;
6
7
  }
7
8
  declare const _default: Spec;
8
9
  export default _default;
@@ -1 +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"}
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;IACzB,YAAY,IAAI,IAAI,CAAC;CACtB;;AAED,wBAEE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omp343/rn-ad-mediation",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "React Native ad mediation wrapper",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/index.ts CHANGED
@@ -18,3 +18,6 @@ export const showBanner = () =>
18
18
 
19
19
  export const showInterstitial = () =>
20
20
  NativeRnAdMediation.showInterstitial();
21
+
22
+ export const showRewarded = () =>
23
+ NativeRnAdMediation.showRewarded();
@@ -11,6 +11,7 @@ export interface Spec extends TurboModule {
11
11
 
12
12
  showBanner(): void;
13
13
  showInterstitial(): void;
14
+ showRewarded(): void;
14
15
  }
15
16
 
16
17
  export default TurboModuleRegistry.getEnforcing<Spec>(