react-native-daro 1.0.16 → 2.0.0-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 -5
- package/android/build.gradle +6 -13
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
- package/android/src/main/java/com/daro/reactnative/{DaroMAdNativeViewManager.kt → DaroRNAdNativeViewManager.kt} +34 -38
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +376 -0
- package/android/src/main/java/com/daro/reactnative/{DaroMPackage.kt → DaroRNPackage.kt} +7 -7
- package/android/src/main/java/com/daro/reactnative/DaroSdkBridge.kt +52 -0
- package/android/src/main/java/com/daro/reactnative/constants/{InternalDaroMBannerSize.kt → InternalDaroRNBannerSize.kt} +2 -2
- package/android/src/main/java/com/daro/reactnative/event/{DaroMEvent.kt → DaroRNEvent.kt} +6 -6
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMBannerViewModuleImpl.kt → DaroRNBannerViewModuleImpl.kt} +3 -3
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMInterstitialModuleImpl.kt → DaroRNInterstitialModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMLightPopupModuleImpl.kt → DaroRNLightPopupModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +12 -0
- package/android/src/main/java/com/daro/reactnative/util/DaroQaProbe.kt +147 -0
- package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +2 -2
- package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
- package/android/src/main/java/com/daro/reactnative/view/{DaroMAdNativeViewContainer.kt → DaroRNAdNativeViewContainer.kt} +3 -4
- package/android/src/newarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +1 -1
- package/android/src/oldarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +32 -3
- package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +10 -11
- package/ios/DaroRNModule+Consent.swift +88 -0
- package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +9 -9
- package/ios/{DaroMModule+LightPopup.swift → DaroRNModule+LightPopup.swift} +2 -2
- package/ios/DaroRNModule+Qa.swift +158 -0
- package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +10 -10
- package/ios/{DaroMModule.mm → DaroRNModule.mm} +19 -4
- package/ios/{DaroMModule.swift → DaroRNModule.swift} +20 -6
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
- package/ios/Fabric/{DaroMFabricEventSink.mm → DaroRNFabricEventSink.mm} +4 -4
- package/ios/Fabric/{DaroMFabricPropApplier.mm → DaroRNFabricPropApplier.mm} +14 -14
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +306 -0
- package/ios/Paper/{DaroMAdBannerViewManager.m → DaroRNAdBannerViewManager.m} +1 -1
- package/ios/Paper/{DaroMAdBannerViewManager.swift → DaroRNAdBannerViewManager.swift} +5 -5
- package/ios/Paper/{DaroMNativeAdViewManager.m → DaroRNNativeAdViewManager.m} +1 -1
- package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMediationDebugger.swift +14 -0
- package/ios/Shared/{DaroMAdEventSink.swift → DaroRNAdEventSink.swift} +1 -1
- package/ios/Shared/{DaroMBannerAdView.swift → DaroRNBannerAdView.swift} +11 -11
- package/ios/Shared/{DaroMNativeAdLoadCoordinator.swift → DaroRNNativeAdLoadCoordinator.swift} +4 -4
- package/ios/Shared/{DaroMNativeAdView.swift → DaroRNNativeAdView.swift} +21 -21
- package/ios/Shared/{DaroMNativeAssetResolver.swift → DaroRNNativeAssetResolver.swift} +6 -6
- package/lib/commonjs/AdBannerView.js +3 -5
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +4 -4
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/{DaroMAdBannerViewNativeComponent.ts → DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/{src/DaroMNativeAdViewNativeComponent.ts → lib/commonjs/DaroRNNativeAdViewNativeComponent.ts} +5 -2
- package/lib/commonjs/NativeDaroModule.js +1 -1
- package/lib/commonjs/NativeDaroModule.js.map +1 -1
- package/lib/commonjs/index.js +121 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +3 -3
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/AdBannerView.js +1 -3
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +4 -4
- package/lib/module/AppOpenAd.js.map +1 -1
- package/{src/DaroMAdBannerViewNativeComponent.ts → lib/module/DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/lib/{commonjs/DaroMNativeAdViewNativeComponent.ts → module/DaroRNNativeAdViewNativeComponent.ts} +5 -2
- package/lib/module/NativeDaroModule.js +1 -1
- package/lib/module/NativeDaroModule.js.map +1 -1
- package/lib/module/index.js +101 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +1 -1
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/typescript/commonjs/plugin/src/index.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +2 -2
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +10 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +79 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts +15 -0
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +0 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts +2 -6
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +2 -6
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withIos.d.ts +2 -6
- package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +2 -2
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts +10 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +79 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts +15 -0
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +0 -1
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/package.json +3 -3
- package/plugin/build/index.d.ts +2 -6
- package/plugin/build/index.js +21 -56
- package/plugin/build/withAndroid.d.ts +2 -6
- package/plugin/build/withAndroid.js +48 -90
- package/plugin/build/withIos.d.ts +2 -6
- package/plugin/build/withIos.js +37 -33
- package/react-native-daro.podspec +2 -3
- package/src/AdBannerView.tsx +1 -3
- package/src/AppOpenAd.ts +2 -8
- package/{lib/module/DaroMAdBannerViewNativeComponent.ts → src/DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/{lib/module/DaroMNativeAdViewNativeComponent.ts → src/DaroRNNativeAdViewNativeComponent.ts} +5 -2
- package/src/NativeDaroModule.ts +17 -2
- package/src/index.tsx +136 -0
- package/src/nativeAd/NativeAdView.tsx +1 -1
- package/src/types/AdInfo.ts +17 -0
- package/src/types/AdProps.ts +0 -2
- package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
- package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -155
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -257
- package/ios/Fabric/DaroMAdBannerComponentView.mm +0 -207
- package/ios/Fabric/DaroMNativeAdComponentView.mm +0 -294
- package/ios/Paper/DaroMNativeAdViewManager.swift +0 -22
- package/ios/mediation/admob/DaroMediationDebugger.swift +0 -11
- package/lib/commonjs/types/DaroMMobileAds.js +0 -2
- package/lib/commonjs/types/DaroMMobileAds.js.map +0 -1
- package/lib/module/types/DaroMMobileAds.js +0 -2
- package/lib/module/types/DaroMMobileAds.js.map +0 -1
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts +0 -6
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +0 -1
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts +0 -6
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +0 -1
- package/src/types/DaroMMobileAds.ts +0 -5
- /package/ios/{mediation/admob → Shared}/DaroMediationTypes.swift +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
package com.daro.reactnative
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import droom.daro.SDKConfig
|
|
6
|
-
import droom.daro.a.Daro
|
|
7
|
-
|
|
8
|
-
internal object DaroSdkBridge {
|
|
9
|
-
fun initialize(application: Application, sdkConfig: SDKConfig) {
|
|
10
|
-
Daro.init(
|
|
11
|
-
application = application,
|
|
12
|
-
sdkConfig = sdkConfig,
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fun openDebugger(context: Context) {
|
|
17
|
-
Daro.openDebugger(context)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fun setUserId(context: Context, userId: String) {
|
|
21
|
-
Daro.setUserId(context, userId)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
package com.daro.reactnative
|
|
2
|
-
|
|
3
|
-
import com.daro.reactnative.constants.InternalDaroMBannerSize
|
|
4
|
-
import com.daro.reactnative.event.AdViewEvent
|
|
5
|
-
import com.daro.reactnative.view.DaroMAdBannerViewContainer
|
|
6
|
-
import com.facebook.react.bridge.ReadableArray
|
|
7
|
-
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
8
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
9
|
-
import com.facebook.react.uimanager.StateWrapper
|
|
10
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
11
|
-
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
12
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
13
|
-
import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerDelegate
|
|
14
|
-
import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerInterface
|
|
15
|
-
|
|
16
|
-
class DaroMAdBannerViewManager : SimpleViewManager<DaroMAdBannerViewContainer>(),
|
|
17
|
-
DaroMAdBannerViewManagerInterface<DaroMAdBannerViewContainer> {
|
|
18
|
-
|
|
19
|
-
private val delegate: ViewManagerDelegate<DaroMAdBannerViewContainer> =
|
|
20
|
-
DaroMAdBannerViewManagerDelegate(this)
|
|
21
|
-
|
|
22
|
-
override fun getDelegate(): ViewManagerDelegate<DaroMAdBannerViewContainer> = delegate
|
|
23
|
-
|
|
24
|
-
override fun getName(): String {
|
|
25
|
-
return "DaroMAdBannerView"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
companion object {
|
|
29
|
-
private const val COMMAND_LOAD_AD: Int = 1
|
|
30
|
-
|
|
31
|
-
private val viewCache: MutableMap<String, DaroMAdBannerViewContainer> = mutableMapOf()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override fun createViewInstance(
|
|
35
|
-
reactTag: Int,
|
|
36
|
-
reactContext: ThemedReactContext,
|
|
37
|
-
initialProps: ReactStylesDiffMap?,
|
|
38
|
-
stateWrapper: StateWrapper?,
|
|
39
|
-
): DaroMAdBannerViewContainer {
|
|
40
|
-
val placement = initialProps?.getString("placement")
|
|
41
|
-
val adUnitId = initialProps?.getString("adUnitId")
|
|
42
|
-
|
|
43
|
-
val cacheKey = when {
|
|
44
|
-
adUnitId.isNullOrBlank() || placement.isNullOrBlank() -> ""
|
|
45
|
-
else -> "{$adUnitId}_${placement}${reactContext.hashCode()}"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (cacheKey.isNotBlank()) {
|
|
49
|
-
viewCache.keys
|
|
50
|
-
.filter { it.contains(cacheKey) && it != cacheKey }
|
|
51
|
-
.forEach { viewCache.remove(it)?.destroy() }
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return cacheKey.let {
|
|
55
|
-
viewCache[cacheKey].let { cachedView ->
|
|
56
|
-
cachedView?.id = reactTag
|
|
57
|
-
|
|
58
|
-
if (cachedView?.parent == null) {
|
|
59
|
-
cachedView?.resumeAd()
|
|
60
|
-
cachedView
|
|
61
|
-
} else {
|
|
62
|
-
null
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} ?: super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper).also { view ->
|
|
66
|
-
if (cacheKey.isNotBlank()) viewCache[cacheKey] = view
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
override fun createViewInstance(reactContext: ThemedReactContext): DaroMAdBannerViewContainer {
|
|
71
|
-
return DaroMAdBannerViewContainer(reactContext).apply {
|
|
72
|
-
loadOnMount = true
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
77
|
-
return mutableMapOf(
|
|
78
|
-
"loadAd" to COMMAND_LOAD_AD,
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
override fun onAfterUpdateTransaction(view: DaroMAdBannerViewContainer) {
|
|
83
|
-
super.onAfterUpdateTransaction(view)
|
|
84
|
-
view.onSetProps()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
override fun onDropViewInstance(view: DaroMAdBannerViewContainer) {
|
|
88
|
-
super.onDropViewInstance(view)
|
|
89
|
-
|
|
90
|
-
val isCached = viewCache.values.contains(view)
|
|
91
|
-
if (isCached) {
|
|
92
|
-
view.pauseAd()
|
|
93
|
-
} else {
|
|
94
|
-
view.destroy()
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@Deprecated("")
|
|
99
|
-
override fun receiveCommand(
|
|
100
|
-
root: DaroMAdBannerViewContainer,
|
|
101
|
-
commandId: Int,
|
|
102
|
-
args: ReadableArray?,
|
|
103
|
-
) {
|
|
104
|
-
when (commandId) {
|
|
105
|
-
COMMAND_LOAD_AD -> {
|
|
106
|
-
root.loadAd()
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
override fun receiveCommand(
|
|
112
|
-
root: DaroMAdBannerViewContainer,
|
|
113
|
-
commandId: String,
|
|
114
|
-
args: ReadableArray?,
|
|
115
|
-
) {
|
|
116
|
-
when (commandId) {
|
|
117
|
-
"loadAd" -> root.loadAd()
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@ReactProp(name = "isVisible")
|
|
122
|
-
override fun setIsVisible(view: DaroMAdBannerViewContainer, isVisible: Boolean) {
|
|
123
|
-
view.setAdVisibility(isVisible)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@ReactProp(name = "adUnitId")
|
|
127
|
-
override fun setAdUnitId(view: DaroMAdBannerViewContainer, adUnitId: String?) {
|
|
128
|
-
view.adUnitId = adUnitId.orEmpty()
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@ReactProp(name = "adFormat")
|
|
132
|
-
override fun setAdFormat(view: DaroMAdBannerViewContainer, adFormat: String?) {
|
|
133
|
-
view.adSize = adFormat?.let { InternalDaroMBannerSize.fromName(it).toBannerSize() }
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@ReactProp(name = "loadOnMount")
|
|
137
|
-
override fun setLoadOnMount(view: DaroMAdBannerViewContainer, loadOnMount: Boolean) {
|
|
138
|
-
view.loadOnMount = loadOnMount
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@ReactProp(name = "placement")
|
|
142
|
-
override fun setPlacement(view: DaroMAdBannerViewContainer, placement: String?) {
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
override fun loadAd(view: DaroMAdBannerViewContainer) {
|
|
146
|
-
view.loadAd()
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
150
|
-
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
|
|
151
|
-
return AdViewEvent.entries.associate {
|
|
152
|
-
it.value to mutableMapOf("registrationName" to it.registrationName)
|
|
153
|
-
}.toMutableMap()
|
|
154
|
-
}
|
|
155
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
package com.daro.reactnative
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import com.daro.reactnative.constants.InternalDaroMBannerSize
|
|
6
|
-
import com.daro.reactnative.event.AppOpenEvent
|
|
7
|
-
import com.daro.reactnative.event.DaroMEvent
|
|
8
|
-
import com.daro.reactnative.event.InterstitialEvent
|
|
9
|
-
import com.daro.reactnative.event.LightPopupEvent
|
|
10
|
-
import com.daro.reactnative.event.RewardedEvent
|
|
11
|
-
import com.daro.reactnative.impl.DaroMBannerViewModuleImpl
|
|
12
|
-
import com.daro.reactnative.impl.DaroMInterstitialModuleImpl
|
|
13
|
-
import com.daro.reactnative.impl.DaroMLightPopupModuleImpl
|
|
14
|
-
import com.daro.reactnative.impl.DaroMRewardedAdModuleImpl
|
|
15
|
-
import com.daro.reactnative.util.EventEmitterUtil
|
|
16
|
-
import com.facebook.react.bridge.Promise
|
|
17
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
18
|
-
import com.facebook.react.bridge.ReactContext
|
|
19
|
-
import com.facebook.react.bridge.ReactMethod
|
|
20
|
-
import com.facebook.react.bridge.ReadableMap
|
|
21
|
-
import com.facebook.react.bridge.WritableMap
|
|
22
|
-
import droom.daro.SDKConfig
|
|
23
|
-
|
|
24
|
-
class DaroMModule(reactContext: ReactApplicationContext) :
|
|
25
|
-
DaroMModuleSpec(reactContext) {
|
|
26
|
-
|
|
27
|
-
companion object {
|
|
28
|
-
const val NAME = "DaroMModule"
|
|
29
|
-
private const val APP_OPEN_UNSUPPORTED_CODE = "APP_OPEN_UNSUPPORTED"
|
|
30
|
-
private const val APP_OPEN_UNSUPPORTED_MESSAGE = "AppOpen ad is not supported on Android"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private val context: Context = reactApplicationContext
|
|
34
|
-
|
|
35
|
-
private var isInitialized: Boolean = false
|
|
36
|
-
|
|
37
|
-
@ReactMethod
|
|
38
|
-
override fun addListener(eventName: String) = Unit
|
|
39
|
-
|
|
40
|
-
@ReactMethod
|
|
41
|
-
override fun removeListeners(count: Double) = Unit
|
|
42
|
-
|
|
43
|
-
@ReactMethod
|
|
44
|
-
override fun initializeSdk(promise: Promise) {
|
|
45
|
-
DaroSdkBridge.initialize(
|
|
46
|
-
application = context.applicationContext as Application,
|
|
47
|
-
sdkConfig = SDKConfig.Builder()
|
|
48
|
-
.setDebugMode(false)
|
|
49
|
-
.build()
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
isInitialized = true
|
|
53
|
-
promise.resolve(null)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@ReactMethod
|
|
57
|
-
override fun isInitialized(promise: Promise) {
|
|
58
|
-
promise.resolve(isInitialized)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@ReactMethod
|
|
62
|
-
override fun showMediationDebugger(promise: Promise) {
|
|
63
|
-
DaroSdkBridge.openDebugger(context)
|
|
64
|
-
promise.resolve(null)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@ReactMethod
|
|
68
|
-
override fun setUserId(userId: String, promise: Promise) {
|
|
69
|
-
DaroSdkBridge.setUserId(context, userId)
|
|
70
|
-
promise.resolve(null)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
protected override fun getTypedExportedConstants(): MutableMap<String, Any> {
|
|
74
|
-
val constants = mutableMapOf<String, Any>()
|
|
75
|
-
constants.putAll(daroMInterstitialModule.getComponents())
|
|
76
|
-
constants.putAll(daroMRewardedModule.getComponents())
|
|
77
|
-
constants.putAll(daroMLightPopupModule.getComponents())
|
|
78
|
-
constants.putAll(daroMAppOpenModule.getComponents())
|
|
79
|
-
constants.putAll(daroMBannerModule.getComponents())
|
|
80
|
-
|
|
81
|
-
return constants
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
internal abstract class DaroMComponentModule(protected val context: ReactContext) {
|
|
85
|
-
abstract fun getComponents(): MutableMap<String, Any>
|
|
86
|
-
|
|
87
|
-
fun sendNativeEvent(event: DaroMEvent, params: WritableMap?) {
|
|
88
|
-
EventEmitterUtil.sendReactNativeEvent(
|
|
89
|
-
reactContext = context,
|
|
90
|
-
event = event,
|
|
91
|
-
params = params,
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
97
|
-
internal abstract class DaroMInterstitialModule(context: ReactContext) :
|
|
98
|
-
DaroMComponentModule(context) {
|
|
99
|
-
abstract fun isInterstitialReady(requestId: Int, adUnitId: String, promise: Promise)
|
|
100
|
-
abstract fun loadInterstitial(requestId: Int, adUnitId: String)
|
|
101
|
-
abstract fun showInterstitial(requestId: Int, adUnitId: String)
|
|
102
|
-
|
|
103
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
104
|
-
return InterstitialEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private val daroMInterstitialModule: DaroMInterstitialModule =
|
|
109
|
-
DaroMInterstitialModuleImpl(
|
|
110
|
-
context = reactContext,
|
|
111
|
-
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
@ReactMethod
|
|
115
|
-
override fun isInterstitialReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
116
|
-
daroMInterstitialModule.isInterstitialReady(requestId.toInt(), adUnitId, promise)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@ReactMethod
|
|
120
|
-
override fun loadInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
|
|
121
|
-
daroMInterstitialModule.loadInterstitial(requestId.toInt(), adUnitId)
|
|
122
|
-
promise.resolve(null)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@ReactMethod
|
|
126
|
-
override fun showInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
|
|
127
|
-
daroMInterstitialModule.showInterstitial(requestId.toInt(), adUnitId)
|
|
128
|
-
promise.resolve(null)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
132
|
-
internal abstract class DaroMRewardedModule(context: ReactContext) :
|
|
133
|
-
DaroMComponentModule(context) {
|
|
134
|
-
abstract fun isRewardedAdReady(requestId: Int, adUnitId: String, promise: Promise)
|
|
135
|
-
abstract fun loadRewardedAd(requestId: Int, adUnitId: String)
|
|
136
|
-
abstract fun showRewardedAd(requestId: Int, adUnitId: String, customData: String?)
|
|
137
|
-
|
|
138
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
139
|
-
return RewardedEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private val daroMRewardedModule: DaroMRewardedModule =
|
|
144
|
-
DaroMRewardedAdModuleImpl(
|
|
145
|
-
context = reactContext,
|
|
146
|
-
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
@ReactMethod
|
|
150
|
-
override fun isRewardedAdReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
151
|
-
daroMRewardedModule.isRewardedAdReady(requestId.toInt(), adUnitId, promise)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@ReactMethod
|
|
155
|
-
override fun loadRewardedAd(requestId: Double, adUnitId: String, promise: Promise) {
|
|
156
|
-
daroMRewardedModule.loadRewardedAd(requestId.toInt(), adUnitId)
|
|
157
|
-
promise.resolve(null)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
@ReactMethod
|
|
161
|
-
override fun showRewardedAd(
|
|
162
|
-
requestId: Double,
|
|
163
|
-
adUnitId: String,
|
|
164
|
-
customData: String?,
|
|
165
|
-
promise: Promise,
|
|
166
|
-
) {
|
|
167
|
-
daroMRewardedModule.showRewardedAd(requestId.toInt(), adUnitId, customData)
|
|
168
|
-
promise.resolve(null)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
172
|
-
internal abstract class DaroMLightPopupModule(context: ReactContext) :
|
|
173
|
-
DaroMComponentModule(context) {
|
|
174
|
-
abstract fun isLightPopupReady(requestId: Int, adUnitId: String, promise: Promise)
|
|
175
|
-
abstract fun loadLightPopup(requestId: Int, adUnitId: String)
|
|
176
|
-
abstract fun showLightPopup(requestId: Int, adUnitId: String)
|
|
177
|
-
|
|
178
|
-
abstract fun setLightPopupAdConfiguration(requestId: Int, adUnitId: String, parameterMap: ReadableMap)
|
|
179
|
-
|
|
180
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
181
|
-
return LightPopupEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
private val daroMLightPopupModule: DaroMLightPopupModule = DaroMLightPopupModuleImpl(
|
|
186
|
-
context = reactContext,
|
|
187
|
-
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
@ReactMethod
|
|
191
|
-
override fun isLightPopupReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
192
|
-
daroMLightPopupModule.isLightPopupReady(requestId.toInt(), adUnitId, promise)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
@ReactMethod
|
|
196
|
-
override fun loadLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
|
|
197
|
-
daroMLightPopupModule.loadLightPopup(requestId.toInt(), adUnitId)
|
|
198
|
-
promise.resolve(null)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
@ReactMethod
|
|
202
|
-
override fun showLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
|
|
203
|
-
daroMLightPopupModule.showLightPopup(requestId.toInt(), adUnitId)
|
|
204
|
-
promise.resolve(null)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
@ReactMethod
|
|
208
|
-
override fun setLightPopupAdConfiguration(
|
|
209
|
-
requestId: Double,
|
|
210
|
-
adUnitId: String,
|
|
211
|
-
configuration: ReadableMap,
|
|
212
|
-
promise: Promise,
|
|
213
|
-
) {
|
|
214
|
-
daroMLightPopupModule.setLightPopupAdConfiguration(requestId.toInt(), adUnitId, configuration)
|
|
215
|
-
promise.resolve(null)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
219
|
-
internal abstract class DaroMAppOpenModule(context: ReactContext) : DaroMComponentModule(context) {
|
|
220
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
221
|
-
return AppOpenEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private val daroMAppOpenModule: DaroMAppOpenModule = object : DaroMAppOpenModule(reactContext) {}
|
|
226
|
-
|
|
227
|
-
@ReactMethod
|
|
228
|
-
override fun isAppOpenAdReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
229
|
-
promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
@ReactMethod
|
|
233
|
-
override fun loadAppOpenAd(requestId: Double, adUnitId: String, promise: Promise) {
|
|
234
|
-
promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
@ReactMethod
|
|
238
|
-
override fun showAppOpenAd(
|
|
239
|
-
requestId: Double,
|
|
240
|
-
adUnitId: String,
|
|
241
|
-
placement: String?,
|
|
242
|
-
customData: String?,
|
|
243
|
-
promise: Promise,
|
|
244
|
-
) {
|
|
245
|
-
promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
249
|
-
internal abstract class DaroMBannerModule(context: ReactContext) : DaroMComponentModule(context) {
|
|
250
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
251
|
-
return InternalDaroMBannerSize.entries.associate { it.key to it.name }.toMutableMap()
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
private val daroMBannerModule: DaroMBannerModule =
|
|
256
|
-
DaroMBannerViewModuleImpl(context = reactContext)
|
|
257
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
#import <React/RCTDefines.h>
|
|
2
|
-
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
-
|
|
5
|
-
#import <React/RCTComponent.h>
|
|
6
|
-
#import <React/RCTFabricComponentsPlugins.h>
|
|
7
|
-
#import <React/RCTViewComponentView.h>
|
|
8
|
-
#import <react/renderer/components/DaroReactNativeSpec/ComponentDescriptors.h>
|
|
9
|
-
#import <react/renderer/components/DaroReactNativeSpec/EventEmitters.h>
|
|
10
|
-
#import <react/renderer/components/DaroReactNativeSpec/Props.h>
|
|
11
|
-
#import <react/renderer/components/DaroReactNativeSpec/RCTComponentViewHelpers.h>
|
|
12
|
-
#include <folly/dynamic.h>
|
|
13
|
-
#include <string>
|
|
14
|
-
|
|
15
|
-
using namespace facebook::react;
|
|
16
|
-
|
|
17
|
-
extern UIView *DaroMFabricCreateSwiftView(NSString *className);
|
|
18
|
-
extern void DaroMFabricSetValue(UIView *view, NSString *key, id value);
|
|
19
|
-
extern void DaroMFabricPerformSelector(UIView *view, SEL selector);
|
|
20
|
-
extern void DaroMFabricPerformSelectorWithObject(UIView *view, SEL selector, id object);
|
|
21
|
-
extern NSString *DaroMFabricNSStringFromStdString(const std::string &value);
|
|
22
|
-
extern NSDictionary *DaroMFabricEventBody(NSDictionary *body);
|
|
23
|
-
extern std::string DaroMFabricEventString(NSDictionary *body, NSString *key);
|
|
24
|
-
extern double DaroMFabricEventDouble(NSDictionary *body, NSString *key);
|
|
25
|
-
extern int DaroMFabricEventInt(NSDictionary *body, NSString *key);
|
|
26
|
-
|
|
27
|
-
@interface DaroMAdBannerViewComponentView : RCTViewComponentView <RCTDaroMAdBannerViewViewProtocol>
|
|
28
|
-
@end
|
|
29
|
-
|
|
30
|
-
@implementation DaroMAdBannerViewComponentView {
|
|
31
|
-
UIView *_bannerView;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
+ (void)load
|
|
35
|
-
{
|
|
36
|
-
[super load];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
40
|
-
{
|
|
41
|
-
if (self = [super initWithFrame:frame]) {
|
|
42
|
-
static const auto defaultProps = std::make_shared<const DaroMAdBannerViewProps>();
|
|
43
|
-
_props = defaultProps;
|
|
44
|
-
[self createBannerView];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return self;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (void)createBannerView
|
|
51
|
-
{
|
|
52
|
-
_bannerView = DaroMFabricCreateSwiftView(@"DaroMAdBannerView");
|
|
53
|
-
self.contentView = _bannerView;
|
|
54
|
-
[self installEventHandlers];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- (void)installEventHandlers
|
|
58
|
-
{
|
|
59
|
-
__weak DaroMAdBannerViewComponentView *weakSelf = self;
|
|
60
|
-
|
|
61
|
-
RCTDirectEventBlock onAdLoadedEvent = ^(NSDictionary *body) {
|
|
62
|
-
DaroMAdBannerViewComponentView *strongSelf = weakSelf;
|
|
63
|
-
if (!strongSelf) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
auto eventEmitter = std::static_pointer_cast<const DaroMAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
68
|
-
if (!eventEmitter) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
NSDictionary *eventBody = DaroMFabricEventBody(body);
|
|
73
|
-
eventEmitter->onAdLoadedEvent({
|
|
74
|
-
.adUnitId = DaroMFabricEventString(eventBody, @"adUnitId"),
|
|
75
|
-
.latencyMillis = DaroMFabricEventDouble(eventBody, @"latencyMillis"),
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
RCTDirectEventBlock onAdLoadFailedEvent = ^(NSDictionary *body) {
|
|
80
|
-
DaroMAdBannerViewComponentView *strongSelf = weakSelf;
|
|
81
|
-
if (!strongSelf) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
auto eventEmitter = std::static_pointer_cast<const DaroMAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
86
|
-
if (!eventEmitter) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
NSDictionary *eventBody = DaroMFabricEventBody(body);
|
|
91
|
-
eventEmitter->onAdLoadFailedEvent({
|
|
92
|
-
.adUnitId = DaroMFabricEventString(eventBody, @"adUnitId"),
|
|
93
|
-
.code = DaroMFabricEventInt(eventBody, @"code"),
|
|
94
|
-
.message = DaroMFabricEventString(eventBody, @"message"),
|
|
95
|
-
.latencyMillis = DaroMFabricEventDouble(eventBody, @"latencyMillis"),
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
RCTDirectEventBlock onAdClickedEvent = ^(NSDictionary *body) {
|
|
100
|
-
DaroMAdBannerViewComponentView *strongSelf = weakSelf;
|
|
101
|
-
if (!strongSelf) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
auto eventEmitter = std::static_pointer_cast<const DaroMAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
106
|
-
if (!eventEmitter) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
NSDictionary *eventBody = DaroMFabricEventBody(body);
|
|
111
|
-
eventEmitter->onAdClickedEvent({
|
|
112
|
-
.adUnitId = DaroMFabricEventString(eventBody, @"adUnitId"),
|
|
113
|
-
.latencyMillis = DaroMFabricEventDouble(eventBody, @"latencyMillis"),
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
RCTDirectEventBlock onAdImpressionRecordedEvent = ^(NSDictionary *body) {
|
|
118
|
-
DaroMAdBannerViewComponentView *strongSelf = weakSelf;
|
|
119
|
-
if (!strongSelf) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
auto eventEmitter = std::static_pointer_cast<const DaroMAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
124
|
-
if (!eventEmitter) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
NSDictionary *eventBody = DaroMFabricEventBody(body);
|
|
129
|
-
eventEmitter->onAdImpressionRecordedEvent({
|
|
130
|
-
.adUnitId = DaroMFabricEventString(eventBody, @"adUnitId"),
|
|
131
|
-
.latencyMillis = DaroMFabricEventDouble(eventBody, @"latencyMillis"),
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
DaroMFabricSetValue(_bannerView, @"onAdLoadedEvent", onAdLoadedEvent);
|
|
136
|
-
DaroMFabricSetValue(_bannerView, @"onAdLoadFailedEvent", onAdLoadFailedEvent);
|
|
137
|
-
DaroMFabricSetValue(_bannerView, @"onAdClickedEvent", onAdClickedEvent);
|
|
138
|
-
DaroMFabricSetValue(_bannerView, @"onAdImpressionRecordedEvent", onAdImpressionRecordedEvent);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
142
|
-
{
|
|
143
|
-
return concreteComponentDescriptorProvider<DaroMAdBannerViewComponentDescriptor>();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
147
|
-
{
|
|
148
|
-
const auto &oldComponentProps = *std::static_pointer_cast<const DaroMAdBannerViewProps>(_props);
|
|
149
|
-
const auto &newComponentProps = *std::static_pointer_cast<const DaroMAdBannerViewProps>(props);
|
|
150
|
-
NSMutableArray<NSString *> *changedProps = [NSMutableArray new];
|
|
151
|
-
|
|
152
|
-
if (oldComponentProps.adUnitId != newComponentProps.adUnitId) {
|
|
153
|
-
DaroMFabricSetValue(_bannerView, @"adUnitId", DaroMFabricNSStringFromStdString(newComponentProps.adUnitId));
|
|
154
|
-
[changedProps addObject:@"adUnitId"];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (oldComponentProps.adFormat != newComponentProps.adFormat) {
|
|
158
|
-
DaroMFabricSetValue(_bannerView, @"adFormat", DaroMFabricNSStringFromStdString(newComponentProps.adFormat));
|
|
159
|
-
[changedProps addObject:@"adFormat"];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (oldComponentProps.loadOnMount != newComponentProps.loadOnMount) {
|
|
163
|
-
DaroMFabricSetValue(_bannerView, @"loadOnMount", @(newComponentProps.loadOnMount));
|
|
164
|
-
[changedProps addObject:@"loadOnMount"];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (oldComponentProps.isVisible != newComponentProps.isVisible) {
|
|
168
|
-
DaroMFabricSetValue(_bannerView, @"isVisible", @(newComponentProps.isVisible));
|
|
169
|
-
[changedProps addObject:@"isVisible"];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
[super updateProps:props oldProps:oldProps];
|
|
173
|
-
|
|
174
|
-
DaroMFabricPerformSelectorWithObject(_bannerView, NSSelectorFromString(@"applyReactProps:"), changedProps);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
- (void)loadAd
|
|
178
|
-
{
|
|
179
|
-
DaroMFabricPerformSelector(_bannerView, NSSelectorFromString(@"loadAd"));
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
183
|
-
{
|
|
184
|
-
RCTDaroMAdBannerViewHandleCommand(self, commandName, args);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
- (void)prepareForRecycle
|
|
188
|
-
{
|
|
189
|
-
[super prepareForRecycle];
|
|
190
|
-
DaroMFabricSetValue(_bannerView, @"onAdLoadedEvent", nil);
|
|
191
|
-
DaroMFabricSetValue(_bannerView, @"onAdLoadFailedEvent", nil);
|
|
192
|
-
DaroMFabricSetValue(_bannerView, @"onAdClickedEvent", nil);
|
|
193
|
-
DaroMFabricSetValue(_bannerView, @"onAdImpressionRecordedEvent", nil);
|
|
194
|
-
DaroMFabricPerformSelector(_bannerView, NSSelectorFromString(@"prepareForReuse"));
|
|
195
|
-
[self installEventHandlers];
|
|
196
|
-
static const auto defaultProps = std::make_shared<const DaroMAdBannerViewProps>();
|
|
197
|
-
_props = defaultProps;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
@end
|
|
201
|
-
|
|
202
|
-
Class<RCTComponentViewProtocol> DaroMAdBannerViewCls(void)
|
|
203
|
-
{
|
|
204
|
-
return DaroMAdBannerViewComponentView.class;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
#endif
|