react-native-daro 1.0.13 → 1.0.16
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 +1 -1
- package/README.md +30 -30
- package/android/build.gradle +52 -59
- package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +23 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdBannerViewManager.kt +38 -15
- package/android/src/main/java/com/daro/reactnative/DaroMAdNativeViewManager.kt +167 -0
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +257 -0
- package/android/src/main/java/com/daro/reactnative/DaroMPackage.kt +45 -0
- package/android/src/main/java/com/daro/reactnative/DaroMediaViewManager.kt +25 -0
- package/android/src/main/java/com/{darom → daro/reactnative}/constants/InternalDaroMBannerSize.kt +1 -1
- package/android/src/main/java/com/{darom → daro/reactnative}/event/DaroMEvent.kt +19 -8
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMBannerViewModuleImpl.kt +2 -2
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMInterstitialModuleImpl.kt +26 -26
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMLightPopupModuleImpl.kt +30 -29
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMRewardedAdModuleImpl.kt +27 -27
- package/android/src/main/java/com/{darom → daro/reactnative}/util/AdInfoUtil.kt +25 -1
- package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +37 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdBannerViewContainer.kt +417 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdNativeViewContainer.kt +624 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +123 -0
- package/android/src/newarch/java/com/daro/reactnative/DaroMModuleSpec.kt +6 -0
- package/android/src/oldarch/java/com/daro/reactnative/DaroMModuleSpec.kt +90 -0
- package/app.plugin.js +1 -0
- package/ios/DaroMModule+AppOpen.swift +38 -32
- package/ios/DaroMModule+Interstitial.swift +32 -26
- package/ios/DaroMModule+LightPopup.swift +43 -33
- package/ios/DaroMModule+Rewarded.swift +38 -27
- package/ios/DaroMModule.mm +45 -17
- package/ios/DaroMModule.swift +24 -17
- package/ios/Fabric/DaroMAdBannerComponentView.mm +207 -0
- package/ios/Fabric/DaroMFabricEventSink.mm +31 -0
- package/ios/Fabric/DaroMFabricPropApplier.mm +123 -0
- package/ios/Fabric/DaroMNativeAdComponentView.mm +294 -0
- package/ios/{DaroMAdBannerViewManager.m → Paper/DaroMAdBannerViewManager.m} +3 -1
- package/ios/Paper/DaroMAdBannerViewManager.swift +21 -0
- package/ios/{DaroMNativeAdViewManager.m → Paper/DaroMNativeAdViewManager.m} +2 -1
- package/ios/Paper/DaroMNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMAdEventSink.swift +24 -0
- package/ios/Shared/DaroMBannerAdView.swift +188 -0
- package/ios/Shared/DaroMNativeAdLoadCoordinator.swift +49 -0
- package/ios/Shared/DaroMNativeAdView.swift +575 -0
- package/ios/Shared/DaroMNativeAssetResolver.swift +53 -0
- package/ios/mediation/admob/DaroMediationDebugger.swift +11 -0
- package/ios/mediation/admob/DaroMediationTypes.swift +23 -0
- package/lib/commonjs/AdBannerView.js +21 -35
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +80 -21
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/commonjs/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/commonjs/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/EventEmitter.js +4 -5
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +48 -22
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +64 -46
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js +9 -0
- package/lib/commonjs/NativeDaroModule.js.map +1 -0
- package/lib/commonjs/RewardedAd.js +47 -23
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/codegen-env.d.js +2 -0
- package/lib/commonjs/codegen-env.d.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +110 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useLightPopupAd.js +114 -0
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +113 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/index.js +29 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +23 -18
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +43 -31
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +34 -7
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AdBannerView.js +20 -36
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +80 -22
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/module/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/module/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/EventEmitter.js +4 -6
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +47 -22
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +65 -47
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js +5 -0
- package/lib/module/NativeDaroModule.js.map +1 -0
- package/lib/module/RewardedAd.js +46 -23
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/codegen-env.d.js +2 -0
- package/lib/module/codegen-env.d.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +106 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useLightPopupAd.js +110 -0
- package/lib/module/hooks/useLightPopupAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +109 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/index.js +7 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +22 -19
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +45 -34
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +35 -8
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts +19 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts +6 -0
- package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +8 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts +8 -0
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/AdBannerView.d.ts +126 -4
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +125 -2
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts +19 -0
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts +6 -0
- package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +8 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withIos.d.ts +8 -0
- package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -0
- package/lib/typescript/module/src/AdBannerView.d.ts +126 -4
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +6 -0
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts +6 -0
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts +6 -0
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/module/src/RewardedAd.d.ts +6 -0
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +125 -2
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts +2 -2
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +2 -2
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +95 -105
- package/plugin/build/index.d.ts +18 -0
- package/plugin/build/index.js +71 -0
- package/plugin/build/skAdNetworkIds.d.ts +5 -0
- package/plugin/build/skAdNetworkIds.js +205 -0
- package/plugin/build/withAndroid.d.ts +7 -0
- package/plugin/build/withAndroid.js +222 -0
- package/plugin/build/withIos.d.ts +7 -0
- package/plugin/build/withIos.js +82 -0
- package/react-native-daro.podspec +28 -0
- package/src/AdBannerView.tsx +48 -48
- package/src/AppOpenAd.ts +101 -20
- package/src/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/src/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/src/DaroMediaViewNativeComponent.ts +9 -0
- package/src/ErrorCode.ts +1 -2
- package/src/EventEmitter.ts +9 -7
- package/src/InterstitialAd.ts +75 -21
- package/src/LightPopupAd.ts +90 -51
- package/src/NativeDaroModule.ts +91 -0
- package/src/RewardedAd.ts +72 -22
- package/src/codegen-env.d.ts +45 -0
- package/src/hooks/useInterstitialAd.ts +117 -0
- package/src/hooks/useLightPopupAd.ts +132 -0
- package/src/hooks/useRewardedAd.ts +122 -0
- package/src/index.tsx +21 -22
- package/src/nativeAd/NativeAdView.tsx +83 -45
- package/src/nativeAd/NativeAdViewComponents.tsx +129 -64
- package/src/nativeAd/NativeAdViewProvider.tsx +84 -16
- package/src/types/AdBannerViewProps.ts +11 -11
- package/src/types/AdInfo.ts +17 -17
- package/src/types/AdProps.ts +8 -9
- package/src/types/DaroMMobileAds.ts +3 -6
- package/src/types/NativeAdViewProps.ts +12 -5
- package/src/types/index.ts +1 -1
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifestNew.xml +0 -7
- package/android/src/main/java/com/darom/DaroMAdNativeViewManager.kt +0 -136
- package/android/src/main/java/com/darom/DaroMModule.kt +0 -203
- package/android/src/main/java/com/darom/DaroMPackage.kt +0 -21
- package/android/src/main/java/com/darom/util/EventEmitterUtil.kt +0 -24
- package/android/src/main/java/com/darom/view/DaroMAdBannerViewContainer.kt +0 -163
- package/android/src/main/java/com/darom/view/DaroMAdNativeViewContainer.kt +0 -375
- package/android/src/main/res/layout/layout_activity_transparent.xml +0 -7
- package/android/src/main/res/values/styles.xml +0 -11
- package/ios/DaroM-Bridging-Header.h +0 -6
- package/ios/DaroMAdBannerViewManager.swift +0 -91
- package/ios/DaroMNativeAdViewManager.swift +0 -291
- package/react-native-daro-m.podspec +0 -44
package/src/InterstitialAd.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
1
|
import {
|
|
3
2
|
addEventListener,
|
|
4
3
|
removeEventListener,
|
|
5
4
|
AdEventEmitter,
|
|
6
5
|
} from './EventEmitter';
|
|
6
|
+
import NativeDaroModule from './NativeDaroModule';
|
|
7
7
|
import type {
|
|
8
8
|
AdDisplayFailedInfo,
|
|
9
9
|
AdInfo,
|
|
@@ -11,8 +11,6 @@ import type {
|
|
|
11
11
|
} from './types/AdInfo';
|
|
12
12
|
import { AdEventType, type AdEventPayloadMap } from './types/AdEvent';
|
|
13
13
|
|
|
14
|
-
const { DaroMModule } = NativeModules;
|
|
15
|
-
|
|
16
14
|
const {
|
|
17
15
|
ON_INTERSTITIAL_LOADED_EVENT,
|
|
18
16
|
ON_INTERSTITIAL_LOAD_FAILED_EVENT,
|
|
@@ -21,7 +19,7 @@ const {
|
|
|
21
19
|
ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT,
|
|
22
20
|
ON_INTERSTITIAL_HIDDEN_EVENT,
|
|
23
21
|
ON_INTERSTITIAL_AD_IMPRESSION_RECORDED,
|
|
24
|
-
} =
|
|
22
|
+
} = NativeDaroModule.getConstants();
|
|
25
23
|
|
|
26
24
|
const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
|
|
27
25
|
[AdEventType.LOADED]: ON_INTERSTITIAL_LOADED_EVENT,
|
|
@@ -34,24 +32,32 @@ const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
export class InterstitialAd {
|
|
35
|
+
private static _nextRequestId = 1;
|
|
36
|
+
private static _legacyRequestIds = new Map<string, number>();
|
|
37
|
+
private static _legacyRequestIdSet = new Set<number>();
|
|
38
|
+
|
|
37
39
|
private readonly eventEmitter = new AdEventEmitter();
|
|
38
40
|
|
|
39
|
-
private constructor(
|
|
41
|
+
private constructor(
|
|
42
|
+
private readonly requestId: number,
|
|
43
|
+
private readonly adUnitId: string
|
|
44
|
+
) {}
|
|
40
45
|
|
|
41
46
|
static createForAdRequest(adUnitId: string): InterstitialAd {
|
|
42
|
-
|
|
47
|
+
const requestId = InterstitialAd._nextRequestId++;
|
|
48
|
+
return new InterstitialAd(requestId, adUnitId);
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
isAdReady(): Promise<boolean> {
|
|
46
|
-
return
|
|
52
|
+
return NativeDaroModule.isInterstitialReady(this.requestId, this.adUnitId);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
load(): void {
|
|
50
|
-
|
|
56
|
+
NativeDaroModule.loadInterstitial(this.requestId, this.adUnitId);
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
show(): void {
|
|
54
|
-
|
|
60
|
+
NativeDaroModule.showInterstitial(this.requestId, this.adUnitId);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
addAdEventListener<T extends AdEventType>(
|
|
@@ -59,9 +65,9 @@ export class InterstitialAd {
|
|
|
59
65
|
listener: (info: AdEventPayloadMap[T]) => void
|
|
60
66
|
): () => void {
|
|
61
67
|
const nativeEvent = NATIVE_EVENT_BY_TYPE[type];
|
|
62
|
-
const
|
|
68
|
+
const requestId = this.requestId;
|
|
63
69
|
return this.eventEmitter.addEventListener(nativeEvent, (payload: any) => {
|
|
64
|
-
if (payload?.
|
|
70
|
+
if (payload?.requestId !== requestId) {
|
|
65
71
|
return;
|
|
66
72
|
}
|
|
67
73
|
listener(payload);
|
|
@@ -73,25 +79,55 @@ export class InterstitialAd {
|
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
// ---- Deprecated static API (backward compatibility) ----
|
|
82
|
+
// Static API allocates a stable requestId per adUnitId and reuses it.
|
|
83
|
+
// Multiple static calls for the same adUnitId share the same native slot.
|
|
84
|
+
|
|
85
|
+
private static _getLegacyRequestId(adUnitId: string): number {
|
|
86
|
+
let requestId = InterstitialAd._legacyRequestIds.get(adUnitId);
|
|
87
|
+
if (requestId === undefined) {
|
|
88
|
+
requestId = InterstitialAd._nextRequestId++;
|
|
89
|
+
InterstitialAd._legacyRequestIds.set(adUnitId, requestId);
|
|
90
|
+
InterstitialAd._legacyRequestIdSet.add(requestId);
|
|
91
|
+
}
|
|
92
|
+
return requestId;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private static _addLegacyEventListener<T>(
|
|
96
|
+
event: string,
|
|
97
|
+
listener: (info: T) => void
|
|
98
|
+
): void {
|
|
99
|
+
addEventListener(event, (payload: any) => {
|
|
100
|
+
if (!InterstitialAd._legacyRequestIdSet.has(payload?.requestId)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
listener(payload);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
76
106
|
|
|
77
107
|
/** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
|
|
78
108
|
static isAdReady(adUnitId: string): Promise<boolean> {
|
|
79
|
-
|
|
109
|
+
const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
|
|
110
|
+
return NativeDaroModule.isInterstitialReady(requestId, adUnitId);
|
|
80
111
|
}
|
|
81
112
|
|
|
82
113
|
/** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
|
|
83
114
|
static loadAd(adUnitId: string): void {
|
|
84
|
-
|
|
115
|
+
const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
|
|
116
|
+
NativeDaroModule.loadInterstitial(requestId, adUnitId);
|
|
85
117
|
}
|
|
86
118
|
|
|
87
119
|
/** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
|
|
88
120
|
static showAd(adUnitId: string): void {
|
|
89
|
-
|
|
121
|
+
const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
|
|
122
|
+
NativeDaroModule.showInterstitial(requestId, adUnitId);
|
|
90
123
|
}
|
|
91
124
|
|
|
92
125
|
/** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
|
|
93
126
|
static addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
94
|
-
|
|
127
|
+
InterstitialAd._addLegacyEventListener(
|
|
128
|
+
ON_INTERSTITIAL_LOADED_EVENT,
|
|
129
|
+
listener
|
|
130
|
+
);
|
|
95
131
|
}
|
|
96
132
|
|
|
97
133
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -103,7 +139,10 @@ export class InterstitialAd {
|
|
|
103
139
|
static addAdLoadFailedEventListener(
|
|
104
140
|
listener: (errorInfo: AdLoadFailedInfo) => void
|
|
105
141
|
): void {
|
|
106
|
-
|
|
142
|
+
InterstitialAd._addLegacyEventListener(
|
|
143
|
+
ON_INTERSTITIAL_LOAD_FAILED_EVENT,
|
|
144
|
+
listener
|
|
145
|
+
);
|
|
107
146
|
}
|
|
108
147
|
|
|
109
148
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -113,7 +152,10 @@ export class InterstitialAd {
|
|
|
113
152
|
|
|
114
153
|
/** @deprecated `addAdEventListener(AdEventType.CLICKED, ...)`를 인스턴스에서 사용하세요. */
|
|
115
154
|
static addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
116
|
-
|
|
155
|
+
InterstitialAd._addLegacyEventListener(
|
|
156
|
+
ON_INTERSTITIAL_CLICKED_EVENT,
|
|
157
|
+
listener
|
|
158
|
+
);
|
|
117
159
|
}
|
|
118
160
|
|
|
119
161
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -123,7 +165,10 @@ export class InterstitialAd {
|
|
|
123
165
|
|
|
124
166
|
/** @deprecated `addAdEventListener(AdEventType.DISPLAYED, ...)`를 인스턴스에서 사용하세요. */
|
|
125
167
|
static addAdDisplayedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
126
|
-
|
|
168
|
+
InterstitialAd._addLegacyEventListener(
|
|
169
|
+
ON_INTERSTITIAL_DISPLAYED_EVENT,
|
|
170
|
+
listener
|
|
171
|
+
);
|
|
127
172
|
}
|
|
128
173
|
|
|
129
174
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -135,7 +180,10 @@ export class InterstitialAd {
|
|
|
135
180
|
static addAdFailedToDisplayEventListener(
|
|
136
181
|
listener: (errorInfo: AdDisplayFailedInfo) => void
|
|
137
182
|
): void {
|
|
138
|
-
|
|
183
|
+
InterstitialAd._addLegacyEventListener(
|
|
184
|
+
ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT,
|
|
185
|
+
listener
|
|
186
|
+
);
|
|
139
187
|
}
|
|
140
188
|
|
|
141
189
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -145,7 +193,10 @@ export class InterstitialAd {
|
|
|
145
193
|
|
|
146
194
|
/** @deprecated `addAdEventListener(AdEventType.HIDDEN, ...)`를 인스턴스에서 사용하세요. */
|
|
147
195
|
static addAdHiddenEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
148
|
-
|
|
196
|
+
InterstitialAd._addLegacyEventListener(
|
|
197
|
+
ON_INTERSTITIAL_HIDDEN_EVENT,
|
|
198
|
+
listener
|
|
199
|
+
);
|
|
149
200
|
}
|
|
150
201
|
|
|
151
202
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -157,7 +208,10 @@ export class InterstitialAd {
|
|
|
157
208
|
static addAdImpressionRecordedListener(
|
|
158
209
|
listener: (adInfo: AdInfo) => void
|
|
159
210
|
): void {
|
|
160
|
-
|
|
211
|
+
InterstitialAd._addLegacyEventListener(
|
|
212
|
+
ON_INTERSTITIAL_AD_IMPRESSION_RECORDED,
|
|
213
|
+
listener
|
|
214
|
+
);
|
|
161
215
|
}
|
|
162
216
|
|
|
163
217
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
package/src/LightPopupAd.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { processColor, type ColorValue } from 'react-native';
|
|
2
2
|
import {
|
|
3
3
|
addEventListener,
|
|
4
4
|
removeEventListener,
|
|
5
5
|
AdEventEmitter,
|
|
6
6
|
} from './EventEmitter';
|
|
7
|
+
import NativeDaroModule from './NativeDaroModule';
|
|
7
8
|
import type {
|
|
8
9
|
AdDisplayFailedInfo,
|
|
9
10
|
AdInfo,
|
|
@@ -11,9 +12,6 @@ import type {
|
|
|
11
12
|
} from './types/AdInfo';
|
|
12
13
|
import type { LightPopupAdConfiguration } from './types/LightPopupAd';
|
|
13
14
|
import { AdEventType, type AdEventPayloadMap } from './types/AdEvent';
|
|
14
|
-
import tinycolor from 'tinycolor2';
|
|
15
|
-
|
|
16
|
-
const { DaroMModule } = NativeModules;
|
|
17
15
|
|
|
18
16
|
const {
|
|
19
17
|
ON_LIGHTPOPUP_LOADED_EVENT,
|
|
@@ -23,7 +21,7 @@ const {
|
|
|
23
21
|
ON_LIGHTPOPUP_AD_FAILED_TO_DISPLAY_EVENT,
|
|
24
22
|
ON_LIGHTPOPUP_HIDDEN_EVENT,
|
|
25
23
|
ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED,
|
|
26
|
-
} =
|
|
24
|
+
} = NativeDaroModule.getConstants();
|
|
27
25
|
|
|
28
26
|
const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
|
|
29
27
|
[AdEventType.LOADED]: ON_LIGHTPOPUP_LOADED_EVENT,
|
|
@@ -35,35 +33,28 @@ const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
|
|
|
35
33
|
[AdEventType.IMPRESSION_RECORDED]: ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED,
|
|
36
34
|
};
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
// #AARRGGBB로 변환
|
|
42
|
-
return `#${color.toString(16).padStart(8, '0')}`.toUpperCase();
|
|
43
|
-
}
|
|
44
|
-
if (typeof color === 'string') {
|
|
45
|
-
const tc = tinycolor(color);
|
|
46
|
-
if (tc.isValid()) {
|
|
47
|
-
// alpha가 1이면 #RRGGBB, 아니면 #AARRGGBB
|
|
48
|
-
const hex = tc.toHexString().toUpperCase();
|
|
49
|
-
const alpha = Math.round(tc.getAlpha() * 255);
|
|
50
|
-
if (alpha === 255) {
|
|
51
|
-
return hex;
|
|
52
|
-
} else {
|
|
53
|
-
return (
|
|
54
|
-
'#' +
|
|
55
|
-
alpha.toString(16).padStart(2, '0').toUpperCase() +
|
|
56
|
-
tc.toHex().toUpperCase()
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
36
|
+
const colorToHex = (color: ColorValue | undefined): string | undefined => {
|
|
37
|
+
if (color === undefined || color === null) {
|
|
38
|
+
return undefined;
|
|
60
39
|
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
40
|
|
|
64
|
-
|
|
41
|
+
const processedColor = processColor(color);
|
|
42
|
+
if (typeof processedColor !== 'number') {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const argb = processedColor >>> 0;
|
|
47
|
+
const alpha = (argb >>> 24) & 0xff;
|
|
48
|
+
if (alpha === 0xff) {
|
|
49
|
+
return `#${(argb & 0x00ffffff).toString(16).padStart(6, '0')}`.toUpperCase();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return `#${argb.toString(16).padStart(8, '0')}`.toUpperCase();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const normalizeConfiguration = (
|
|
65
56
|
configuration: LightPopupAdConfiguration
|
|
66
|
-
): LightPopupAdConfiguration {
|
|
57
|
+
): LightPopupAdConfiguration => {
|
|
67
58
|
const config = { ...configuration };
|
|
68
59
|
|
|
69
60
|
if (config.backgroundColor)
|
|
@@ -91,31 +82,40 @@ function normalizeConfiguration(
|
|
|
91
82
|
);
|
|
92
83
|
|
|
93
84
|
return config;
|
|
94
|
-
}
|
|
85
|
+
};
|
|
95
86
|
|
|
96
87
|
export class LightPopupAd {
|
|
88
|
+
private static _nextRequestId = 1;
|
|
89
|
+
private static _legacyRequestIds = new Map<string, number>();
|
|
90
|
+
private static _legacyRequestIdSet = new Set<number>();
|
|
91
|
+
|
|
97
92
|
private readonly eventEmitter = new AdEventEmitter();
|
|
98
93
|
|
|
99
|
-
private constructor(
|
|
94
|
+
private constructor(
|
|
95
|
+
private readonly requestId: number,
|
|
96
|
+
private readonly adUnitId: string
|
|
97
|
+
) {}
|
|
100
98
|
|
|
101
99
|
static createForAdRequest(adUnitId: string): LightPopupAd {
|
|
102
|
-
|
|
100
|
+
const requestId = LightPopupAd._nextRequestId++;
|
|
101
|
+
return new LightPopupAd(requestId, adUnitId);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
isAdReady(): Promise<boolean> {
|
|
106
|
-
return
|
|
105
|
+
return NativeDaroModule.isLightPopupReady(this.requestId, this.adUnitId);
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
load(): void {
|
|
110
|
-
|
|
109
|
+
NativeDaroModule.loadLightPopup(this.requestId, this.adUnitId);
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
show(): void {
|
|
114
|
-
|
|
113
|
+
NativeDaroModule.showLightPopup(this.requestId, this.adUnitId);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
setConfiguration(configuration: LightPopupAdConfiguration): void {
|
|
118
|
-
|
|
117
|
+
NativeDaroModule.setLightPopupAdConfiguration(
|
|
118
|
+
this.requestId,
|
|
119
119
|
this.adUnitId,
|
|
120
120
|
normalizeConfiguration(configuration)
|
|
121
121
|
);
|
|
@@ -126,9 +126,9 @@ export class LightPopupAd {
|
|
|
126
126
|
listener: (info: AdEventPayloadMap[T]) => void
|
|
127
127
|
): () => void {
|
|
128
128
|
const nativeEvent = NATIVE_EVENT_BY_TYPE[type];
|
|
129
|
-
const
|
|
129
|
+
const requestId = this.requestId;
|
|
130
130
|
return this.eventEmitter.addEventListener(nativeEvent, (payload: any) => {
|
|
131
|
-
if (payload?.
|
|
131
|
+
if (payload?.requestId !== requestId) {
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
listener(payload);
|
|
@@ -141,19 +141,44 @@ export class LightPopupAd {
|
|
|
141
141
|
|
|
142
142
|
// ---- Deprecated static API (backward compatibility) ----
|
|
143
143
|
|
|
144
|
+
private static _getLegacyRequestId(adUnitId: string): number {
|
|
145
|
+
let requestId = LightPopupAd._legacyRequestIds.get(adUnitId);
|
|
146
|
+
if (requestId === undefined) {
|
|
147
|
+
requestId = LightPopupAd._nextRequestId++;
|
|
148
|
+
LightPopupAd._legacyRequestIds.set(adUnitId, requestId);
|
|
149
|
+
LightPopupAd._legacyRequestIdSet.add(requestId);
|
|
150
|
+
}
|
|
151
|
+
return requestId;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private static _addLegacyEventListener<T>(
|
|
155
|
+
event: string,
|
|
156
|
+
listener: (info: T) => void
|
|
157
|
+
): void {
|
|
158
|
+
addEventListener(event, (payload: any) => {
|
|
159
|
+
if (!LightPopupAd._legacyRequestIdSet.has(payload?.requestId)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
listener(payload);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
144
166
|
/** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
|
|
145
167
|
static isAdReady(adUnitId: string): Promise<boolean> {
|
|
146
|
-
|
|
168
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
|
|
169
|
+
return NativeDaroModule.isLightPopupReady(requestId, adUnitId);
|
|
147
170
|
}
|
|
148
171
|
|
|
149
172
|
/** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
|
|
150
173
|
static loadAd(adUnitId: string): void {
|
|
151
|
-
|
|
174
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
|
|
175
|
+
NativeDaroModule.loadLightPopup(requestId, adUnitId);
|
|
152
176
|
}
|
|
153
177
|
|
|
154
178
|
/** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
|
|
155
179
|
static showAd(adUnitId: string): void {
|
|
156
|
-
|
|
180
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
|
|
181
|
+
NativeDaroModule.showLightPopup(requestId, adUnitId);
|
|
157
182
|
}
|
|
158
183
|
|
|
159
184
|
/** @deprecated 인스턴스의 `setConfiguration()`을 사용하세요. */
|
|
@@ -161,7 +186,9 @@ export class LightPopupAd {
|
|
|
161
186
|
adUnitId: string,
|
|
162
187
|
configuration: LightPopupAdConfiguration
|
|
163
188
|
): void {
|
|
164
|
-
|
|
189
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
|
|
190
|
+
NativeDaroModule.setLightPopupAdConfiguration(
|
|
191
|
+
requestId,
|
|
165
192
|
adUnitId,
|
|
166
193
|
normalizeConfiguration(configuration)
|
|
167
194
|
);
|
|
@@ -169,7 +196,7 @@ export class LightPopupAd {
|
|
|
169
196
|
|
|
170
197
|
/** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
|
|
171
198
|
static addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
172
|
-
|
|
199
|
+
LightPopupAd._addLegacyEventListener(ON_LIGHTPOPUP_LOADED_EVENT, listener);
|
|
173
200
|
}
|
|
174
201
|
|
|
175
202
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -181,7 +208,10 @@ export class LightPopupAd {
|
|
|
181
208
|
static addAdLoadFailedEventListener(
|
|
182
209
|
listener: (errorInfo: AdLoadFailedInfo) => void
|
|
183
210
|
): void {
|
|
184
|
-
|
|
211
|
+
LightPopupAd._addLegacyEventListener(
|
|
212
|
+
ON_LIGHTPOPUP_LOAD_FAILED_EVENT,
|
|
213
|
+
listener
|
|
214
|
+
);
|
|
185
215
|
}
|
|
186
216
|
|
|
187
217
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -191,7 +221,7 @@ export class LightPopupAd {
|
|
|
191
221
|
|
|
192
222
|
/** @deprecated `addAdEventListener(AdEventType.CLICKED, ...)`를 인스턴스에서 사용하세요. */
|
|
193
223
|
static addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
194
|
-
|
|
224
|
+
LightPopupAd._addLegacyEventListener(ON_LIGHTPOPUP_CLICKED_EVENT, listener);
|
|
195
225
|
}
|
|
196
226
|
|
|
197
227
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -201,7 +231,10 @@ export class LightPopupAd {
|
|
|
201
231
|
|
|
202
232
|
/** @deprecated `addAdEventListener(AdEventType.DISPLAYED, ...)`를 인스턴스에서 사용하세요. */
|
|
203
233
|
static addAdDisplayedEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
204
|
-
|
|
234
|
+
LightPopupAd._addLegacyEventListener(
|
|
235
|
+
ON_LIGHTPOPUP_DISPLAYED_EVENT,
|
|
236
|
+
listener
|
|
237
|
+
);
|
|
205
238
|
}
|
|
206
239
|
|
|
207
240
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -213,7 +246,10 @@ export class LightPopupAd {
|
|
|
213
246
|
static addAdFailedToDisplayEventListener(
|
|
214
247
|
listener: (errorInfo: AdDisplayFailedInfo) => void
|
|
215
248
|
): void {
|
|
216
|
-
|
|
249
|
+
LightPopupAd._addLegacyEventListener(
|
|
250
|
+
ON_LIGHTPOPUP_AD_FAILED_TO_DISPLAY_EVENT,
|
|
251
|
+
listener
|
|
252
|
+
);
|
|
217
253
|
}
|
|
218
254
|
|
|
219
255
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -223,7 +259,7 @@ export class LightPopupAd {
|
|
|
223
259
|
|
|
224
260
|
/** @deprecated `addAdEventListener(AdEventType.HIDDEN, ...)`를 인스턴스에서 사용하세요. */
|
|
225
261
|
static addAdHiddenEventListener(listener: (adInfo: AdInfo) => void): void {
|
|
226
|
-
|
|
262
|
+
LightPopupAd._addLegacyEventListener(ON_LIGHTPOPUP_HIDDEN_EVENT, listener);
|
|
227
263
|
}
|
|
228
264
|
|
|
229
265
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -235,7 +271,10 @@ export class LightPopupAd {
|
|
|
235
271
|
static addAdImpressionRecordedListener(
|
|
236
272
|
listener: (adInfo: AdInfo) => void
|
|
237
273
|
): void {
|
|
238
|
-
|
|
274
|
+
LightPopupAd._addLegacyEventListener(
|
|
275
|
+
ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED,
|
|
276
|
+
listener
|
|
277
|
+
);
|
|
239
278
|
}
|
|
240
279
|
|
|
241
280
|
/** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
Double,
|
|
5
|
+
UnsafeObject,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export type DaroModuleConstants = {
|
|
9
|
+
ON_INTERSTITIAL_LOADED_EVENT: string;
|
|
10
|
+
ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
|
|
11
|
+
ON_INTERSTITIAL_CLICKED_EVENT: string;
|
|
12
|
+
ON_INTERSTITIAL_DISPLAYED_EVENT: string;
|
|
13
|
+
ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT: string;
|
|
14
|
+
ON_INTERSTITIAL_HIDDEN_EVENT: string;
|
|
15
|
+
ON_INTERSTITIAL_AD_IMPRESSION_RECORDED: string;
|
|
16
|
+
|
|
17
|
+
ON_REWARDED_AD_LOADED_EVENT: string;
|
|
18
|
+
ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
|
|
19
|
+
ON_REWARDED_AD_CLICKED_EVENT: string;
|
|
20
|
+
ON_REWARDED_AD_DISPLAYED_EVENT: string;
|
|
21
|
+
ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT: string;
|
|
22
|
+
ON_REWARDED_AD_HIDDEN_EVENT: string;
|
|
23
|
+
ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
|
|
24
|
+
ON_REWARDED_AD_IMPRESSION_RECORDED: string;
|
|
25
|
+
|
|
26
|
+
ON_APPOPEN_AD_LOADED_EVENT: string;
|
|
27
|
+
ON_APPOPEN_AD_LOAD_FAILED_EVENT: string;
|
|
28
|
+
ON_APPOPEN_AD_CLICKED_EVENT: string;
|
|
29
|
+
ON_APPOPEN_AD_DISPLAYED_EVENT: string;
|
|
30
|
+
ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT: string;
|
|
31
|
+
ON_APPOPEN_AD_HIDDEN_EVENT: string;
|
|
32
|
+
ON_APPOPEN_AD_IMPRESSION_RECORDED: string;
|
|
33
|
+
|
|
34
|
+
ON_LIGHTPOPUP_LOADED_EVENT: string;
|
|
35
|
+
ON_LIGHTPOPUP_LOAD_FAILED_EVENT: string;
|
|
36
|
+
ON_LIGHTPOPUP_CLICKED_EVENT: string;
|
|
37
|
+
ON_LIGHTPOPUP_DISPLAYED_EVENT: string;
|
|
38
|
+
ON_LIGHTPOPUP_AD_FAILED_TO_DISPLAY_EVENT: string;
|
|
39
|
+
ON_LIGHTPOPUP_HIDDEN_EVENT: string;
|
|
40
|
+
ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED: string;
|
|
41
|
+
|
|
42
|
+
BANNER_AD_FORMAT_LABEL: string;
|
|
43
|
+
MREC_AD_FORMAT_LABEL: string;
|
|
44
|
+
UNKNOWN_AD_FORMAT_LABEL?: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface Spec extends TurboModule {
|
|
48
|
+
getConstants: () => DaroModuleConstants;
|
|
49
|
+
addListener: (eventName: string) => void;
|
|
50
|
+
removeListeners: (count: number) => void;
|
|
51
|
+
|
|
52
|
+
isInitialized: () => Promise<boolean>;
|
|
53
|
+
initializeSdk: () => Promise<void>;
|
|
54
|
+
setUserId: (userId: string) => Promise<void>;
|
|
55
|
+
showMediationDebugger: () => Promise<void>;
|
|
56
|
+
|
|
57
|
+
isInterstitialReady: (
|
|
58
|
+
requestId: Double,
|
|
59
|
+
adUnitId: string
|
|
60
|
+
) => Promise<boolean>;
|
|
61
|
+
loadInterstitial: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
62
|
+
showInterstitial: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
63
|
+
|
|
64
|
+
isRewardedAdReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
|
|
65
|
+
loadRewardedAd: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
66
|
+
showRewardedAd: (
|
|
67
|
+
requestId: Double,
|
|
68
|
+
adUnitId: string,
|
|
69
|
+
customData?: string | null
|
|
70
|
+
) => Promise<void>;
|
|
71
|
+
|
|
72
|
+
isAppOpenAdReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
|
|
73
|
+
loadAppOpenAd: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
74
|
+
showAppOpenAd: (
|
|
75
|
+
requestId: Double,
|
|
76
|
+
adUnitId: string,
|
|
77
|
+
placement?: string | null,
|
|
78
|
+
customData?: string | null
|
|
79
|
+
) => Promise<void>;
|
|
80
|
+
|
|
81
|
+
isLightPopupReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
|
|
82
|
+
loadLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
83
|
+
showLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
84
|
+
setLightPopupAdConfiguration: (
|
|
85
|
+
requestId: Double,
|
|
86
|
+
adUnitId: string,
|
|
87
|
+
configuration: UnsafeObject
|
|
88
|
+
) => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('DaroMModule');
|