react-native-daro 2.0.7 → 2.0.9-rc.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.
- package/README.md +2 -2
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +8 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNAdNativeViewManager.kt +8 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +76 -34
- package/android/src/main/java/com/daro/reactnative/event/DaroRNEvent.kt +8 -0
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNInterstitialModuleImpl.kt +13 -13
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNLightPopupModuleImpl.kt +12 -12
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNPreloadModuleImpl.kt +77 -0
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNRewardedAdModuleImpl.kt +14 -14
- package/android/src/main/java/com/daro/reactnative/preload/DaroRNPreloadRegistry.kt +57 -0
- package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +27 -16
- package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +3 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdBannerViewContainer.kt +36 -15
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdNativeViewContainer.kt +36 -15
- package/android/src/oldarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +28 -14
- package/android/src/test/java/com/daro/reactnative/preload/DaroRNPreloadRegistryTest.kt +65 -0
- package/android/src/test/java/com/daro/reactnative/view/DaroMediaViewTest.kt +45 -0
- package/android/src/test/java/com/daro/reactnative/view/DaroRNPreloadFirstLoadTest.kt +160 -0
- package/ios/DaroRNModule+AppOpen.swift +9 -9
- package/ios/DaroRNModule+Interstitial.swift +9 -9
- package/ios/DaroRNModule+LightPopup.swift +13 -13
- package/ios/DaroRNModule+Preload.swift +122 -0
- package/ios/DaroRNModule+Rewarded.swift +14 -14
- package/ios/DaroRNModule.mm +20 -14
- package/ios/DaroRNModule.swift +6 -1
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +12 -7
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +12 -7
- package/ios/Paper/DaroRNAdBannerViewManager.m +2 -1
- package/ios/Paper/DaroRNNativeAdViewManager.m +2 -1
- package/ios/Shared/DaroRNBannerAdView.swift +23 -9
- package/ios/Shared/DaroRNNativeAdView.swift +77 -46
- package/ios/Shared/DaroRNPreloadRegistry.swift +54 -0
- package/lib/commonjs/AdBannerView.js +4 -2
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AdPreload.js +105 -0
- package/lib/commonjs/AdPreload.js.map +1 -0
- package/lib/commonjs/AppOpenAd.js +22 -22
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroRNAdBannerViewNativeComponent.ts +5 -3
- package/lib/commonjs/DaroRNNativeAdViewNativeComponent.ts +5 -3
- package/lib/commonjs/InterstitialAd.js +24 -24
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +27 -27
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js.map +1 -1
- package/lib/commonjs/RewardedAd.js +22 -22
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/hooks/useAdPreload.js +61 -0
- package/lib/commonjs/hooks/useAdPreload.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +6 -6
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -1
- package/lib/commonjs/hooks/useLightPopupAd.js +5 -5
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -1
- package/lib/commonjs/hooks/useRewardedAd.js +6 -6
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
- package/lib/commonjs/index.js +37 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +4 -2
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/types/NativeAdViewProps.js.map +1 -1
- package/lib/module/AdBannerView.js +4 -2
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AdPreload.js +98 -0
- package/lib/module/AdPreload.js.map +1 -0
- package/lib/module/AppOpenAd.js +22 -22
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroRNAdBannerViewNativeComponent.ts +5 -3
- package/lib/module/DaroRNNativeAdViewNativeComponent.ts +5 -3
- package/lib/module/InterstitialAd.js +24 -24
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +27 -27
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js.map +1 -1
- package/lib/module/RewardedAd.js +22 -22
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/hooks/useAdPreload.js +56 -0
- package/lib/module/hooks/useAdPreload.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +6 -6
- package/lib/module/hooks/useInterstitialAd.js.map +1 -1
- package/lib/module/hooks/useLightPopupAd.js +5 -5
- package/lib/module/hooks/useLightPopupAd.js.map +1 -1
- package/lib/module/hooks/useRewardedAd.js +6 -6
- package/lib/module/hooks/useRewardedAd.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +4 -2
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/types/NativeAdViewProps.js.map +1 -1
- package/lib/typescript/commonjs/src/AdBannerView.d.ts +1 -0
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AdPreload.d.ts +62 -0
- package/lib/typescript/commonjs/src/AdPreload.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts +4 -3
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts +4 -3
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +9 -9
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +19 -14
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RewardedAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAdPreload.d.ts +19 -0
- package/lib/typescript/commonjs/src/hooks/useAdPreload.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts +6 -0
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +6 -0
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/module/src/AdBannerView.d.ts +1 -0
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AdPreload.d.ts +62 -0
- package/lib/typescript/module/src/AdPreload.d.ts.map +1 -0
- package/lib/typescript/module/src/AppOpenAd.d.ts +8 -8
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts +4 -3
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts +4 -3
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts +8 -8
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts +9 -9
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +19 -14
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/module/src/RewardedAd.d.ts +8 -8
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAdPreload.d.ts +19 -0
- package/lib/typescript/module/src/hooks/useAdPreload.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts +6 -0
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts +2 -2
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +6 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withAndroid.js +2 -2
- package/react-native-daro.podspec +1 -1
- package/src/AdBannerView.tsx +4 -2
- package/src/AdPreload.ts +141 -0
- package/src/AppOpenAd.ts +21 -21
- package/src/DaroRNAdBannerViewNativeComponent.ts +5 -3
- package/src/DaroRNNativeAdViewNativeComponent.ts +5 -3
- package/src/InterstitialAd.ts +23 -23
- package/src/LightPopupAd.ts +26 -26
- package/src/NativeDaroModule.ts +31 -14
- package/src/RewardedAd.ts +21 -21
- package/src/hooks/useAdPreload.ts +82 -0
- package/src/hooks/useInterstitialAd.ts +6 -6
- package/src/hooks/useLightPopupAd.ts +5 -5
- package/src/hooks/useRewardedAd.ts +6 -6
- package/src/index.tsx +16 -0
- package/src/nativeAd/NativeAdView.tsx +4 -2
- package/src/types/AdBannerViewProps.ts +6 -0
- package/src/types/AdInfo.ts +2 -2
- package/src/types/AdProps.ts +1 -1
- package/src/types/NativeAdViewProps.ts +6 -0
|
@@ -26,36 +26,36 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
26
26
|
private val rewardedAdMap: MutableMap<Int, DaroRewardedAd> = mutableMapOf()
|
|
27
27
|
private val loaderMap: MutableMap<Int, DaroRewardedAdLoader> = mutableMapOf()
|
|
28
28
|
|
|
29
|
-
override fun isRewardedAdReady(requestId: Int,
|
|
29
|
+
override fun isRewardedAdReady(requestId: Int, adUnitKey: String, promise: Promise) {
|
|
30
30
|
promise.resolve(retrieveAd(requestId) != null)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
override fun loadRewardedAd(requestId: Int,
|
|
34
|
-
retrieveLoader(requestId,
|
|
33
|
+
override fun loadRewardedAd(requestId: Int, adUnitKey: String) {
|
|
34
|
+
retrieveLoader(requestId, adUnitKey).load()
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
override fun showRewardedAd(requestId: Int,
|
|
37
|
+
override fun showRewardedAd(requestId: Int, adUnitKey: String, customData: String?) {
|
|
38
38
|
currentActivity?.let { activity ->
|
|
39
39
|
retrieveAd(requestId)?.apply {
|
|
40
40
|
setListener(object : DaroRewardedAdListener {
|
|
41
41
|
override fun onAdImpression(adInfo: DaroAdInfo) {
|
|
42
42
|
sendNativeEvent(
|
|
43
43
|
event = RewardedEvent.ON_REWARDED_AD_IMPRESSION_RECORDED,
|
|
44
|
-
params = AdInfoUtil.getAdInfo(requestId,
|
|
44
|
+
params = AdInfoUtil.getAdInfo(requestId, adUnitKey, adInfo),
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
override fun onAdClicked(adInfo: DaroAdInfo) {
|
|
49
49
|
sendNativeEvent(
|
|
50
50
|
event = RewardedEvent.ON_REWARDED_AD_CLICKED_EVENT,
|
|
51
|
-
params = AdInfoUtil.getAdInfo(requestId,
|
|
51
|
+
params = AdInfoUtil.getAdInfo(requestId, adUnitKey, adInfo),
|
|
52
52
|
)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
override fun onDismiss(adInfo: DaroAdInfo) {
|
|
56
56
|
sendNativeEvent(
|
|
57
57
|
event = RewardedEvent.ON_REWARDED_AD_HIDDEN_EVENT,
|
|
58
|
-
params = AdInfoUtil.getAdInfo(requestId,
|
|
58
|
+
params = AdInfoUtil.getAdInfo(requestId, adUnitKey, adInfo),
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -65,7 +65,7 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
65
65
|
) {
|
|
66
66
|
sendNativeEvent(
|
|
67
67
|
event = RewardedEvent.ON_REWARDED_AD_RECEIVED_REWARD_EVENT,
|
|
68
|
-
params = AdInfoUtil.getRewardInfo(requestId,
|
|
68
|
+
params = AdInfoUtil.getRewardInfo(requestId, adUnitKey, rewardItem),
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -75,14 +75,14 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
75
75
|
) {
|
|
76
76
|
sendNativeEvent(
|
|
77
77
|
event = RewardedEvent.ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT,
|
|
78
|
-
params = AdInfoUtil.getAdDisplayFailedInfo(requestId,
|
|
78
|
+
params = AdInfoUtil.getAdDisplayFailedInfo(requestId, adUnitKey, adInfo, error),
|
|
79
79
|
)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
override fun onShown(adInfo: DaroAdInfo) {
|
|
83
83
|
sendNativeEvent(
|
|
84
84
|
event = RewardedEvent.ON_REWARDED_AD_DISPLAYED_EVENT,
|
|
85
|
-
params = AdInfoUtil.getAdInfo(requestId,
|
|
85
|
+
params = AdInfoUtil.getAdInfo(requestId, adUnitKey, adInfo),
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
rewardedAdMap.remove(requestId)
|
|
@@ -97,10 +97,10 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
private fun retrieveLoader(requestId: Int,
|
|
100
|
+
private fun retrieveLoader(requestId: Int, adUnitKey: String): DaroRewardedAdLoader {
|
|
101
101
|
return loaderMap[requestId] ?: DaroRewardedAdLoader(
|
|
102
102
|
context,
|
|
103
|
-
DaroRewardedAdUnit(
|
|
103
|
+
DaroRewardedAdUnit(adUnitKey)
|
|
104
104
|
).also {
|
|
105
105
|
loaderMap[requestId] = it
|
|
106
106
|
it.setListener(
|
|
@@ -108,7 +108,7 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
108
108
|
override fun onAdLoadFail(err: DaroAdLoadError) {
|
|
109
109
|
sendNativeEvent(
|
|
110
110
|
event = RewardedEvent.ON_REWARDED_AD_LOAD_FAILED_EVENT,
|
|
111
|
-
params = AdInfoUtil.getAdLoadFailedInfo(requestId,
|
|
111
|
+
params = AdInfoUtil.getAdLoadFailedInfo(requestId, adUnitKey, err),
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -120,7 +120,7 @@ internal class DaroRNRewardedAdModuleImpl(
|
|
|
120
120
|
|
|
121
121
|
sendNativeEvent(
|
|
122
122
|
event = RewardedEvent.ON_REWARDED_AD_LOADED_EVENT,
|
|
123
|
-
params = AdInfoUtil.getAdInfo(requestId,
|
|
123
|
+
params = AdInfoUtil.getAdInfo(requestId, adUnitKey, adInfo),
|
|
124
124
|
)
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
package com.daro.reactnative.preload
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `preloadId` 로 preload 컨트롤러를 들고 있다가 뷰가 마운트될 때 한 번 넘긴다.
|
|
5
|
+
*
|
|
6
|
+
* - 넘긴 항목은 레지스트리에서 빠진다. 그 뒤의 정리는 가져간 뷰의 몫이다.
|
|
7
|
+
* - 광고 유닛이나 포맷이 뷰와 다르면 넘기지 않고 정리한다 — 뷰는 일반 로드를 한다.
|
|
8
|
+
* - RN 은 Activity 하나 위에서 화면을 바꾸므로 SDK 의 Activity 파괴 정리에 기대지 않는다.
|
|
9
|
+
* 안 쓴 항목은 JS 의 `destroy()` 와 모듈 invalidate 가 정리한다.
|
|
10
|
+
*
|
|
11
|
+
* UI 스레드에서만 부른다.
|
|
12
|
+
*/
|
|
13
|
+
internal class DaroRNPreloadRegistry {
|
|
14
|
+
class Entry<C : Any>(
|
|
15
|
+
val adUnitKey: String,
|
|
16
|
+
/** 같은 유닛 안에서 갈리는 요청 조건 ( 배너 크기 ). 없으면 빈 문자열. */
|
|
17
|
+
val variant: String,
|
|
18
|
+
val controller: C,
|
|
19
|
+
private val onPreload: (C) -> Unit,
|
|
20
|
+
private val onDestroy: (C) -> Unit,
|
|
21
|
+
) {
|
|
22
|
+
fun preload() = onPreload(controller)
|
|
23
|
+
fun destroy() = onDestroy(controller)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private val entries = mutableMapOf<String, Entry<*>>()
|
|
27
|
+
|
|
28
|
+
/** 같은 id 로 다시 부르면 들고 있는 컨트롤러에 다시 요청한다. 중복과 TTL 판정은 SDK 가 한다. */
|
|
29
|
+
fun preload(preloadId: String, create: () -> Entry<*>) {
|
|
30
|
+
val entry = entries[preloadId] ?: create().also { entries[preloadId] = it }
|
|
31
|
+
entry.preload()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fun <C : Any> take(preloadId: String?, adUnitKey: String, variant: String, type: Class<C>): C? {
|
|
35
|
+
if (preloadId.isNullOrEmpty()) return null
|
|
36
|
+
val entry = entries.remove(preloadId) ?: return null
|
|
37
|
+
if (entry.adUnitKey != adUnitKey || entry.variant != variant || !type.isInstance(entry.controller)) {
|
|
38
|
+
entry.destroy()
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
return type.cast(entry.controller)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fun destroy(preloadId: String) {
|
|
45
|
+
entries.remove(preloadId)?.destroy()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
fun destroyAll() {
|
|
49
|
+
val remaining = entries.values.toList()
|
|
50
|
+
entries.clear()
|
|
51
|
+
remaining.forEach { it.destroy() }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
val shared = DaroRNPreloadRegistry()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -5,14 +5,15 @@ import com.facebook.react.bridge.WritableMap
|
|
|
5
5
|
import droom.daro.core.model.DaroAdDisplayFailError
|
|
6
6
|
import droom.daro.core.model.DaroAdInfo
|
|
7
7
|
import droom.daro.core.model.DaroAdLoadError
|
|
8
|
+
import droom.daro.core.model.DaroError
|
|
8
9
|
import droom.daro.core.model.DaroRewardedAd
|
|
9
10
|
|
|
10
11
|
internal object AdInfoUtil {
|
|
11
12
|
// 모듈 경로(전면·리워드·앱오픈·라이트팝업)와 뷰 경로(배너·네이티브)가 **둘 다 여기를
|
|
12
13
|
// 지난다.** 그래서 귀속을 여기 한 번만 실으면 모든 포맷이 같이 얻는다.
|
|
13
|
-
fun getAdInfo(
|
|
14
|
+
fun getAdInfo(adUnitKey: String, ad: DaroAdInfo): WritableMap {
|
|
14
15
|
val adInfo = Arguments.createMap()
|
|
15
|
-
adInfo.putString("
|
|
16
|
+
adInfo.putString("adUnitKey", adUnitKey)
|
|
16
17
|
adInfo.putInt("latencyMillis", ad.latency)
|
|
17
18
|
// SDK 가 정한 어휘를 **그대로** 넘긴다 — 래퍼에서 매핑하지 않는다. 발행 tarball 이
|
|
18
19
|
// android/ios 를 소스로 싣기 때문에 여기 매핑을 두면 그대로 읽힌다.
|
|
@@ -28,15 +29,15 @@ internal object AdInfoUtil {
|
|
|
28
29
|
return adInfo
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
fun getAdInfo(requestId: Int,
|
|
32
|
-
val adInfo = getAdInfo(
|
|
32
|
+
fun getAdInfo(requestId: Int, adUnitKey: String, ad: DaroAdInfo): WritableMap {
|
|
33
|
+
val adInfo = getAdInfo(adUnitKey, ad)
|
|
33
34
|
adInfo.putInt("requestId", requestId)
|
|
34
35
|
return adInfo
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
fun getAdLoadFailedInfo(
|
|
38
|
+
fun getAdLoadFailedInfo(adUnitKey: String?, error: DaroAdLoadError?): WritableMap {
|
|
38
39
|
val errInfo = Arguments.createMap()
|
|
39
|
-
errInfo.putString("
|
|
40
|
+
errInfo.putString("adUnitKey", adUnitKey)
|
|
40
41
|
|
|
41
42
|
if (error != null) {
|
|
42
43
|
errInfo.putInt("code", error.code)
|
|
@@ -49,38 +50,48 @@ internal object AdInfoUtil {
|
|
|
49
50
|
return errInfo
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
fun getAdLoadFailedInfo(requestId: Int,
|
|
53
|
-
val errInfo = getAdLoadFailedInfo(
|
|
53
|
+
fun getAdLoadFailedInfo(requestId: Int, adUnitKey: String?, error: DaroAdLoadError?): WritableMap {
|
|
54
|
+
val errInfo = getAdLoadFailedInfo(adUnitKey, error)
|
|
54
55
|
errInfo.putInt("requestId", requestId)
|
|
55
56
|
return errInfo
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
// preload 실패는 SDK 의 공통 오류 ( DaroError ) 로 온다. 기존 로드 실패와 같은 모양으로 싣는다.
|
|
60
|
+
fun getPreloadFailedInfo(adUnitKey: String, error: DaroError): WritableMap {
|
|
61
|
+
val errInfo = Arguments.createMap()
|
|
62
|
+
errInfo.putString("adUnitKey", adUnitKey)
|
|
63
|
+
errInfo.putInt("code", error.errorCode)
|
|
64
|
+
errInfo.putString("message", error.errorMessage)
|
|
65
|
+
errInfo.putInt("latencyMillis", 0)
|
|
66
|
+
return errInfo
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
fun getAdDisplayFailedInfo(adUnitKey: String, ad: DaroAdInfo, error: DaroAdDisplayFailError): WritableMap {
|
|
70
|
+
val info = getAdInfo(adUnitKey, ad)
|
|
60
71
|
|
|
61
72
|
info.putString("message", error.message)
|
|
62
73
|
|
|
63
74
|
return info
|
|
64
75
|
}
|
|
65
76
|
|
|
66
|
-
fun getAdDisplayFailedInfo(requestId: Int,
|
|
67
|
-
val info = getAdDisplayFailedInfo(
|
|
77
|
+
fun getAdDisplayFailedInfo(requestId: Int, adUnitKey: String, ad: DaroAdInfo, error: DaroAdDisplayFailError): WritableMap {
|
|
78
|
+
val info = getAdDisplayFailedInfo(adUnitKey, ad, error)
|
|
68
79
|
info.putInt("requestId", requestId)
|
|
69
80
|
return info
|
|
70
81
|
}
|
|
71
82
|
|
|
72
|
-
fun getRewardInfo(
|
|
83
|
+
fun getRewardInfo(adUnitKey: String, reward: DaroRewardedAd.DaroRewardedItem): WritableMap {
|
|
73
84
|
val adInfo = Arguments.createMap()
|
|
74
85
|
|
|
75
|
-
adInfo.putString("
|
|
86
|
+
adInfo.putString("adUnitKey", adUnitKey)
|
|
76
87
|
adInfo.putString("rewardLabel", reward.type)
|
|
77
88
|
adInfo.putInt("rewardAmount", reward.amount)
|
|
78
89
|
|
|
79
90
|
return adInfo
|
|
80
91
|
}
|
|
81
92
|
|
|
82
|
-
fun getRewardInfo(requestId: Int,
|
|
83
|
-
val info = getRewardInfo(
|
|
93
|
+
fun getRewardInfo(requestId: Int, adUnitKey: String, reward: DaroRewardedAd.DaroRewardedItem): WritableMap {
|
|
94
|
+
val info = getRewardInfo(adUnitKey, reward)
|
|
84
95
|
info.putInt("requestId", requestId)
|
|
85
96
|
return info
|
|
86
97
|
}
|
|
@@ -94,6 +94,9 @@ class DaroMediaView(context: Context) : FrameLayout(context) {
|
|
|
94
94
|
for (i in 0 until childCount) {
|
|
95
95
|
val child = getChildAt(i)
|
|
96
96
|
if (child.visibility == GONE) continue
|
|
97
|
+
// 창에 붙지 않은 자식은 재지 않는다. 광고 SDK 는 이 뷰가 창에 붙기 전에 미디어 뷰를 넣고,
|
|
98
|
+
// ComposeView 가 든 미디어는 window 없이 measure 하면 예외를 던진다. 붙은 뒤의 재배치가 처리한다.
|
|
99
|
+
if (!child.isAttachedToWindow) continue
|
|
97
100
|
|
|
98
101
|
forceLayoutRecursive(child)
|
|
99
102
|
child.measure(
|
|
@@ -9,6 +9,7 @@ import android.widget.FrameLayout
|
|
|
9
9
|
import androidx.core.view.children
|
|
10
10
|
import androidx.core.view.isVisible
|
|
11
11
|
import com.daro.reactnative.event.AdViewEvent
|
|
12
|
+
import com.daro.reactnative.preload.DaroRNPreloadRegistry
|
|
12
13
|
import com.daro.reactnative.util.AdInfoUtil
|
|
13
14
|
import com.daro.reactnative.util.EventEmitterUtil.sendNativeViewEvent
|
|
14
15
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -19,6 +20,7 @@ import droom.daro.core.model.DaroAdLoadError
|
|
|
19
20
|
import droom.daro.core.model.DaroBannerSize
|
|
20
21
|
import droom.daro.core.model.DaroViewAd
|
|
21
22
|
import droom.daro.view.DaroAdViewListener
|
|
23
|
+
import droom.daro.view.DaroBannerAdController
|
|
22
24
|
import droom.daro.view.DaroBannerAdView
|
|
23
25
|
|
|
24
26
|
@SuppressLint("ViewConstructor")
|
|
@@ -31,12 +33,16 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
31
33
|
|
|
32
34
|
private var adView: DaroBannerAdView? = null
|
|
33
35
|
|
|
34
|
-
internal var
|
|
36
|
+
internal var adUnitKey: String = ""
|
|
35
37
|
|
|
36
38
|
internal var adSize: DaroBannerSize? = null
|
|
37
39
|
|
|
38
40
|
internal var loadOnMount: Boolean = true
|
|
39
41
|
|
|
42
|
+
/** preload 로 받아 둔 광고의 id. 뷰를 처음 만들 때 한 번만 본다. */
|
|
43
|
+
internal var preloadId: String? = null
|
|
44
|
+
private var preloadController: DaroBannerAdController? = null
|
|
45
|
+
|
|
40
46
|
private var isAdVisible: Boolean = true
|
|
41
47
|
private var isAdPaused: Boolean = false
|
|
42
48
|
private var hasRequestedInitialLoad: Boolean = false
|
|
@@ -51,7 +57,8 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
51
57
|
private val visibleRect = Rect()
|
|
52
58
|
|
|
53
59
|
fun loadAd() {
|
|
54
|
-
|
|
60
|
+
val existing = adView
|
|
61
|
+
(existing ?: buildAdView())?.apply {
|
|
55
62
|
adView = this
|
|
56
63
|
|
|
57
64
|
if (this.parent == null) {
|
|
@@ -63,6 +70,10 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
layoutAdView()
|
|
73
|
+
// 받아 둔 광고를 넘겨받은 새 뷰는 화면에 붙을 때 SDK 가 그 광고를 쓴다. 여기서 loadAd 를
|
|
74
|
+
// 부르면 ( 지금이든, 크기가 준비된 뒤의 재시도든 ) SDK 의 처리가 끝난 뒤에는 새 요청이 되어
|
|
75
|
+
// 받아 둔 광고를 덮어쓴다. 그 뒤의 loadAd 는 재로드이므로 그대로 부른다.
|
|
76
|
+
if (existing == null && preloadController != null) return
|
|
66
77
|
if (!canLoadAd()) {
|
|
67
78
|
if (!hasPendingLoad) {
|
|
68
79
|
pendingLoadRetryCount = 0
|
|
@@ -84,17 +95,25 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
private fun buildAdView(): DaroBannerAdView? {
|
|
87
|
-
if (
|
|
98
|
+
if (adUnitKey.isEmpty() || adSize == null) {
|
|
88
99
|
return null
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
val bannerSize = adSize!!
|
|
103
|
+
// 받아 둔 광고는 컨트롤러와 같은 Activity 로 만든 뷰에만 넘어온다. 없으면 일반 로드다.
|
|
104
|
+
val activity = context.currentActivity
|
|
105
|
+
val controller = activity?.let {
|
|
106
|
+
DaroRNPreloadRegistry.shared.take(preloadId, adUnitKey, bannerSize.name, DaroBannerAdController::class.java)
|
|
107
|
+
}
|
|
108
|
+
preloadController = controller
|
|
109
|
+
|
|
110
|
+
val bannerView = if (activity != null && controller != null) {
|
|
111
|
+
DaroBannerAdView(activity, controller)
|
|
112
|
+
} else {
|
|
113
|
+
DaroBannerAdView(context, DaroBannerAdUnit(adUnitKey, bannerSize = bannerSize))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return bannerView.also { view ->
|
|
98
117
|
view.setListener(this)
|
|
99
118
|
view.setOnHierarchyChangeListener(object : ViewGroup.OnHierarchyChangeListener {
|
|
100
119
|
override fun onChildViewAdded(parent: View, child: View) {
|
|
@@ -125,6 +144,8 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
125
144
|
adView?.setOnHierarchyChangeListener(null)
|
|
126
145
|
adView?.destroy()
|
|
127
146
|
adView = null
|
|
147
|
+
preloadController?.destroy()
|
|
148
|
+
preloadController = null
|
|
128
149
|
}
|
|
129
150
|
|
|
130
151
|
fun setAdVisibility(visible: Boolean) {
|
|
@@ -161,7 +182,7 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
161
182
|
sendNativeViewEvent(
|
|
162
183
|
reactContext = context,
|
|
163
184
|
event = AdViewEvent.ON_AD_CLICKED,
|
|
164
|
-
params = AdInfoUtil.getAdInfo(
|
|
185
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
165
186
|
)
|
|
166
187
|
}
|
|
167
188
|
|
|
@@ -169,7 +190,7 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
169
190
|
sendNativeViewEvent(
|
|
170
191
|
reactContext = context,
|
|
171
192
|
event = AdViewEvent.ON_AD_IMPRESSION,
|
|
172
|
-
params = AdInfoUtil.getAdInfo(
|
|
193
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo),
|
|
173
194
|
)
|
|
174
195
|
}
|
|
175
196
|
|
|
@@ -177,7 +198,7 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
177
198
|
sendNativeViewEvent(
|
|
178
199
|
reactContext = context,
|
|
179
200
|
event = AdViewEvent.ON_AD_FAILED_TO_LOAD,
|
|
180
|
-
params = AdInfoUtil.getAdLoadFailedInfo(
|
|
201
|
+
params = AdInfoUtil.getAdLoadFailedInfo(adUnitKey, err),
|
|
181
202
|
)
|
|
182
203
|
}
|
|
183
204
|
|
|
@@ -190,7 +211,7 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
190
211
|
sendNativeViewEvent(
|
|
191
212
|
reactContext = context,
|
|
192
213
|
event = AdViewEvent.ON_AD_LOADED,
|
|
193
|
-
params = AdInfoUtil.getAdInfo(
|
|
214
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo),
|
|
194
215
|
)
|
|
195
216
|
|
|
196
217
|
post {
|
|
@@ -411,6 +432,6 @@ class DaroRNAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
411
432
|
}
|
|
412
433
|
|
|
413
434
|
private fun canBuildAdView(): Boolean {
|
|
414
|
-
return
|
|
435
|
+
return adUnitKey.isNotEmpty() && adSize != null
|
|
415
436
|
}
|
|
416
437
|
}
|
|
@@ -13,6 +13,7 @@ import android.widget.TextView
|
|
|
13
13
|
import androidx.annotation.IdRes
|
|
14
14
|
import androidx.core.view.children
|
|
15
15
|
import com.daro.reactnative.event.AdViewEvent
|
|
16
|
+
import com.daro.reactnative.preload.DaroRNPreloadRegistry
|
|
16
17
|
import com.daro.reactnative.util.AdInfoUtil
|
|
17
18
|
import com.daro.reactnative.util.EventEmitterUtil.sendNativeViewEvent
|
|
18
19
|
import com.facebook.react.bridge.Arguments
|
|
@@ -27,6 +28,7 @@ import droom.daro.core.model.DaroNativeAdChoicePlacement
|
|
|
27
28
|
import droom.daro.core.model.DaroViewAd
|
|
28
29
|
import droom.daro.core.model.NativeAdAssetType
|
|
29
30
|
import droom.daro.view.DaroAdViewListener
|
|
31
|
+
import droom.daro.view.DaroNativeAdController
|
|
30
32
|
import droom.daro.view.DaroNativeAdView
|
|
31
33
|
import kotlin.math.min
|
|
32
34
|
import kotlin.math.roundToInt
|
|
@@ -53,9 +55,14 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
53
55
|
|
|
54
56
|
private var adView: DaroNativeAdView? = null
|
|
55
57
|
|
|
56
|
-
internal var
|
|
58
|
+
internal var adUnitKey: String = ""
|
|
57
59
|
|
|
58
60
|
internal var loadOnMount: Boolean = true
|
|
61
|
+
|
|
62
|
+
/** preload 로 받아 둔 광고의 id. 뷰를 처음 만들 때 한 번만 본다. */
|
|
63
|
+
internal var preloadId: String? = null
|
|
64
|
+
private var preloadController: DaroNativeAdController? = null
|
|
65
|
+
|
|
59
66
|
private var adChoicesPosition: DaroNativeAdChoicePlacement =
|
|
60
67
|
DaroNativeAdChoicePlacement.BOTTOM_RIGHT
|
|
61
68
|
|
|
@@ -113,7 +120,8 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
113
120
|
pendingLoadAssetViewRetryCount = 0
|
|
114
121
|
captureRegisteredTextSpans()
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
val existing = adView
|
|
124
|
+
return (existing ?: buildAdView())?.let { view ->
|
|
117
125
|
|
|
118
126
|
adView = view
|
|
119
127
|
|
|
@@ -121,23 +129,34 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
121
129
|
this@DaroRNAdNativeViewContainer.addView(view)
|
|
122
130
|
}
|
|
123
131
|
|
|
124
|
-
|
|
132
|
+
// 받아 둔 광고를 넘겨받은 새 뷰는 화면에 붙을 때 SDK 가 그 광고를 쓴다. 여기서 loadAd 를
|
|
133
|
+
// 부르면 SDK 의 처리가 끝난 뒤에는 새 요청이 되어 받아 둔 광고를 덮어쓴다. 그 뒤의
|
|
134
|
+
// loadAd 는 재로드이므로 그대로 부른다.
|
|
135
|
+
if (existing != null || preloadController == null) view.loadAd()
|
|
125
136
|
isFirstLoad = false
|
|
126
137
|
true
|
|
127
138
|
} ?: false
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
private fun buildAdView(): DaroNativeAdView? {
|
|
131
|
-
if (
|
|
142
|
+
if (adUnitKey.isEmpty()) {
|
|
132
143
|
return null
|
|
133
144
|
}
|
|
134
145
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
// 받아 둔 광고는 컨트롤러와 같은 Activity 로 만든 뷰에만 넘어온다. 없으면 일반 로드다.
|
|
147
|
+
val activity = context.currentActivity
|
|
148
|
+
val controller = activity?.let {
|
|
149
|
+
DaroRNPreloadRegistry.shared.take(preloadId, adUnitKey, "", DaroNativeAdController::class.java)
|
|
150
|
+
}
|
|
151
|
+
preloadController = controller
|
|
152
|
+
|
|
153
|
+
val nativeView = if (activity != null && controller != null) {
|
|
154
|
+
DaroNativeAdView(activity, controller)
|
|
155
|
+
} else {
|
|
156
|
+
DaroNativeAdView(context, DaroNativeAdUnit(adUnitKey))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return nativeView.also { view ->
|
|
141
160
|
view.setAdBinder(
|
|
142
161
|
DaroNativeAdBinder
|
|
143
162
|
.Builder(adViewContainer)
|
|
@@ -184,6 +203,8 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
184
203
|
installFallbackAssetViews()
|
|
185
204
|
}
|
|
186
205
|
adView = null
|
|
206
|
+
preloadController?.destroy()
|
|
207
|
+
preloadController = null
|
|
187
208
|
pendingLoadAssetViewRetryCount = 0
|
|
188
209
|
removeAllViews()
|
|
189
210
|
testSpanMap.clear()
|
|
@@ -223,7 +244,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
223
244
|
sendNativeViewEvent(
|
|
224
245
|
reactContext = context,
|
|
225
246
|
event = AdViewEvent.ON_AD_LOADED,
|
|
226
|
-
params = AdInfoUtil.getAdInfo(
|
|
247
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
227
248
|
)
|
|
228
249
|
|
|
229
250
|
post({
|
|
@@ -240,7 +261,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
240
261
|
sendNativeViewEvent(
|
|
241
262
|
reactContext = context,
|
|
242
263
|
event = AdViewEvent.ON_AD_FAILED_TO_LOAD,
|
|
243
|
-
params = AdInfoUtil.getAdLoadFailedInfo(
|
|
264
|
+
params = AdInfoUtil.getAdLoadFailedInfo(adUnitKey, err)
|
|
244
265
|
)
|
|
245
266
|
}
|
|
246
267
|
|
|
@@ -250,7 +271,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
250
271
|
sendNativeViewEvent(
|
|
251
272
|
reactContext = context,
|
|
252
273
|
event = AdViewEvent.ON_AD_CLICKED,
|
|
253
|
-
params = AdInfoUtil.getAdInfo(
|
|
274
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
254
275
|
)
|
|
255
276
|
}
|
|
256
277
|
|
|
@@ -260,7 +281,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
260
281
|
sendNativeViewEvent(
|
|
261
282
|
reactContext = context,
|
|
262
283
|
event = AdViewEvent.ON_AD_IMPRESSION,
|
|
263
|
-
params = AdInfoUtil.getAdInfo(
|
|
284
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
264
285
|
)
|
|
265
286
|
}
|
|
266
287
|
|
|
@@ -289,7 +310,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
289
310
|
private fun scheduleInitialLoadIfNeeded() {
|
|
290
311
|
loadAdHandler.removeCallbacks(loadAdTask)
|
|
291
312
|
|
|
292
|
-
if (loadOnMount && isFirstLoad &&
|
|
313
|
+
if (loadOnMount && isFirstLoad && adUnitKey.isNotEmpty() && hasRegisteredAssetView()) {
|
|
293
314
|
loadAdHandler.postDelayed(loadAdTask, 50)
|
|
294
315
|
}
|
|
295
316
|
}
|
|
@@ -67,59 +67,73 @@ abstract class DaroRNModuleSpec(reactContext: ReactApplicationContext) :
|
|
|
67
67
|
abstract fun getIntegrationKeyInfo(promise: Promise)
|
|
68
68
|
|
|
69
69
|
@ReactMethod
|
|
70
|
-
abstract fun isInterstitialReady(requestId: Double,
|
|
70
|
+
abstract fun isInterstitialReady(requestId: Double, adUnitKey: String, promise: Promise)
|
|
71
71
|
|
|
72
72
|
@ReactMethod
|
|
73
|
-
abstract fun loadInterstitial(requestId: Double,
|
|
73
|
+
abstract fun loadInterstitial(requestId: Double, adUnitKey: String, promise: Promise)
|
|
74
74
|
|
|
75
75
|
@ReactMethod
|
|
76
|
-
abstract fun showInterstitial(requestId: Double,
|
|
76
|
+
abstract fun showInterstitial(requestId: Double, adUnitKey: String, promise: Promise)
|
|
77
77
|
|
|
78
78
|
@ReactMethod
|
|
79
|
-
abstract fun isRewardedAdReady(requestId: Double,
|
|
79
|
+
abstract fun isRewardedAdReady(requestId: Double, adUnitKey: String, promise: Promise)
|
|
80
80
|
|
|
81
81
|
@ReactMethod
|
|
82
|
-
abstract fun loadRewardedAd(requestId: Double,
|
|
82
|
+
abstract fun loadRewardedAd(requestId: Double, adUnitKey: String, promise: Promise)
|
|
83
83
|
|
|
84
84
|
@ReactMethod
|
|
85
85
|
abstract fun showRewardedAd(
|
|
86
86
|
requestId: Double,
|
|
87
|
-
|
|
87
|
+
adUnitKey: String,
|
|
88
88
|
customData: String?,
|
|
89
89
|
promise: Promise,
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
@ReactMethod
|
|
93
|
-
abstract fun isAppOpenAdReady(requestId: Double,
|
|
93
|
+
abstract fun isAppOpenAdReady(requestId: Double, adUnitKey: String, promise: Promise)
|
|
94
94
|
|
|
95
95
|
@ReactMethod
|
|
96
|
-
abstract fun loadAppOpenAd(requestId: Double,
|
|
96
|
+
abstract fun loadAppOpenAd(requestId: Double, adUnitKey: String, promise: Promise)
|
|
97
97
|
|
|
98
98
|
@ReactMethod
|
|
99
99
|
abstract fun showAppOpenAd(
|
|
100
100
|
requestId: Double,
|
|
101
|
-
|
|
101
|
+
adUnitKey: String,
|
|
102
102
|
customData: String?,
|
|
103
103
|
promise: Promise,
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
@ReactMethod
|
|
107
|
-
abstract fun destroyLightPopup(requestId: Double,
|
|
107
|
+
abstract fun destroyLightPopup(requestId: Double, adUnitKey: String)
|
|
108
108
|
|
|
109
109
|
@ReactMethod
|
|
110
|
-
abstract fun isLightPopupReady(requestId: Double,
|
|
110
|
+
abstract fun isLightPopupReady(requestId: Double, adUnitKey: String, promise: Promise)
|
|
111
111
|
|
|
112
112
|
@ReactMethod
|
|
113
|
-
abstract fun loadLightPopup(requestId: Double,
|
|
113
|
+
abstract fun loadLightPopup(requestId: Double, adUnitKey: String, promise: Promise)
|
|
114
114
|
|
|
115
115
|
@ReactMethod
|
|
116
|
-
abstract fun showLightPopup(requestId: Double,
|
|
116
|
+
abstract fun showLightPopup(requestId: Double, adUnitKey: String, promise: Promise)
|
|
117
117
|
|
|
118
118
|
@ReactMethod
|
|
119
119
|
abstract fun setLightPopupAdConfiguration(
|
|
120
120
|
requestId: Double,
|
|
121
|
-
|
|
121
|
+
adUnitKey: String,
|
|
122
122
|
configuration: ReadableMap,
|
|
123
123
|
promise: Promise,
|
|
124
124
|
)
|
|
125
|
+
|
|
126
|
+
@ReactMethod
|
|
127
|
+
abstract fun preloadBannerAd(preloadId: String, adUnitKey: String, adFormat: String, promise: Promise)
|
|
128
|
+
|
|
129
|
+
@ReactMethod
|
|
130
|
+
abstract fun preloadNativeAd(
|
|
131
|
+
preloadId: String,
|
|
132
|
+
adUnitKey: String,
|
|
133
|
+
adChoicesPosition: String,
|
|
134
|
+
promise: Promise,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
@ReactMethod
|
|
138
|
+
abstract fun destroyAdPreload(preloadId: String)
|
|
125
139
|
}
|