react-native-daro 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +11 -1
- package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +34 -11
- package/android/src/main/java/com/daro/reactnative/DaroMAdNativeViewManager.kt +79 -48
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +80 -25
- package/android/src/main/java/com/daro/reactnative/DaroMPackage.kt +28 -4
- package/android/src/main/java/com/daro/reactnative/DaroMediaViewManager.kt +25 -0
- package/android/src/main/java/com/daro/reactnative/event/DaroMEvent.kt +18 -7
- package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +18 -5
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdNativeViewContainer.kt +301 -52
- package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +123 -0
- package/android/src/newarch/java/com/daro/reactnative/DaroMModuleSpec.kt +6 -0
- package/android/src/oldarch/java/com/daro/reactnative/DaroMModuleSpec.kt +90 -0
- package/ios/DaroMModule+AppOpen.swift +13 -10
- package/ios/DaroMModule+Interstitial.swift +12 -9
- package/ios/DaroMModule+LightPopup.swift +16 -13
- package/ios/DaroMModule+Rewarded.swift +12 -9
- package/ios/DaroMModule.mm +45 -17
- package/ios/DaroMModule.swift +4 -4
- package/ios/Fabric/DaroMAdBannerComponentView.mm +207 -0
- package/ios/Fabric/DaroMFabricEventSink.mm +31 -0
- package/ios/Fabric/DaroMFabricPropApplier.mm +123 -0
- package/ios/Fabric/DaroMNativeAdComponentView.mm +294 -0
- package/ios/{DaroMAdBannerViewManager.m → Paper/DaroMAdBannerViewManager.m} +3 -1
- package/ios/Paper/DaroMAdBannerViewManager.swift +21 -0
- package/ios/{DaroMNativeAdViewManager.m → Paper/DaroMNativeAdViewManager.m} +2 -1
- package/ios/Paper/DaroMNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMAdEventSink.swift +24 -0
- package/ios/Shared/DaroMBannerAdView.swift +188 -0
- package/ios/Shared/DaroMNativeAdLoadCoordinator.swift +49 -0
- package/ios/Shared/DaroMNativeAdView.swift +575 -0
- package/ios/Shared/DaroMNativeAssetResolver.swift +53 -0
- package/ios/mediation/admob/DaroMediationTypes.swift +1 -0
- package/lib/commonjs/AdBannerView.js +20 -39
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +43 -10
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/commonjs/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/commonjs/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/commonjs/EventEmitter.js +4 -5
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +9 -11
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +11 -12
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js +9 -0
- package/lib/commonjs/NativeDaroModule.js.map +1 -0
- package/lib/commonjs/RewardedAd.js +9 -11
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/codegen-env.d.js +2 -0
- package/lib/commonjs/codegen-env.d.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +110 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useLightPopupAd.js +114 -0
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +113 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/index.js +29 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +23 -22
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +43 -31
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +34 -7
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/AdBannerView.js +19 -40
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +43 -11
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/module/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/module/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/module/EventEmitter.js +4 -6
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +8 -11
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +11 -13
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js +5 -0
- package/lib/module/NativeDaroModule.js.map +1 -0
- package/lib/module/RewardedAd.js +8 -11
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/codegen-env.d.js +2 -0
- package/lib/module/codegen-env.d.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +106 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useLightPopupAd.js +110 -0
- package/lib/module/hooks/useLightPopupAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +109 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/index.js +7 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +22 -23
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +45 -34
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +35 -8
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/typescript/commonjs/plugin/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AdBannerView.d.ts +2 -2
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/module/src/AdBannerView.d.ts +2 -2
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +12 -5
- package/plugin/build/index.d.ts +1 -1
- package/plugin/build/withAndroid.js +99 -17
- package/plugin/build/withIos.js +4 -5
- package/react-native-daro.podspec +3 -0
- package/src/AdBannerView.tsx +24 -61
- package/src/AppOpenAd.ts +46 -9
- package/src/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/src/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/src/DaroMediaViewNativeComponent.ts +9 -0
- package/src/EventEmitter.ts +4 -5
- package/src/InterstitialAd.ts +8 -10
- package/src/LightPopupAd.ts +11 -12
- package/src/NativeDaroModule.ts +91 -0
- package/src/RewardedAd.ts +8 -10
- package/src/codegen-env.d.ts +45 -0
- package/src/hooks/useInterstitialAd.ts +117 -0
- package/src/hooks/useLightPopupAd.ts +132 -0
- package/src/hooks/useRewardedAd.ts +122 -0
- package/src/index.tsx +21 -22
- package/src/nativeAd/NativeAdView.tsx +41 -54
- package/src/nativeAd/NativeAdViewComponents.tsx +80 -42
- package/src/nativeAd/NativeAdViewProvider.tsx +75 -17
- package/src/types/NativeAdViewProps.ts +7 -0
- package/ios/DaroMAdBannerViewManager.swift +0 -91
- package/ios/DaroMNativeAdViewManager.swift +0 -291
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ import groovy.json.JsonSlurper
|
|
|
3
3
|
buildscript {
|
|
4
4
|
ext.DaroReactNative = [
|
|
5
5
|
kotlinVersion: "2.0.21",
|
|
6
|
-
minSdkVersion:
|
|
6
|
+
minSdkVersion: 23,
|
|
7
7
|
compileSdkVersion: 36,
|
|
8
8
|
targetSdkVersion: 36
|
|
9
9
|
]
|
|
@@ -44,15 +44,24 @@ def mediation =
|
|
|
44
44
|
packageName == "react-native-daro" ? "admob" :
|
|
45
45
|
localMediation == "max" ? "max" : "admob"
|
|
46
46
|
def daroSdkDependency = mediation == "max" ? "so.daro:daro-m:1.3.8" : "so.daro:daro-a:1.5.5"
|
|
47
|
+
def isNewArchitectureEnabled =
|
|
48
|
+
(project.hasProperty("newArchEnabled") && project.property("newArchEnabled").toString().toBoolean()) ||
|
|
49
|
+
(project.hasProperty("react.newArchEnabled") && project.property("react.newArchEnabled").toString().toBoolean())
|
|
50
|
+
def architectureSourceSet = isNewArchitectureEnabled ? "newarch" : "oldarch"
|
|
47
51
|
|
|
48
52
|
android {
|
|
49
53
|
namespace "com.daro.reactnative"
|
|
50
54
|
|
|
51
55
|
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
52
56
|
|
|
57
|
+
buildFeatures {
|
|
58
|
+
buildConfig true
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
defaultConfig {
|
|
54
62
|
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
55
63
|
targetSdkVersion getExtOrDefault("targetSdkVersion")
|
|
64
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
buildTypes {
|
|
@@ -64,6 +73,7 @@ android {
|
|
|
64
73
|
sourceSets {
|
|
65
74
|
main {
|
|
66
75
|
java.srcDirs += "src/${mediation}/java"
|
|
76
|
+
java.srcDirs += "src/${architectureSourceSet}/java"
|
|
67
77
|
}
|
|
68
78
|
}
|
|
69
79
|
|
|
@@ -8,9 +8,18 @@ import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
|
8
8
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
9
9
|
import com.facebook.react.uimanager.StateWrapper
|
|
10
10
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
11
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
11
12
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
13
|
+
import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerDelegate
|
|
14
|
+
import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerInterface
|
|
12
15
|
|
|
13
|
-
class DaroMAdBannerViewManager : SimpleViewManager<DaroMAdBannerViewContainer>()
|
|
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
|
|
14
23
|
|
|
15
24
|
override fun getName(): String {
|
|
16
25
|
return "DaroMAdBannerView"
|
|
@@ -46,7 +55,7 @@ class DaroMAdBannerViewManager : SimpleViewManager<DaroMAdBannerViewContainer>()
|
|
|
46
55
|
viewCache[cacheKey].let { cachedView ->
|
|
47
56
|
cachedView?.id = reactTag
|
|
48
57
|
|
|
49
|
-
if(cachedView?.parent == null) {
|
|
58
|
+
if (cachedView?.parent == null) {
|
|
50
59
|
cachedView?.resumeAd()
|
|
51
60
|
cachedView
|
|
52
61
|
} else {
|
|
@@ -99,34 +108,48 @@ class DaroMAdBannerViewManager : SimpleViewManager<DaroMAdBannerViewContainer>()
|
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
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
|
+
|
|
102
121
|
@ReactProp(name = "isVisible")
|
|
103
|
-
fun setIsVisible(view: DaroMAdBannerViewContainer, isVisible: Boolean) {
|
|
122
|
+
override fun setIsVisible(view: DaroMAdBannerViewContainer, isVisible: Boolean) {
|
|
104
123
|
view.setAdVisibility(isVisible)
|
|
105
124
|
}
|
|
106
125
|
|
|
107
126
|
@ReactProp(name = "adUnitId")
|
|
108
|
-
fun setAdUnitId(view: DaroMAdBannerViewContainer, adUnitId: String) {
|
|
109
|
-
view.adUnitId = adUnitId
|
|
127
|
+
override fun setAdUnitId(view: DaroMAdBannerViewContainer, adUnitId: String?) {
|
|
128
|
+
view.adUnitId = adUnitId.orEmpty()
|
|
110
129
|
}
|
|
111
130
|
|
|
112
131
|
@ReactProp(name = "adFormat")
|
|
113
|
-
fun setAdFormat(view: DaroMAdBannerViewContainer, adFormat: String) {
|
|
114
|
-
view.adSize = InternalDaroMBannerSize.fromName(
|
|
132
|
+
override fun setAdFormat(view: DaroMAdBannerViewContainer, adFormat: String?) {
|
|
133
|
+
view.adSize = adFormat?.let { InternalDaroMBannerSize.fromName(it).toBannerSize() }
|
|
115
134
|
}
|
|
116
135
|
|
|
117
136
|
@ReactProp(name = "loadOnMount")
|
|
118
|
-
fun setLoadOnMount(view: DaroMAdBannerViewContainer, loadOnMount: Boolean) {
|
|
137
|
+
override fun setLoadOnMount(view: DaroMAdBannerViewContainer, loadOnMount: Boolean) {
|
|
119
138
|
view.loadOnMount = loadOnMount
|
|
120
139
|
}
|
|
121
140
|
|
|
122
141
|
@ReactProp(name = "placement")
|
|
123
|
-
fun setPlacement(view: DaroMAdBannerViewContainer, placement: String) {
|
|
142
|
+
override fun setPlacement(view: DaroMAdBannerViewContainer, placement: String?) {
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
override fun loadAd(view: DaroMAdBannerViewContainer) {
|
|
146
|
+
view.loadAd()
|
|
124
147
|
}
|
|
125
148
|
|
|
126
149
|
@OptIn(ExperimentalStdlibApi::class)
|
|
127
|
-
override fun
|
|
150
|
+
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
|
|
128
151
|
return AdViewEvent.entries.associate {
|
|
129
|
-
it.value to mutableMapOf("
|
|
152
|
+
it.value to mutableMapOf("registrationName" to it.registrationName)
|
|
130
153
|
}.toMutableMap()
|
|
131
154
|
}
|
|
132
155
|
}
|
|
@@ -1,68 +1,60 @@
|
|
|
1
1
|
package com.daro.reactnative
|
|
2
2
|
|
|
3
|
+
import android.view.View
|
|
3
4
|
import com.daro.reactnative.event.AdViewEvent
|
|
4
|
-
import com.daro.reactnative.view.DaroMAdBannerViewContainer
|
|
5
5
|
import com.daro.reactnative.view.DaroMAdNativeViewContainer
|
|
6
|
+
import com.facebook.react.bridge.Dynamic
|
|
6
7
|
import com.facebook.react.bridge.ReadableArray
|
|
7
|
-
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
8
|
-
import com.facebook.react.uimanager.StateWrapper
|
|
9
8
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
10
10
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
11
11
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
12
|
+
import com.facebook.react.viewmanagers.DaroMNativeAdViewManagerDelegate
|
|
13
|
+
import com.facebook.react.viewmanagers.DaroMNativeAdViewManagerInterface
|
|
12
14
|
|
|
13
|
-
class DaroMAdNativeViewManager : ViewGroupManager<DaroMAdNativeViewContainer>()
|
|
15
|
+
class DaroMAdNativeViewManager : ViewGroupManager<DaroMAdNativeViewContainer>(),
|
|
16
|
+
DaroMNativeAdViewManagerInterface<DaroMAdNativeViewContainer> {
|
|
17
|
+
|
|
18
|
+
private val delegate: ViewManagerDelegate<DaroMAdNativeViewContainer> =
|
|
19
|
+
DaroMNativeAdViewManagerDelegate(this)
|
|
20
|
+
|
|
21
|
+
override fun getDelegate(): ViewManagerDelegate<DaroMAdNativeViewContainer> = delegate
|
|
14
22
|
|
|
15
23
|
override fun getName(): String {
|
|
16
24
|
return "DaroMNativeAdView"
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
override fun createViewInstance(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
initialProps: ReactStylesDiffMap?,
|
|
23
|
-
stateWrapper: StateWrapper?,
|
|
24
|
-
): DaroMAdNativeViewContainer {
|
|
25
|
-
val placement = initialProps?.getString("placement")
|
|
26
|
-
val adUnitId = initialProps?.getString("adUnitId")
|
|
27
|
-
|
|
28
|
-
val key = "{$adUnitId}_${placement}"
|
|
27
|
+
override fun createViewInstance(context: ThemedReactContext): DaroMAdNativeViewContainer {
|
|
28
|
+
return DaroMAdNativeViewContainer(context)
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
viewCache.remove(it)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
31
|
+
override fun addView(parent: DaroMAdNativeViewContainer, child: View, index: Int) {
|
|
32
|
+
parent.addReactSubview(child, index)
|
|
33
|
+
}
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
override fun getChildCount(parent: DaroMAdNativeViewContainer): Int {
|
|
36
|
+
return parent.getReactSubviewCount()
|
|
37
|
+
}
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
override fun getChildAt(parent: DaroMAdNativeViewContainer, index: Int): View {
|
|
40
|
+
return parent.getReactSubviewAt(index)
|
|
41
|
+
}
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} ?: super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper).also {
|
|
49
|
-
if (key.isNotEmpty()) viewCache[key + reactContext.hashCode()] = it
|
|
50
|
-
}
|
|
43
|
+
override fun removeViewAt(parent: DaroMAdNativeViewContainer, index: Int) {
|
|
44
|
+
parent.removeReactSubviewAt(index)
|
|
51
45
|
}
|
|
52
46
|
|
|
53
|
-
override fun
|
|
54
|
-
|
|
47
|
+
override fun removeAllViews(parent: DaroMAdNativeViewContainer) {
|
|
48
|
+
parent.removeAllReactSubviews()
|
|
55
49
|
}
|
|
56
50
|
|
|
57
51
|
companion object {
|
|
58
52
|
private const val COMMAND_LOAD_AD: Int = 1
|
|
59
|
-
|
|
60
|
-
private val viewCache: MutableMap<String, DaroMAdNativeViewContainer> = mutableMapOf()
|
|
61
53
|
}
|
|
62
54
|
|
|
63
|
-
override fun
|
|
55
|
+
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
|
|
64
56
|
return AdViewEvent.entries.associate {
|
|
65
|
-
it.value to mutableMapOf("
|
|
57
|
+
it.value to mutableMapOf("registrationName" to it.registrationName)
|
|
66
58
|
}.toMutableMap()
|
|
67
59
|
}
|
|
68
60
|
|
|
@@ -85,43 +77,82 @@ class DaroMAdNativeViewManager : ViewGroupManager<DaroMAdNativeViewContainer>()
|
|
|
85
77
|
}
|
|
86
78
|
}
|
|
87
79
|
|
|
80
|
+
override fun receiveCommand(
|
|
81
|
+
root: DaroMAdNativeViewContainer,
|
|
82
|
+
commandId: String,
|
|
83
|
+
args: ReadableArray?,
|
|
84
|
+
) {
|
|
85
|
+
when (commandId) {
|
|
86
|
+
"loadAd" -> root.loadAd()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
88
90
|
@ReactProp(name = "adUnitId")
|
|
89
|
-
fun setAdUnitId(view: DaroMAdNativeViewContainer, adUnitId: String) {
|
|
90
|
-
view.adUnitId = adUnitId
|
|
91
|
+
override fun setAdUnitId(view: DaroMAdNativeViewContainer, adUnitId: String?) {
|
|
92
|
+
view.adUnitId = adUnitId.orEmpty()
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
@ReactProp(name = "loadOnMount")
|
|
94
|
-
fun setLoadOnMount(view: DaroMAdNativeViewContainer, loadOnMount: Boolean) {
|
|
96
|
+
override fun setLoadOnMount(view: DaroMAdNativeViewContainer, loadOnMount: Boolean) {
|
|
95
97
|
view.loadOnMount = loadOnMount
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
@ReactProp(name = "adChoicesPosition")
|
|
101
|
+
override fun setAdChoicesPosition(view: DaroMAdNativeViewContainer, value: String?) {
|
|
102
|
+
view.setAdChoicesPosition(value)
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
@ReactProp(name = "titleView")
|
|
99
|
-
fun setTitleView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
106
|
+
override fun setTitleView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
100
107
|
view.setTitleView(value)
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
@ReactProp(name = "bodyView")
|
|
104
|
-
fun setBodyView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
111
|
+
override fun setBodyView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
105
112
|
view.setBodyView(value)
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
@ReactProp(name = "callToActionView")
|
|
109
|
-
fun setCallToActionView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
116
|
+
override fun setCallToActionView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
110
117
|
view.setCallToActionView(value)
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
@ReactProp(name = "iconView")
|
|
114
|
-
fun setIconView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
121
|
+
override fun setIconView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
115
122
|
view.setIconView(value)
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
@ReactProp(name = "mediaView")
|
|
119
|
-
fun setMediaView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
126
|
+
override fun setMediaView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
120
127
|
view.setMediaView(value)
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
@ReactProp(name = "placement")
|
|
124
|
-
fun setPlacement(view:
|
|
131
|
+
override fun setPlacement(view: DaroMAdNativeViewContainer, placement: String?) {
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@ReactProp(name = "titleViewStyleProps")
|
|
135
|
+
override fun setTitleViewStyleProps(view: DaroMAdNativeViewContainer, value: Dynamic) {
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@ReactProp(name = "bodyViewStyleProps")
|
|
139
|
+
override fun setBodyViewStyleProps(view: DaroMAdNativeViewContainer, value: Dynamic) {
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@ReactProp(name = "callToActionViewStyleProps")
|
|
143
|
+
override fun setCallToActionViewStyleProps(view: DaroMAdNativeViewContainer, value: Dynamic) {
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@ReactProp(name = "iconViewStyleProps")
|
|
147
|
+
override fun setIconViewStyleProps(view: DaroMAdNativeViewContainer, value: Dynamic) {
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@ReactProp(name = "mediaViewStyleProps")
|
|
151
|
+
override fun setMediaViewStyleProps(view: DaroMAdNativeViewContainer, value: Dynamic) {
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
override fun loadAd(view: DaroMAdNativeViewContainer) {
|
|
155
|
+
view.loadAd()
|
|
125
156
|
}
|
|
126
157
|
|
|
127
158
|
override fun onAfterUpdateTransaction(view: DaroMAdNativeViewContainer) {
|
|
@@ -131,6 +162,6 @@ class DaroMAdNativeViewManager : ViewGroupManager<DaroMAdNativeViewContainer>()
|
|
|
131
162
|
|
|
132
163
|
override fun onDropViewInstance(view: DaroMAdNativeViewContainer) {
|
|
133
164
|
super.onDropViewInstance(view)
|
|
134
|
-
|
|
165
|
+
view.destroy()
|
|
135
166
|
}
|
|
136
167
|
}
|
|
@@ -3,6 +3,7 @@ package com.daro.reactnative
|
|
|
3
3
|
import android.app.Application
|
|
4
4
|
import android.content.Context
|
|
5
5
|
import com.daro.reactnative.constants.InternalDaroMBannerSize
|
|
6
|
+
import com.daro.reactnative.event.AppOpenEvent
|
|
6
7
|
import com.daro.reactnative.event.DaroMEvent
|
|
7
8
|
import com.daro.reactnative.event.InterstitialEvent
|
|
8
9
|
import com.daro.reactnative.event.LightPopupEvent
|
|
@@ -15,21 +16,18 @@ import com.daro.reactnative.util.EventEmitterUtil
|
|
|
15
16
|
import com.facebook.react.bridge.Promise
|
|
16
17
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
17
18
|
import com.facebook.react.bridge.ReactContext
|
|
18
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
19
19
|
import com.facebook.react.bridge.ReactMethod
|
|
20
20
|
import com.facebook.react.bridge.ReadableMap
|
|
21
21
|
import com.facebook.react.bridge.WritableMap
|
|
22
22
|
import droom.daro.SDKConfig
|
|
23
23
|
|
|
24
24
|
class DaroMModule(reactContext: ReactApplicationContext) :
|
|
25
|
-
|
|
25
|
+
DaroMModuleSpec(reactContext) {
|
|
26
26
|
|
|
27
27
|
companion object {
|
|
28
28
|
const val NAME = "DaroMModule"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
override fun getName(): String {
|
|
32
|
-
return NAME
|
|
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"
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
private val context: Context = reactApplicationContext
|
|
@@ -37,7 +35,13 @@ class DaroMModule(reactContext: ReactApplicationContext) :
|
|
|
37
35
|
private var isInitialized: Boolean = false
|
|
38
36
|
|
|
39
37
|
@ReactMethod
|
|
40
|
-
fun
|
|
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) {
|
|
41
45
|
DaroSdkBridge.initialize(
|
|
42
46
|
application = context.applicationContext as Application,
|
|
43
47
|
sdkConfig = SDKConfig.Builder()
|
|
@@ -46,28 +50,32 @@ class DaroMModule(reactContext: ReactApplicationContext) :
|
|
|
46
50
|
)
|
|
47
51
|
|
|
48
52
|
isInitialized = true
|
|
53
|
+
promise.resolve(null)
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
@ReactMethod
|
|
52
|
-
fun isInitialized(promise: Promise) {
|
|
57
|
+
override fun isInitialized(promise: Promise) {
|
|
53
58
|
promise.resolve(isInitialized)
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
@ReactMethod
|
|
57
|
-
fun showMediationDebugger() {
|
|
62
|
+
override fun showMediationDebugger(promise: Promise) {
|
|
58
63
|
DaroSdkBridge.openDebugger(context)
|
|
64
|
+
promise.resolve(null)
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
@ReactMethod
|
|
62
|
-
fun setUserId(userId: String) {
|
|
68
|
+
override fun setUserId(userId: String, promise: Promise) {
|
|
63
69
|
DaroSdkBridge.setUserId(context, userId)
|
|
70
|
+
promise.resolve(null)
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
override fun
|
|
73
|
+
protected override fun getTypedExportedConstants(): MutableMap<String, Any> {
|
|
67
74
|
val constants = mutableMapOf<String, Any>()
|
|
68
75
|
constants.putAll(daroMInterstitialModule.getComponents())
|
|
69
76
|
constants.putAll(daroMRewardedModule.getComponents())
|
|
70
77
|
constants.putAll(daroMLightPopupModule.getComponents())
|
|
78
|
+
constants.putAll(daroMAppOpenModule.getComponents())
|
|
71
79
|
constants.putAll(daroMBannerModule.getComponents())
|
|
72
80
|
|
|
73
81
|
return constants
|
|
@@ -100,22 +108,24 @@ class DaroMModule(reactContext: ReactApplicationContext) :
|
|
|
100
108
|
private val daroMInterstitialModule: DaroMInterstitialModule =
|
|
101
109
|
DaroMInterstitialModuleImpl(
|
|
102
110
|
context = reactContext,
|
|
103
|
-
getCurrentActivity = {
|
|
111
|
+
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
104
112
|
)
|
|
105
113
|
|
|
106
114
|
@ReactMethod
|
|
107
|
-
fun isInterstitialReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
115
|
+
override fun isInterstitialReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
108
116
|
daroMInterstitialModule.isInterstitialReady(requestId.toInt(), adUnitId, promise)
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
@ReactMethod
|
|
112
|
-
fun loadInterstitial(requestId: Double, adUnitId: String) {
|
|
120
|
+
override fun loadInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
|
|
113
121
|
daroMInterstitialModule.loadInterstitial(requestId.toInt(), adUnitId)
|
|
122
|
+
promise.resolve(null)
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
@ReactMethod
|
|
117
|
-
fun showInterstitial(requestId: Double, adUnitId: String) {
|
|
126
|
+
override fun showInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
|
|
118
127
|
daroMInterstitialModule.showInterstitial(requestId.toInt(), adUnitId)
|
|
128
|
+
promise.resolve(null)
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
@OptIn(ExperimentalStdlibApi::class)
|
|
@@ -133,22 +143,29 @@ class DaroMModule(reactContext: ReactApplicationContext) :
|
|
|
133
143
|
private val daroMRewardedModule: DaroMRewardedModule =
|
|
134
144
|
DaroMRewardedAdModuleImpl(
|
|
135
145
|
context = reactContext,
|
|
136
|
-
getCurrentActivity = {
|
|
146
|
+
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
137
147
|
)
|
|
138
148
|
|
|
139
149
|
@ReactMethod
|
|
140
|
-
fun isRewardedAdReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
150
|
+
override fun isRewardedAdReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
141
151
|
daroMRewardedModule.isRewardedAdReady(requestId.toInt(), adUnitId, promise)
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
@ReactMethod
|
|
145
|
-
fun loadRewardedAd(requestId: Double, adUnitId: String) {
|
|
155
|
+
override fun loadRewardedAd(requestId: Double, adUnitId: String, promise: Promise) {
|
|
146
156
|
daroMRewardedModule.loadRewardedAd(requestId.toInt(), adUnitId)
|
|
157
|
+
promise.resolve(null)
|
|
147
158
|
}
|
|
148
159
|
|
|
149
160
|
@ReactMethod
|
|
150
|
-
fun showRewardedAd(
|
|
161
|
+
override fun showRewardedAd(
|
|
162
|
+
requestId: Double,
|
|
163
|
+
adUnitId: String,
|
|
164
|
+
customData: String?,
|
|
165
|
+
promise: Promise,
|
|
166
|
+
) {
|
|
151
167
|
daroMRewardedModule.showRewardedAd(requestId.toInt(), adUnitId, customData)
|
|
168
|
+
promise.resolve(null)
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
@OptIn(ExperimentalStdlibApi::class)
|
|
@@ -167,27 +184,65 @@ class DaroMModule(reactContext: ReactApplicationContext) :
|
|
|
167
184
|
|
|
168
185
|
private val daroMLightPopupModule: DaroMLightPopupModule = DaroMLightPopupModuleImpl(
|
|
169
186
|
context = reactContext,
|
|
170
|
-
getCurrentActivity = {
|
|
187
|
+
getCurrentActivity = { reactApplicationContext.currentActivity }
|
|
171
188
|
)
|
|
172
189
|
|
|
173
190
|
@ReactMethod
|
|
174
|
-
fun isLightPopupReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
191
|
+
override fun isLightPopupReady(requestId: Double, adUnitId: String, promise: Promise) {
|
|
175
192
|
daroMLightPopupModule.isLightPopupReady(requestId.toInt(), adUnitId, promise)
|
|
176
193
|
}
|
|
177
194
|
|
|
178
195
|
@ReactMethod
|
|
179
|
-
fun loadLightPopup(requestId: Double, adUnitId: String) {
|
|
196
|
+
override fun loadLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
|
|
180
197
|
daroMLightPopupModule.loadLightPopup(requestId.toInt(), adUnitId)
|
|
198
|
+
promise.resolve(null)
|
|
181
199
|
}
|
|
182
200
|
|
|
183
201
|
@ReactMethod
|
|
184
|
-
fun showLightPopup(requestId: Double, adUnitId: String) {
|
|
202
|
+
override fun showLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
|
|
185
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)
|
|
186
235
|
}
|
|
187
236
|
|
|
188
237
|
@ReactMethod
|
|
189
|
-
fun
|
|
190
|
-
|
|
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)
|
|
191
246
|
}
|
|
192
247
|
|
|
193
248
|
@OptIn(ExperimentalStdlibApi::class)
|
|
@@ -1,21 +1,45 @@
|
|
|
1
|
+
@file:Suppress("DEPRECATION")
|
|
2
|
+
|
|
1
3
|
package com.daro.reactnative
|
|
2
4
|
|
|
3
|
-
import com.facebook.react.
|
|
5
|
+
import com.facebook.react.TurboReactPackage
|
|
4
6
|
import com.facebook.react.bridge.NativeModule
|
|
5
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
9
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
6
10
|
import com.facebook.react.uimanager.ViewManager
|
|
7
11
|
|
|
8
12
|
|
|
9
|
-
class DaroMPackage :
|
|
13
|
+
class DaroMPackage : TurboReactPackage() {
|
|
10
14
|
|
|
11
|
-
override fun
|
|
12
|
-
return
|
|
15
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
16
|
+
return when (name) {
|
|
17
|
+
DaroMModule.NAME -> DaroMModule(reactContext)
|
|
18
|
+
else -> null
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
16
23
|
return listOf(
|
|
17
24
|
DaroMAdBannerViewManager(),
|
|
18
25
|
DaroMAdNativeViewManager(),
|
|
26
|
+
DaroMediaViewManager(),
|
|
19
27
|
)
|
|
20
28
|
}
|
|
29
|
+
|
|
30
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
31
|
+
return ReactModuleInfoProvider {
|
|
32
|
+
mapOf(
|
|
33
|
+
DaroMModule.NAME to ReactModuleInfo(
|
|
34
|
+
DaroMModule.NAME,
|
|
35
|
+
DaroMModule::class.java.name,
|
|
36
|
+
false,
|
|
37
|
+
false,
|
|
38
|
+
true,
|
|
39
|
+
false,
|
|
40
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
21
45
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.daro.reactnative
|
|
2
|
+
|
|
3
|
+
import com.daro.reactnative.view.DaroMediaView
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
6
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
7
|
+
import com.facebook.react.viewmanagers.DaroMediaViewManagerDelegate
|
|
8
|
+
import com.facebook.react.viewmanagers.DaroMediaViewManagerInterface
|
|
9
|
+
|
|
10
|
+
class DaroMediaViewManager : ViewGroupManager<DaroMediaView>(),
|
|
11
|
+
DaroMediaViewManagerInterface<DaroMediaView> {
|
|
12
|
+
|
|
13
|
+
private val delegate: ViewManagerDelegate<DaroMediaView> =
|
|
14
|
+
DaroMediaViewManagerDelegate(this)
|
|
15
|
+
|
|
16
|
+
override fun getDelegate(): ViewManagerDelegate<DaroMediaView> = delegate
|
|
17
|
+
|
|
18
|
+
override fun getName(): String {
|
|
19
|
+
return "DaroMediaView"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override fun createViewInstance(context: ThemedReactContext): DaroMediaView {
|
|
23
|
+
return DaroMediaView(context)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -44,14 +44,25 @@ internal enum class LightPopupEvent : DaroMEvent {
|
|
|
44
44
|
get() = name
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
internal enum class
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
internal enum class AppOpenEvent : DaroMEvent {
|
|
48
|
+
ON_APPOPEN_AD_LOADED_EVENT,
|
|
49
|
+
ON_APPOPEN_AD_LOAD_FAILED_EVENT,
|
|
50
|
+
ON_APPOPEN_AD_CLICKED_EVENT,
|
|
51
|
+
ON_APPOPEN_AD_DISPLAYED_EVENT,
|
|
52
|
+
ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT,
|
|
53
|
+
ON_APPOPEN_AD_HIDDEN_EVENT,
|
|
54
|
+
ON_APPOPEN_AD_IMPRESSION_RECORDED;
|
|
54
55
|
|
|
55
56
|
override val value: String
|
|
56
57
|
get() = name
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
internal enum class AdViewEvent(
|
|
61
|
+
val registrationName: String,
|
|
62
|
+
override val value: String,
|
|
63
|
+
): DaroMEvent {
|
|
64
|
+
ON_AD_CLICKED("onAdClickedEvent", "topAdClickedEvent"),
|
|
65
|
+
ON_AD_FAILED_TO_LOAD("onAdLoadFailedEvent", "topAdLoadFailedEvent"),
|
|
66
|
+
ON_AD_IMPRESSION("onAdImpressionRecordedEvent", "topAdImpressionRecordedEvent"),
|
|
67
|
+
ON_AD_LOADED("onAdLoadedEvent", "topAdLoadedEvent");
|
|
68
|
+
}
|