react-native-daro 2.0.7 → 2.0.8
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 +1 -1
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +3 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNAdNativeViewManager.kt +3 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +34 -34
- 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/DaroRNRewardedAdModuleImpl.kt +14 -14
- package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +16 -16
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdBannerViewContainer.kt +8 -8
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdNativeViewContainer.kt +8 -8
- package/android/src/oldarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +14 -14
- package/ios/DaroRNModule+AppOpen.swift +9 -9
- package/ios/DaroRNModule+Interstitial.swift +9 -9
- package/ios/DaroRNModule+LightPopup.swift +13 -13
- package/ios/DaroRNModule+Rewarded.swift +14 -14
- package/ios/DaroRNModule.mm +14 -14
- package/ios/DaroRNModule.swift +1 -1
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +7 -7
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +7 -7
- package/ios/Paper/DaroRNAdBannerViewManager.m +1 -1
- package/ios/Paper/DaroRNNativeAdViewManager.m +1 -1
- package/ios/Shared/DaroRNBannerAdView.swift +8 -8
- package/ios/Shared/DaroRNNativeAdView.swift +14 -14
- package/lib/commonjs/AdBannerView.js +2 -2
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +22 -22
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/lib/commonjs/DaroRNNativeAdViewNativeComponent.ts +3 -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/RewardedAd.js +22 -22
- package/lib/commonjs/RewardedAd.js.map +1 -1
- 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/nativeAd/NativeAdView.js +2 -2
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/AdBannerView.js +2 -2
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +22 -22
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/lib/module/DaroRNNativeAdViewNativeComponent.ts +3 -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/RewardedAd.js +22 -22
- package/lib/module/RewardedAd.js.map +1 -1
- 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/nativeAd/NativeAdView.js +2 -2
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- 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 +3 -3
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts +3 -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 +14 -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/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/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/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 +3 -3
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts +3 -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 +14 -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/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/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/package.json +1 -1
- package/plugin/build/withAndroid.js +2 -2
- package/react-native-daro.podspec +1 -1
- package/src/AdBannerView.tsx +2 -2
- package/src/AppOpenAd.ts +21 -21
- package/src/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/src/DaroRNNativeAdViewNativeComponent.ts +3 -3
- package/src/InterstitialAd.ts +23 -23
- package/src/LightPopupAd.ts +26 -26
- package/src/NativeDaroModule.ts +14 -14
- package/src/RewardedAd.ts +21 -21
- package/src/hooks/useInterstitialAd.ts +6 -6
- package/src/hooks/useLightPopupAd.ts +5 -5
- package/src/hooks/useRewardedAd.ts +6 -6
- package/src/nativeAd/NativeAdView.tsx +2 -2
- package/src/types/AdInfo.ts +2 -2
- package/src/types/AdProps.ts +1 -1
|
@@ -53,7 +53,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
53
53
|
|
|
54
54
|
private var adView: DaroNativeAdView? = null
|
|
55
55
|
|
|
56
|
-
internal var
|
|
56
|
+
internal var adUnitKey: String = ""
|
|
57
57
|
|
|
58
58
|
internal var loadOnMount: Boolean = true
|
|
59
59
|
private var adChoicesPosition: DaroNativeAdChoicePlacement =
|
|
@@ -128,14 +128,14 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
private fun buildAdView(): DaroNativeAdView? {
|
|
131
|
-
if (
|
|
131
|
+
if (adUnitKey.isEmpty()) {
|
|
132
132
|
return null
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return DaroNativeAdView(
|
|
136
136
|
context,
|
|
137
137
|
DaroNativeAdUnit(
|
|
138
|
-
|
|
138
|
+
adUnitKey,
|
|
139
139
|
)
|
|
140
140
|
).also { view ->
|
|
141
141
|
view.setAdBinder(
|
|
@@ -223,7 +223,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
223
223
|
sendNativeViewEvent(
|
|
224
224
|
reactContext = context,
|
|
225
225
|
event = AdViewEvent.ON_AD_LOADED,
|
|
226
|
-
params = AdInfoUtil.getAdInfo(
|
|
226
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
227
227
|
)
|
|
228
228
|
|
|
229
229
|
post({
|
|
@@ -240,7 +240,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
240
240
|
sendNativeViewEvent(
|
|
241
241
|
reactContext = context,
|
|
242
242
|
event = AdViewEvent.ON_AD_FAILED_TO_LOAD,
|
|
243
|
-
params = AdInfoUtil.getAdLoadFailedInfo(
|
|
243
|
+
params = AdInfoUtil.getAdLoadFailedInfo(adUnitKey, err)
|
|
244
244
|
)
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -250,7 +250,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
250
250
|
sendNativeViewEvent(
|
|
251
251
|
reactContext = context,
|
|
252
252
|
event = AdViewEvent.ON_AD_CLICKED,
|
|
253
|
-
params = AdInfoUtil.getAdInfo(
|
|
253
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
254
254
|
)
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -260,7 +260,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
260
260
|
sendNativeViewEvent(
|
|
261
261
|
reactContext = context,
|
|
262
262
|
event = AdViewEvent.ON_AD_IMPRESSION,
|
|
263
|
-
params = AdInfoUtil.getAdInfo(
|
|
263
|
+
params = AdInfoUtil.getAdInfo(adUnitKey, adInfo)
|
|
264
264
|
)
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -289,7 +289,7 @@ class DaroRNAdNativeViewContainer(val context: ReactContext) : ReactViewGroup(co
|
|
|
289
289
|
private fun scheduleInitialLoadIfNeeded() {
|
|
290
290
|
loadAdHandler.removeCallbacks(loadAdTask)
|
|
291
291
|
|
|
292
|
-
if (loadOnMount && isFirstLoad &&
|
|
292
|
+
if (loadOnMount && isFirstLoad && adUnitKey.isNotEmpty() && hasRegisteredAssetView()) {
|
|
293
293
|
loadAdHandler.postDelayed(loadAdTask, 50)
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -67,58 +67,58 @@ 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
|
)
|
|
@@ -4,10 +4,10 @@ import React
|
|
|
4
4
|
|
|
5
5
|
extension DaroRNModule {
|
|
6
6
|
|
|
7
|
-
@objc(isAppOpenAdReady:
|
|
7
|
+
@objc(isAppOpenAdReady:adUnitKey:resolve:reject:)
|
|
8
8
|
func isAppOpenAdReady(
|
|
9
9
|
requestId: Double,
|
|
10
|
-
|
|
10
|
+
adUnitKey: String,
|
|
11
11
|
resolve: RCTPromiseResolveBlock,
|
|
12
12
|
reject: RCTPromiseRejectBlock
|
|
13
13
|
) {
|
|
@@ -20,23 +20,23 @@ extension DaroRNModule {
|
|
|
20
20
|
resolve(appOpenAds[requestId]?.loadedAd != nil)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
@objc(loadAppOpenAd:
|
|
23
|
+
@objc(loadAppOpenAd:adUnitKey:resolve:reject:)
|
|
24
24
|
func loadAppOpenAd(
|
|
25
25
|
requestId: Double,
|
|
26
|
-
|
|
26
|
+
adUnitKey: String,
|
|
27
27
|
resolve: RCTPromiseResolveBlock,
|
|
28
28
|
reject: RCTPromiseRejectBlock
|
|
29
29
|
) {
|
|
30
30
|
let requestId = Int(requestId)
|
|
31
|
-
let appOpenAdLoader = retrieveAppOpenLoader(requestId: requestId,
|
|
31
|
+
let appOpenAdLoader = retrieveAppOpenLoader(requestId: requestId, adUnitKey: adUnitKey)
|
|
32
32
|
appOpenAdLoader.loadAd()
|
|
33
33
|
resolve(Void())
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@objc(showAppOpenAd:
|
|
36
|
+
@objc(showAppOpenAd:adUnitKey:customData:resolve:reject:)
|
|
37
37
|
func showAppOpenAd(
|
|
38
38
|
requestId: Double,
|
|
39
|
-
|
|
39
|
+
adUnitKey: String,
|
|
40
40
|
customData: String?,
|
|
41
41
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
42
42
|
reject: RCTPromiseRejectBlock
|
|
@@ -52,11 +52,11 @@ extension DaroRNModule {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
func retrieveAppOpenLoader(requestId: Int,
|
|
55
|
+
func retrieveAppOpenLoader(requestId: Int, adUnitKey: String) -> DaroAppOpenAdLoader {
|
|
56
56
|
if let appOpenLoader = appOpenAds[requestId] {
|
|
57
57
|
return appOpenLoader.loader
|
|
58
58
|
} else {
|
|
59
|
-
let appOpenLoader = DaroAppOpenAdLoader(unit: DaroAdUnit(
|
|
59
|
+
let appOpenLoader = DaroAppOpenAdLoader(unit: DaroAdUnit(adUnitKey: adUnitKey))
|
|
60
60
|
appOpenLoader.listener.onAdClicked = { [weak self] adInfo in
|
|
61
61
|
DaroRNModule.logger.debug("[DARO] Sample AppOpen Ad clicked")
|
|
62
62
|
self?.sendEvent(with: .onAppOpenAdClickedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
@@ -4,10 +4,10 @@ import React
|
|
|
4
4
|
|
|
5
5
|
extension DaroRNModule {
|
|
6
6
|
|
|
7
|
-
@objc(isInterstitialReady:
|
|
7
|
+
@objc(isInterstitialReady:adUnitKey:resolve:reject:)
|
|
8
8
|
func isInterstitialReady(
|
|
9
9
|
requestId: Double,
|
|
10
|
-
|
|
10
|
+
adUnitKey: String,
|
|
11
11
|
resolve: RCTPromiseResolveBlock,
|
|
12
12
|
reject: RCTPromiseRejectBlock
|
|
13
13
|
) {
|
|
@@ -20,23 +20,23 @@ extension DaroRNModule {
|
|
|
20
20
|
resolve(interstitials[requestId]?.loadedAd != nil)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
@objc(loadInterstitial:
|
|
23
|
+
@objc(loadInterstitial:adUnitKey:resolve:reject:)
|
|
24
24
|
func loadInterstitial(
|
|
25
25
|
requestId: Double,
|
|
26
|
-
|
|
26
|
+
adUnitKey: String,
|
|
27
27
|
resolve: RCTPromiseResolveBlock,
|
|
28
28
|
reject: RCTPromiseRejectBlock
|
|
29
29
|
) {
|
|
30
30
|
let requestId = Int(requestId)
|
|
31
|
-
let interstitialLoader = retrieveInterstitialLoader(requestId: requestId,
|
|
31
|
+
let interstitialLoader = retrieveInterstitialLoader(requestId: requestId, adUnitKey: adUnitKey)
|
|
32
32
|
interstitialLoader.loadAd()
|
|
33
33
|
resolve(Void())
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@objc(showInterstitial:
|
|
36
|
+
@objc(showInterstitial:adUnitKey:resolve:reject:)
|
|
37
37
|
func showInterstitial(
|
|
38
38
|
requestId: Double,
|
|
39
|
-
|
|
39
|
+
adUnitKey: String,
|
|
40
40
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
41
41
|
reject: @escaping RCTPromiseRejectBlock
|
|
42
42
|
) {
|
|
@@ -55,11 +55,11 @@ extension DaroRNModule {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
func retrieveInterstitialLoader(requestId: Int,
|
|
58
|
+
func retrieveInterstitialLoader(requestId: Int, adUnitKey: String) -> DaroInterstitialAdLoader {
|
|
59
59
|
if let interstitialAd = interstitials[requestId] {
|
|
60
60
|
return interstitialAd.loader
|
|
61
61
|
} else {
|
|
62
|
-
let interstitialLoader = DaroInterstitialAdLoader(unit: DaroAdUnit(
|
|
62
|
+
let interstitialLoader = DaroInterstitialAdLoader(unit: DaroAdUnit(adUnitKey: adUnitKey))
|
|
63
63
|
interstitialLoader.listener.onAdClicked = { [weak self] adInfo in
|
|
64
64
|
DaroRNModule.logger.debug("[DARO] Sample Interstitial Ad clicked")
|
|
65
65
|
self?.sendEvent(with: .onInterstitialClickedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
@@ -3,8 +3,8 @@ import UIKit
|
|
|
3
3
|
// MARK: - LightPopup Ad
|
|
4
4
|
extension DaroRNModule {
|
|
5
5
|
|
|
6
|
-
@objc(destroyLightPopup:
|
|
7
|
-
func destroyLightPopup(requestId: Double,
|
|
6
|
+
@objc(destroyLightPopup:adUnitKey:)
|
|
7
|
+
func destroyLightPopup(requestId: Double, adUnitKey: String) {
|
|
8
8
|
performLightPopupOnMain { releaseLightPopup(requestId: Int(requestId)) }
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -41,8 +41,8 @@ extension DaroRNModule {
|
|
|
41
41
|
request.presentedController = nil
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
@objc(isLightPopupReady:
|
|
45
|
-
func isLightPopupReady(requestId: Double,
|
|
44
|
+
@objc(isLightPopupReady:adUnitKey:resolve:reject:)
|
|
45
|
+
func isLightPopupReady(requestId: Double, adUnitKey: String,
|
|
46
46
|
resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
|
|
47
47
|
performLightPopupOnMain {
|
|
48
48
|
let request = lightPopups[Int(requestId)]
|
|
@@ -50,8 +50,8 @@ extension DaroRNModule {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
@objc(loadLightPopup:
|
|
54
|
-
func loadLightPopup(requestId: Double,
|
|
53
|
+
@objc(loadLightPopup:adUnitKey:resolve:reject:)
|
|
54
|
+
func loadLightPopup(requestId: Double, adUnitKey: String,
|
|
55
55
|
resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
|
|
56
56
|
performLightPopupOnMain {
|
|
57
57
|
guard !lightPopupInvalidated else { resolve(Void()); return }
|
|
@@ -59,13 +59,13 @@ extension DaroRNModule {
|
|
|
59
59
|
let configuration = lightPopupConfigurations[id]
|
|
60
60
|
releaseLightPopup(requestId: id)
|
|
61
61
|
lightPopupConfigurations[id] = configuration
|
|
62
|
-
retrieveLightPopupLoader(requestId: id,
|
|
62
|
+
retrieveLightPopupLoader(requestId: id, adUnitKey: adUnitKey).loadAd()
|
|
63
63
|
resolve(Void())
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
@objc(showLightPopup:
|
|
68
|
-
func showLightPopup(requestId: Double,
|
|
67
|
+
@objc(showLightPopup:adUnitKey:resolve:reject:)
|
|
68
|
+
func showLightPopup(requestId: Double, adUnitKey: String,
|
|
69
69
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
70
70
|
reject: @escaping RCTPromiseRejectBlock) {
|
|
71
71
|
performLightPopupOnMain {
|
|
@@ -93,8 +93,8 @@ extension DaroRNModule {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
@objc(setLightPopupAdConfiguration:
|
|
97
|
-
func setLightPopupAdConfiguration(requestId: Double,
|
|
96
|
+
@objc(setLightPopupAdConfiguration:adUnitKey:configuration:resolve:reject:)
|
|
97
|
+
func setLightPopupAdConfiguration(requestId: Double, adUnitKey: String,
|
|
98
98
|
configuration: [String: Any],
|
|
99
99
|
resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
|
|
100
100
|
performLightPopupOnMain {
|
|
@@ -134,8 +134,8 @@ extension DaroRNModule {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
func retrieveLightPopupLoader(requestId: Int,
|
|
138
|
-
let loader = DaroLightPopupAdLoader(unit: DaroAdUnit(
|
|
137
|
+
func retrieveLightPopupLoader(requestId: Int, adUnitKey: String) -> DaroLightPopupAdLoader {
|
|
138
|
+
let loader = DaroLightPopupAdLoader(unit: DaroAdUnit(adUnitKey: adUnitKey))
|
|
139
139
|
let request = LightPopupAd(loader: loader)
|
|
140
140
|
lightPopups[requestId] = request
|
|
141
141
|
loader.listener.onAdClicked = { [weak self, weak request] adInfo in
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React
|
|
2
2
|
|
|
3
3
|
extension DaroRNModule {
|
|
4
|
-
@objc(isRewardedAdReady:
|
|
4
|
+
@objc(isRewardedAdReady:adUnitKey:resolve:reject:)
|
|
5
5
|
func isRewardedAdReady(
|
|
6
6
|
requestId: Double,
|
|
7
|
-
|
|
7
|
+
adUnitKey: String,
|
|
8
8
|
resolve: RCTPromiseResolveBlock,
|
|
9
9
|
reject: RCTPromiseRejectBlock
|
|
10
10
|
) {
|
|
@@ -18,23 +18,23 @@ extension DaroRNModule {
|
|
|
18
18
|
resolve(rewardedAds[requestId]?.loadedAd != nil)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
@objc(loadRewardedAd:
|
|
21
|
+
@objc(loadRewardedAd:adUnitKey:resolve:reject:)
|
|
22
22
|
func loadRewardedAd(
|
|
23
23
|
requestId: Double,
|
|
24
|
-
|
|
24
|
+
adUnitKey: String,
|
|
25
25
|
resolve: RCTPromiseResolveBlock,
|
|
26
26
|
reject: RCTPromiseRejectBlock
|
|
27
27
|
) {
|
|
28
28
|
let requestId = Int(requestId)
|
|
29
|
-
let rewardedLoader = retrieveRewardedLoader(requestId: requestId,
|
|
29
|
+
let rewardedLoader = retrieveRewardedLoader(requestId: requestId, adUnitKey: adUnitKey)
|
|
30
30
|
rewardedLoader.loadAd()
|
|
31
31
|
resolve(Void())
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
@objc(showRewardedAd:
|
|
34
|
+
@objc(showRewardedAd:adUnitKey:customData:resolve:reject:)
|
|
35
35
|
func showRewardedAd(
|
|
36
36
|
requestId: Double,
|
|
37
|
-
|
|
37
|
+
adUnitKey: String,
|
|
38
38
|
customData: String?,
|
|
39
39
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
40
40
|
reject: @escaping RCTPromiseRejectBlock
|
|
@@ -57,11 +57,11 @@ extension DaroRNModule {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
func retrieveRewardedLoader(requestId: Int,
|
|
60
|
+
func retrieveRewardedLoader(requestId: Int, adUnitKey: String) -> DaroRewardedAdLoader {
|
|
61
61
|
if let rewardedAd = rewardedAds[requestId] {
|
|
62
62
|
return rewardedAd.loader
|
|
63
63
|
} else {
|
|
64
|
-
let rewardedAdLoader = DaroRewardedAdLoader(unit: DaroAdUnit(
|
|
64
|
+
let rewardedAdLoader = DaroRewardedAdLoader(unit: DaroAdUnit(adUnitKey: adUnitKey))
|
|
65
65
|
rewardedAdLoader.listener.onAdClicked = { [weak self] adInfo in
|
|
66
66
|
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad clicked")
|
|
67
67
|
self?.sendEvent(with: .onRewardedAdClickedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
@@ -107,22 +107,22 @@ extension DaroRNModule {
|
|
|
107
107
|
|
|
108
108
|
ad.rewardedAdListener.onEarnedReward = { [weak self] adInfo, rewardItem in
|
|
109
109
|
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad received reward")
|
|
110
|
-
self?.sendEvent(with: .onRewardedAdReceivedRewardEvent, body: rewardItem?.toBody(requestId: requestId,
|
|
110
|
+
self?.sendEvent(with: .onRewardedAdReceivedRewardEvent, body: rewardItem?.toBody(requestId: requestId, adUnitKey: adInfo?.adUnitKey ?? ""))
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
private extension DaroRewardedItem {
|
|
116
|
-
func toBody(
|
|
116
|
+
func toBody(adUnitKey: String) -> [String: Any] {
|
|
117
117
|
return [
|
|
118
|
-
"
|
|
118
|
+
"adUnitKey": adUnitKey,
|
|
119
119
|
"rewardLabel": self.rewardType,
|
|
120
120
|
"rewardAmount": self.amount,
|
|
121
121
|
]
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
func toBody(requestId: Int,
|
|
125
|
-
var body = self.toBody(
|
|
124
|
+
func toBody(requestId: Int, adUnitKey: String) -> [String: Any] {
|
|
125
|
+
var body = self.toBody(adUnitKey: adUnitKey)
|
|
126
126
|
body["requestId"] = requestId
|
|
127
127
|
return body
|
|
128
128
|
}
|
package/ios/DaroRNModule.mm
CHANGED
|
@@ -35,29 +35,29 @@ RCT_EXTERN_METHOD(getIntegrationKeyInfo:(RCTPromiseResolveBlock)resolve reject:(
|
|
|
35
35
|
|
|
36
36
|
#pragma mark - Interstitial
|
|
37
37
|
|
|
38
|
-
RCT_EXTERN_METHOD(isInterstitialReady:(double)requestId
|
|
39
|
-
RCT_EXTERN_METHOD(loadInterstitial:(double)requestId
|
|
40
|
-
RCT_EXTERN_METHOD(showInterstitial:(double)requestId
|
|
38
|
+
RCT_EXTERN_METHOD(isInterstitialReady:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
39
|
+
RCT_EXTERN_METHOD(loadInterstitial:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
40
|
+
RCT_EXTERN_METHOD(showInterstitial:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
41
41
|
|
|
42
42
|
#pragma mark - Rewarded
|
|
43
43
|
|
|
44
|
-
RCT_EXTERN_METHOD(isRewardedAdReady:(double)requestId
|
|
45
|
-
RCT_EXTERN_METHOD(loadRewardedAd:(double)requestId
|
|
46
|
-
RCT_EXTERN_METHOD(showRewardedAd:(double)requestId
|
|
44
|
+
RCT_EXTERN_METHOD(isRewardedAdReady:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
45
|
+
RCT_EXTERN_METHOD(loadRewardedAd:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
46
|
+
RCT_EXTERN_METHOD(showRewardedAd:(double)requestId adUnitKey:(NSString *)adUnitKey customData:(nullable NSString *)customData resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
47
47
|
|
|
48
48
|
#pragma mark - AppOpen Ad
|
|
49
49
|
|
|
50
|
-
RCT_EXTERN_METHOD(isAppOpenAdReady:(double)requestId
|
|
51
|
-
RCT_EXTERN_METHOD(loadAppOpenAd:(double)requestId
|
|
52
|
-
RCT_EXTERN_METHOD(showAppOpenAd:(double)requestId
|
|
50
|
+
RCT_EXTERN_METHOD(isAppOpenAdReady:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
51
|
+
RCT_EXTERN_METHOD(loadAppOpenAd:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
52
|
+
RCT_EXTERN_METHOD(showAppOpenAd:(double)requestId adUnitKey:(NSString *)adUnitKey customData:(nullable NSString *)customData resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
53
53
|
|
|
54
54
|
#pragma mark - Light Popup
|
|
55
55
|
|
|
56
|
-
RCT_EXTERN_METHOD(destroyLightPopup:(double)requestId
|
|
57
|
-
RCT_EXTERN_METHOD(isLightPopupReady:(double)requestId
|
|
58
|
-
RCT_EXTERN_METHOD(loadLightPopup:(double)requestId
|
|
59
|
-
RCT_EXTERN_METHOD(showLightPopup:(double)requestId
|
|
60
|
-
RCT_EXTERN_METHOD(setLightPopupAdConfiguration:(double)requestId
|
|
56
|
+
RCT_EXTERN_METHOD(destroyLightPopup:(double)requestId adUnitKey:(NSString *)adUnitKey)
|
|
57
|
+
RCT_EXTERN_METHOD(isLightPopupReady:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
58
|
+
RCT_EXTERN_METHOD(loadLightPopup:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
59
|
+
RCT_EXTERN_METHOD(showLightPopup:(double)requestId adUnitKey:(NSString *)adUnitKey resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
60
|
+
RCT_EXTERN_METHOD(setLightPopupAdConfiguration:(double)requestId adUnitKey:(NSString *)adUnitKey configuration:(NSDictionary *)configuration resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
61
61
|
|
|
62
62
|
+ (BOOL)requiresMainQueueSetup {
|
|
63
63
|
return YES;
|
package/ios/DaroRNModule.swift
CHANGED
|
@@ -217,7 +217,7 @@ extension DaroAdInfo {
|
|
|
217
217
|
// 모듈 경로와 뷰 경로(DaroRNBannerAdView·DaroRNNativeAdView)가 **둘 다 여기를 지난다.**
|
|
218
218
|
var toBody: [String: Any] {
|
|
219
219
|
var body: [String: Any] = [
|
|
220
|
-
"
|
|
220
|
+
"adUnitKey": self.adUnitKey,
|
|
221
221
|
"latencyMillis": self.latency as Any,
|
|
222
222
|
]
|
|
223
223
|
// 없을 때는 키를 넣지 않는다 — [String: Any] 에 nil 을 담으면 JS 에서 null 로
|
|
@@ -71,7 +71,7 @@ extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
|
71
71
|
|
|
72
72
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
73
73
|
eventEmitter->onAdLoadedEvent({
|
|
74
|
-
.
|
|
74
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
75
75
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
76
76
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
77
77
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -93,7 +93,7 @@ extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
|
93
93
|
|
|
94
94
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
95
95
|
eventEmitter->onAdLoadFailedEvent({
|
|
96
|
-
.
|
|
96
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
97
97
|
.code = DaroRNFabricEventInt(eventBody, @"code"),
|
|
98
98
|
.message = DaroRNFabricEventString(eventBody, @"message"),
|
|
99
99
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
@@ -113,7 +113,7 @@ extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
|
113
113
|
|
|
114
114
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
115
115
|
eventEmitter->onAdClickedEvent({
|
|
116
|
-
.
|
|
116
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
117
117
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
118
118
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
119
119
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -135,7 +135,7 @@ extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
|
135
135
|
|
|
136
136
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
137
137
|
eventEmitter->onAdImpressionRecordedEvent({
|
|
138
|
-
.
|
|
138
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
139
139
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
140
140
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
141
141
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -161,9 +161,9 @@ extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
|
161
161
|
const auto &newComponentProps = *std::static_pointer_cast<const DaroRNAdBannerViewProps>(props);
|
|
162
162
|
NSMutableArray<NSString *> *changedProps = [NSMutableArray new];
|
|
163
163
|
|
|
164
|
-
if (oldComponentProps.
|
|
165
|
-
DaroRNFabricSetValue(_bannerView, @"
|
|
166
|
-
[changedProps addObject:@"
|
|
164
|
+
if (oldComponentProps.adUnitKey != newComponentProps.adUnitKey) {
|
|
165
|
+
DaroRNFabricSetValue(_bannerView, @"adUnitKey", DaroRNFabricNSStringFromStdString(newComponentProps.adUnitKey));
|
|
166
|
+
[changedProps addObject:@"adUnitKey"];
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
if (oldComponentProps.adFormat != newComponentProps.adFormat) {
|
|
@@ -103,7 +103,7 @@ static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoices
|
|
|
103
103
|
|
|
104
104
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
105
105
|
eventEmitter->onAdLoadedEvent({
|
|
106
|
-
.
|
|
106
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
107
107
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
108
108
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
109
109
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -125,7 +125,7 @@ static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoices
|
|
|
125
125
|
|
|
126
126
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
127
127
|
eventEmitter->onAdLoadFailedEvent({
|
|
128
|
-
.
|
|
128
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
129
129
|
.code = DaroRNFabricEventInt(eventBody, @"code"),
|
|
130
130
|
.message = DaroRNFabricEventString(eventBody, @"message"),
|
|
131
131
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
@@ -145,7 +145,7 @@ static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoices
|
|
|
145
145
|
|
|
146
146
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
147
147
|
eventEmitter->onAdClickedEvent({
|
|
148
|
-
.
|
|
148
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
149
149
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
150
150
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
151
151
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -167,7 +167,7 @@ static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoices
|
|
|
167
167
|
|
|
168
168
|
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
169
169
|
eventEmitter->onAdImpressionRecordedEvent({
|
|
170
|
-
.
|
|
170
|
+
.adUnitKey = DaroRNFabricEventString(eventBody, @"adUnitKey"),
|
|
171
171
|
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
172
172
|
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
173
173
|
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
@@ -194,9 +194,9 @@ static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoices
|
|
|
194
194
|
const auto &newComponentProps = *std::static_pointer_cast<const DaroRNNativeAdViewProps>(props);
|
|
195
195
|
NSMutableArray<NSString *> *changedProps = [NSMutableArray new];
|
|
196
196
|
|
|
197
|
-
if (oldComponentProps.
|
|
198
|
-
DaroRNFabricSetValue(_nativeAdView, @"
|
|
199
|
-
[changedProps addObject:@"
|
|
197
|
+
if (oldComponentProps.adUnitKey != newComponentProps.adUnitKey) {
|
|
198
|
+
DaroRNFabricSetValue(_nativeAdView, @"adUnitKey", DaroRNFabricNSStringFromStdString(newComponentProps.adUnitKey));
|
|
199
|
+
[changedProps addObject:@"adUnitKey"];
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
if (oldComponentProps.loadOnMount != newComponentProps.loadOnMount) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(DaroRNAdBannerViewManager, RCTViewManager)
|
|
4
4
|
|
|
5
|
-
RCT_EXPORT_VIEW_PROPERTY(
|
|
5
|
+
RCT_EXPORT_VIEW_PROPERTY(adUnitKey, NSString)
|
|
6
6
|
RCT_EXPORT_VIEW_PROPERTY(adFormat, NSString)
|
|
7
7
|
RCT_EXPORT_VIEW_PROPERTY(loadOnMount, BOOL)
|
|
8
8
|
RCT_EXPORT_VIEW_PROPERTY(isVisible, BOOL)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE (DaroRNNativeAdViewManager, RCTViewManager)
|
|
4
4
|
|
|
5
|
-
RCT_EXPORT_VIEW_PROPERTY(
|
|
5
|
+
RCT_EXPORT_VIEW_PROPERTY(adUnitKey, NSString)
|
|
6
6
|
RCT_EXPORT_VIEW_PROPERTY(loadOnMount, BOOL)
|
|
7
7
|
RCT_EXPORT_VIEW_PROPERTY(adChoicesPosition, NSString)
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ final class DaroRNAdBannerView: UIView {
|
|
|
14
14
|
private var hasRequestedInitialLoad = false
|
|
15
15
|
private var pendingLoadRequest: DaroRNBannerLoadRequest?
|
|
16
16
|
|
|
17
|
-
@objc var
|
|
17
|
+
@objc var adUnitKey: String?
|
|
18
18
|
@objc var adFormat: String = DaroRNModule.Constants.bannerAdFormatLabel.value
|
|
19
19
|
@objc var loadOnMount: Bool = true
|
|
20
20
|
@objc var isVisible: Bool = true {
|
|
@@ -55,9 +55,9 @@ final class DaroRNAdBannerView: UIView {
|
|
|
55
55
|
@objc(applyReactProps:)
|
|
56
56
|
func applyReactProps(_ changedProps: [String]!) {
|
|
57
57
|
guard let changedProps, changedProps.isEmpty == false else { return }
|
|
58
|
-
guard let
|
|
59
|
-
if changedProps.contains("
|
|
60
|
-
DaroRNModule.logger.warning("
|
|
58
|
+
guard let adUnitKey, adUnitKey.isEmpty == false else {
|
|
59
|
+
if changedProps.contains("adUnitKey") {
|
|
60
|
+
DaroRNModule.logger.warning("AdUnitKey is required")
|
|
61
61
|
}
|
|
62
62
|
return
|
|
63
63
|
}
|
|
@@ -74,7 +74,7 @@ final class DaroRNAdBannerView: UIView {
|
|
|
74
74
|
@objc(prepareForReuse)
|
|
75
75
|
func prepareForReuse() {
|
|
76
76
|
resetAdState()
|
|
77
|
-
|
|
77
|
+
adUnitKey = nil
|
|
78
78
|
adFormat = DaroRNModule.Constants.bannerAdFormatLabel.value
|
|
79
79
|
loadOnMount = true
|
|
80
80
|
isVisible = true
|
|
@@ -100,13 +100,13 @@ final class DaroRNAdBannerView: UIView {
|
|
|
100
100
|
guard adBannerView == nil else {
|
|
101
101
|
return
|
|
102
102
|
}
|
|
103
|
-
guard let
|
|
104
|
-
DaroRNModule.logger.warning("
|
|
103
|
+
guard let adUnitKey, adUnitKey.isEmpty == false else {
|
|
104
|
+
DaroRNModule.logger.warning("AdUnitKey is required")
|
|
105
105
|
return
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
let bannerSize = adFormat == DaroRNModule.Constants.bannerAdFormatLabel.value ? DaroAdBannerSize.banner : DaroAdBannerSize.MREC
|
|
109
|
-
let adUnit = DaroAdUnit(
|
|
109
|
+
let adUnit = DaroAdUnit(adUnitKey: adUnitKey)
|
|
110
110
|
let adBannerView = DaroAdBannerView(unit: adUnit, bannerSize: bannerSize, autoLoad: false)
|
|
111
111
|
setupBannerListener(for: adBannerView)
|
|
112
112
|
|