react-native-daro 1.0.13 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +30 -30
- package/android/build.gradle +52 -59
- package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +23 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdBannerViewManager.kt +38 -15
- package/android/src/main/java/com/daro/reactnative/DaroMAdNativeViewManager.kt +167 -0
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +257 -0
- package/android/src/main/java/com/daro/reactnative/DaroMPackage.kt +45 -0
- package/android/src/main/java/com/daro/reactnative/DaroMediaViewManager.kt +25 -0
- package/android/src/main/java/com/{darom → daro/reactnative}/constants/InternalDaroMBannerSize.kt +1 -1
- package/android/src/main/java/com/{darom → daro/reactnative}/event/DaroMEvent.kt +19 -8
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMBannerViewModuleImpl.kt +2 -2
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMInterstitialModuleImpl.kt +26 -26
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMLightPopupModuleImpl.kt +30 -29
- package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMRewardedAdModuleImpl.kt +27 -27
- package/android/src/main/java/com/{darom → daro/reactnative}/util/AdInfoUtil.kt +25 -1
- package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +37 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdBannerViewContainer.kt +417 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdNativeViewContainer.kt +624 -0
- package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +123 -0
- package/android/src/newarch/java/com/daro/reactnative/DaroMModuleSpec.kt +6 -0
- package/android/src/oldarch/java/com/daro/reactnative/DaroMModuleSpec.kt +90 -0
- package/app.plugin.js +1 -0
- package/ios/DaroMModule+AppOpen.swift +38 -32
- package/ios/DaroMModule+Interstitial.swift +32 -26
- package/ios/DaroMModule+LightPopup.swift +43 -33
- package/ios/DaroMModule+Rewarded.swift +38 -27
- package/ios/DaroMModule.mm +45 -17
- package/ios/DaroMModule.swift +24 -17
- package/ios/Fabric/DaroMAdBannerComponentView.mm +207 -0
- package/ios/Fabric/DaroMFabricEventSink.mm +31 -0
- package/ios/Fabric/DaroMFabricPropApplier.mm +123 -0
- package/ios/Fabric/DaroMNativeAdComponentView.mm +294 -0
- package/ios/{DaroMAdBannerViewManager.m → Paper/DaroMAdBannerViewManager.m} +3 -1
- package/ios/Paper/DaroMAdBannerViewManager.swift +21 -0
- package/ios/{DaroMNativeAdViewManager.m → Paper/DaroMNativeAdViewManager.m} +2 -1
- package/ios/Paper/DaroMNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMAdEventSink.swift +24 -0
- package/ios/Shared/DaroMBannerAdView.swift +188 -0
- package/ios/Shared/DaroMNativeAdLoadCoordinator.swift +49 -0
- package/ios/Shared/DaroMNativeAdView.swift +575 -0
- package/ios/Shared/DaroMNativeAssetResolver.swift +53 -0
- package/ios/mediation/admob/DaroMediationDebugger.swift +11 -0
- package/ios/mediation/admob/DaroMediationTypes.swift +23 -0
- package/lib/commonjs/AdBannerView.js +21 -35
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +80 -21
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/commonjs/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/commonjs/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/EventEmitter.js +4 -5
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +48 -22
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +64 -46
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js +9 -0
- package/lib/commonjs/NativeDaroModule.js.map +1 -0
- package/lib/commonjs/RewardedAd.js +47 -23
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/codegen-env.d.js +2 -0
- package/lib/commonjs/codegen-env.d.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +110 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useLightPopupAd.js +114 -0
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +113 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/index.js +29 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +23 -18
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +43 -31
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +34 -7
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AdBannerView.js +20 -36
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +80 -22
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/lib/module/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/lib/module/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/EventEmitter.js +4 -6
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +47 -22
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +65 -47
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js +5 -0
- package/lib/module/NativeDaroModule.js.map +1 -0
- package/lib/module/RewardedAd.js +46 -23
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/codegen-env.d.js +2 -0
- package/lib/module/codegen-env.d.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +106 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useLightPopupAd.js +110 -0
- package/lib/module/hooks/useLightPopupAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +109 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/index.js +7 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +22 -19
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +45 -34
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +35 -8
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts +19 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts +6 -0
- package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +8 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts +8 -0
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/AdBannerView.d.ts +126 -4
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts +6 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +125 -2
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts +19 -0
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts +6 -0
- package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +8 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withIos.d.ts +8 -0
- package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -0
- package/lib/typescript/module/src/AdBannerView.d.ts +126 -4
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +6 -0
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts +32 -0
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts +42 -0
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts +6 -0
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts +6 -0
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +61 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/module/src/RewardedAd.d.ts +6 -0
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +125 -2
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts +2 -2
- package/lib/typescript/module/src/types/AdBannerViewProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +2 -2
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +2 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +95 -105
- package/plugin/build/index.d.ts +18 -0
- package/plugin/build/index.js +71 -0
- package/plugin/build/skAdNetworkIds.d.ts +5 -0
- package/plugin/build/skAdNetworkIds.js +205 -0
- package/plugin/build/withAndroid.d.ts +7 -0
- package/plugin/build/withAndroid.js +222 -0
- package/plugin/build/withIos.d.ts +7 -0
- package/plugin/build/withIos.js +82 -0
- package/react-native-daro.podspec +28 -0
- package/src/AdBannerView.tsx +48 -48
- package/src/AppOpenAd.ts +101 -20
- package/src/DaroMAdBannerViewNativeComponent.ts +47 -0
- package/src/DaroMNativeAdViewNativeComponent.ts +62 -0
- package/src/DaroMediaViewNativeComponent.ts +9 -0
- package/src/ErrorCode.ts +1 -2
- package/src/EventEmitter.ts +9 -7
- package/src/InterstitialAd.ts +75 -21
- package/src/LightPopupAd.ts +90 -51
- package/src/NativeDaroModule.ts +91 -0
- package/src/RewardedAd.ts +72 -22
- package/src/codegen-env.d.ts +45 -0
- package/src/hooks/useInterstitialAd.ts +117 -0
- package/src/hooks/useLightPopupAd.ts +132 -0
- package/src/hooks/useRewardedAd.ts +122 -0
- package/src/index.tsx +21 -22
- package/src/nativeAd/NativeAdView.tsx +83 -45
- package/src/nativeAd/NativeAdViewComponents.tsx +129 -64
- package/src/nativeAd/NativeAdViewProvider.tsx +84 -16
- package/src/types/AdBannerViewProps.ts +11 -11
- package/src/types/AdInfo.ts +17 -17
- package/src/types/AdProps.ts +8 -9
- package/src/types/DaroMMobileAds.ts +3 -6
- package/src/types/NativeAdViewProps.ts +12 -5
- package/src/types/index.ts +1 -1
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifestNew.xml +0 -7
- package/android/src/main/java/com/darom/DaroMAdNativeViewManager.kt +0 -136
- package/android/src/main/java/com/darom/DaroMModule.kt +0 -203
- package/android/src/main/java/com/darom/DaroMPackage.kt +0 -21
- package/android/src/main/java/com/darom/util/EventEmitterUtil.kt +0 -24
- package/android/src/main/java/com/darom/view/DaroMAdBannerViewContainer.kt +0 -163
- package/android/src/main/java/com/darom/view/DaroMAdNativeViewContainer.kt +0 -375
- package/android/src/main/res/layout/layout_activity_transparent.xml +0 -7
- package/android/src/main/res/values/styles.xml +0 -11
- package/ios/DaroM-Bridging-Header.h +0 -6
- package/ios/DaroMAdBannerViewManager.swift +0 -91
- package/ios/DaroMNativeAdViewManager.swift +0 -291
- package/react-native-daro-m.podspec +0 -44
package/src/types/AdProps.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import type { AdLoadFailedInfo } from
|
|
1
|
+
import type { AdLoadFailedInfo } from './AdInfo';
|
|
2
2
|
|
|
3
|
-
import type { AdInfo } from
|
|
3
|
+
import type { AdInfo } from './AdInfo';
|
|
4
4
|
|
|
5
5
|
export type AdProps = {
|
|
6
|
+
adUnitId: string;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
placement?: string | null;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
onAdLoaded?: (adInfo: AdInfo) => void;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
onAdLoadFailed?: (error: AdLoadFailedInfo) => void;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
onAdClicked?: (adInfo: AdInfo) => void;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onAdImpressionRecorded?: (adInfo: AdInfo) => void;
|
|
16
|
+
onAdImpressionRecorded?: (adInfo: AdInfo) => void;
|
|
18
17
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
export type DaroMMobileAds = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setUserId: (userId: String) => Promise<void>;
|
|
7
|
-
|
|
2
|
+
isInitialized: () => Promise<boolean>;
|
|
3
|
+
initialize: (sdkKey: string) => Promise<void>;
|
|
4
|
+
setUserId: (userId: String) => Promise<void>;
|
|
8
5
|
};
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import type { AdProps } from './AdProps';
|
|
2
2
|
|
|
3
|
+
export type AdChoicesPosition =
|
|
4
|
+
| 'topLeft'
|
|
5
|
+
| 'topRight'
|
|
6
|
+
| 'bottomRight'
|
|
7
|
+
| 'bottomLeft';
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* A handler of {@link NativeAdView}.
|
|
5
11
|
*/
|
|
6
12
|
export type NativeAdViewHandler = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Loads a native ad.
|
|
15
|
+
*/
|
|
16
|
+
loadAd(): void;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* Represents a {@link NativeAdView}.
|
|
15
21
|
*/
|
|
16
22
|
export type NativeAdViewProps = AdProps & {
|
|
17
|
-
|
|
23
|
+
loadOnMount?: boolean;
|
|
24
|
+
adChoicesPosition?: AdChoicesPosition;
|
|
18
25
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
package com.darom
|
|
2
|
-
|
|
3
|
-
import com.darom.event.AdViewEvent
|
|
4
|
-
import com.darom.view.DaroMAdBannerViewContainer
|
|
5
|
-
import com.darom.view.DaroMAdNativeViewContainer
|
|
6
|
-
import com.facebook.react.bridge.ReadableArray
|
|
7
|
-
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
8
|
-
import com.facebook.react.uimanager.StateWrapper
|
|
9
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
-
import com.facebook.react.uimanager.ViewGroupManager
|
|
11
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
12
|
-
|
|
13
|
-
class DaroMAdNativeViewManager : ViewGroupManager<DaroMAdNativeViewContainer>() {
|
|
14
|
-
|
|
15
|
-
override fun getName(): String {
|
|
16
|
-
return "DaroMNativeAdView"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
override fun createViewInstance(
|
|
20
|
-
reactTag: Int,
|
|
21
|
-
reactContext: ThemedReactContext,
|
|
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}"
|
|
29
|
-
|
|
30
|
-
if (key.isNotEmpty()) {
|
|
31
|
-
viewCache.keys.firstOrNull { it.contains(key) }?.let {
|
|
32
|
-
if (it != key + reactContext.hashCode()) {
|
|
33
|
-
viewCache.remove(it)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return key.let {
|
|
39
|
-
viewCache[it + reactContext.hashCode()].let { view ->
|
|
40
|
-
view?.id = reactTag
|
|
41
|
-
|
|
42
|
-
if(view?.parent == null) view.also {
|
|
43
|
-
it?.applyPrevSetting()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
else null
|
|
47
|
-
}
|
|
48
|
-
} ?: super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper).also {
|
|
49
|
-
if (key.isNotEmpty()) viewCache[key + reactContext.hashCode()] = it
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
override fun createViewInstance(context: ThemedReactContext): DaroMAdNativeViewContainer {
|
|
54
|
-
return DaroMAdNativeViewContainer(context)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
companion object {
|
|
58
|
-
private const val COMMAND_LOAD_AD: Int = 1
|
|
59
|
-
|
|
60
|
-
private val viewCache: MutableMap<String, DaroMAdNativeViewContainer> = mutableMapOf()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any> {
|
|
64
|
-
return AdViewEvent.entries.associate {
|
|
65
|
-
it.value to mutableMapOf("phasedRegistrationNames" to mutableMapOf("bubbled" to it.key))
|
|
66
|
-
}.toMutableMap()
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
70
|
-
return mutableMapOf(
|
|
71
|
-
"loadAd" to COMMAND_LOAD_AD,
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@Deprecated("")
|
|
76
|
-
override fun receiveCommand(
|
|
77
|
-
root: DaroMAdNativeViewContainer,
|
|
78
|
-
commandId: Int,
|
|
79
|
-
args: ReadableArray?,
|
|
80
|
-
) {
|
|
81
|
-
when (commandId) {
|
|
82
|
-
COMMAND_LOAD_AD -> {
|
|
83
|
-
root.loadAd()
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
@ReactProp(name = "adUnitId")
|
|
89
|
-
fun setAdUnitId(view: DaroMAdNativeViewContainer, adUnitId: String) {
|
|
90
|
-
view.adUnitId = adUnitId
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@ReactProp(name = "loadOnMount")
|
|
94
|
-
fun setLoadOnMount(view: DaroMAdNativeViewContainer, loadOnMount: Boolean) {
|
|
95
|
-
view.loadOnMount = loadOnMount
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@ReactProp(name = "titleView")
|
|
99
|
-
fun setTitleView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
100
|
-
view.setTitleView(value)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@ReactProp(name = "bodyView")
|
|
104
|
-
fun setBodyView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
105
|
-
view.setBodyView(value)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
@ReactProp(name = "callToActionView")
|
|
109
|
-
fun setCallToActionView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
110
|
-
view.setCallToActionView(value)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@ReactProp(name = "iconView")
|
|
114
|
-
fun setIconView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
115
|
-
view.setIconView(value)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@ReactProp(name = "mediaView")
|
|
119
|
-
fun setMediaView(view: DaroMAdNativeViewContainer, value: Int) {
|
|
120
|
-
view.setMediaView(value)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@ReactProp(name = "placement")
|
|
124
|
-
fun setPlacement(view: DaroMAdBannerViewContainer, placement: String) {
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
override fun onAfterUpdateTransaction(view: DaroMAdNativeViewContainer) {
|
|
128
|
-
super.onAfterUpdateTransaction(view)
|
|
129
|
-
view.onSetProps()
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
override fun onDropViewInstance(view: DaroMAdNativeViewContainer) {
|
|
133
|
-
super.onDropViewInstance(view)
|
|
134
|
-
// view.destroy()
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
package com.darom
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import com.darom.constants.InternalDaroMBannerSize
|
|
6
|
-
import com.darom.event.DaroMEvent
|
|
7
|
-
import com.darom.event.InterstitialEvent
|
|
8
|
-
import com.darom.event.LightPopupEvent
|
|
9
|
-
import com.darom.event.RewardedEvent
|
|
10
|
-
import com.darom.impl.DaroMBannerViewModuleImpl
|
|
11
|
-
import com.darom.impl.DaroMInterstitialModuleImpl
|
|
12
|
-
import com.darom.impl.DaroMLightPopupModuleImpl
|
|
13
|
-
import com.darom.impl.DaroMRewardedAdModuleImpl
|
|
14
|
-
import com.darom.util.EventEmitterUtil
|
|
15
|
-
import com.facebook.react.bridge.Promise
|
|
16
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
17
|
-
import com.facebook.react.bridge.ReactContext
|
|
18
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
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
|
-
import droom.daro.a.Daro
|
|
24
|
-
|
|
25
|
-
class DaroMModule(reactContext: ReactApplicationContext) :
|
|
26
|
-
ReactContextBaseJavaModule(reactContext) {
|
|
27
|
-
|
|
28
|
-
companion object {
|
|
29
|
-
const val NAME = "DaroMModule"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
override fun getName(): String {
|
|
33
|
-
return NAME
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private val context: Context = reactApplicationContext
|
|
37
|
-
|
|
38
|
-
private var isInitialized: Boolean = false
|
|
39
|
-
|
|
40
|
-
@ReactMethod
|
|
41
|
-
fun initializeSdk() {
|
|
42
|
-
Daro.init(
|
|
43
|
-
application = context.applicationContext as Application,
|
|
44
|
-
sdkConfig = SDKConfig.Builder()
|
|
45
|
-
.setDebugMode(false)
|
|
46
|
-
.build()
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
isInitialized = true
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@ReactMethod
|
|
53
|
-
fun isInitialized(promise: Promise) {
|
|
54
|
-
promise.resolve(isInitialized)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@ReactMethod
|
|
58
|
-
fun showMediationDebugger() {
|
|
59
|
-
Daro.openDebugger(context)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@ReactMethod
|
|
63
|
-
fun setUserId(userId: String) {
|
|
64
|
-
Daro.setUserId(context, userId)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
override fun getConstants(): MutableMap<String, Any>? {
|
|
68
|
-
val constants = mutableMapOf<String, Any>()
|
|
69
|
-
constants.putAll(daroMInterstitialModule.getComponents())
|
|
70
|
-
constants.putAll(daroMRewardedModule.getComponents())
|
|
71
|
-
constants.putAll(daroMLightPopupModule.getComponents())
|
|
72
|
-
constants.putAll(daroMBannerModule.getComponents())
|
|
73
|
-
|
|
74
|
-
return constants
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
internal abstract class DaroMComponentModule(protected val context: ReactContext) {
|
|
78
|
-
abstract fun getComponents(): MutableMap<String, Any>
|
|
79
|
-
|
|
80
|
-
fun sendNativeEvent(event: DaroMEvent, params: WritableMap?) {
|
|
81
|
-
EventEmitterUtil.sendReactNativeEvent(
|
|
82
|
-
reactContext = context,
|
|
83
|
-
event = event,
|
|
84
|
-
params = params,
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
90
|
-
internal abstract class DaroMInterstitialModule(context: ReactContext) :
|
|
91
|
-
DaroMComponentModule(context) {
|
|
92
|
-
abstract fun isInterstitialReady(adUnitId: String, promise: Promise)
|
|
93
|
-
abstract fun loadInterstitial(adUnitId: String)
|
|
94
|
-
abstract fun showInterstitial(adUnitId: String)
|
|
95
|
-
|
|
96
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
97
|
-
return InterstitialEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private val daroMInterstitialModule: DaroMInterstitialModule =
|
|
102
|
-
DaroMInterstitialModuleImpl(
|
|
103
|
-
context = reactContext,
|
|
104
|
-
getCurrentActivity = { getCurrentActivity() }
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
@ReactMethod
|
|
108
|
-
fun isInterstitialReady(adUnitId: String, promise: Promise) {
|
|
109
|
-
daroMInterstitialModule.isInterstitialReady(adUnitId, promise)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@ReactMethod
|
|
113
|
-
fun loadInterstitial(adUnitId: String) {
|
|
114
|
-
daroMInterstitialModule.loadInterstitial(adUnitId)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@ReactMethod
|
|
118
|
-
fun showInterstitial(adUnitId: String) {
|
|
119
|
-
daroMInterstitialModule.showInterstitial(adUnitId)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
123
|
-
internal abstract class DaroMRewardedModule(context: ReactContext) :
|
|
124
|
-
DaroMComponentModule(context) {
|
|
125
|
-
abstract fun isRewardedAdReady(adUnitId: String, promise: Promise)
|
|
126
|
-
abstract fun loadRewardedAd(adUnitId: String)
|
|
127
|
-
abstract fun showRewardedAd(adUnitId: String, customData: String?)
|
|
128
|
-
|
|
129
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
130
|
-
return RewardedEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private val daroMRewardedModule: DaroMRewardedModule =
|
|
135
|
-
DaroMRewardedAdModuleImpl(
|
|
136
|
-
context = reactContext,
|
|
137
|
-
getCurrentActivity = { getCurrentActivity() }
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
@ReactMethod
|
|
141
|
-
fun isRewardedAdReady(adUnitId: String, promise: Promise) {
|
|
142
|
-
daroMRewardedModule.isRewardedAdReady(adUnitId, promise)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@ReactMethod
|
|
146
|
-
fun loadRewardedAd(adUnitId: String) {
|
|
147
|
-
daroMRewardedModule.loadRewardedAd(adUnitId)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@ReactMethod
|
|
151
|
-
fun showRewardedAd(adUnitId: String, customData: String?) {
|
|
152
|
-
daroMRewardedModule.showRewardedAd(adUnitId, customData)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
156
|
-
internal abstract class DaroMLightPopupModule(context: ReactContext) :
|
|
157
|
-
DaroMComponentModule(context) {
|
|
158
|
-
abstract fun isLightPopupReady(adUnitId: String, promise: Promise)
|
|
159
|
-
abstract fun loadLightPopup(adUnitId: String)
|
|
160
|
-
abstract fun showLightPopup(adUnitId: String)
|
|
161
|
-
|
|
162
|
-
abstract fun setLightPopupAdConfiguration(adUnitId: String, parameterMap: ReadableMap)
|
|
163
|
-
|
|
164
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
165
|
-
return LightPopupEvent.entries.associate { it.value to it.value }.toMutableMap()
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
private val daroMLightPopupModule: DaroMLightPopupModule = DaroMLightPopupModuleImpl(
|
|
170
|
-
context = reactContext,
|
|
171
|
-
getCurrentActivity = { getCurrentActivity() }
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
@ReactMethod
|
|
175
|
-
fun isLightPopupReady(adUnitId: String, promise: Promise) {
|
|
176
|
-
daroMLightPopupModule.isLightPopupReady(adUnitId, promise)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@ReactMethod
|
|
180
|
-
fun loadLightPopup(adUnitId: String) {
|
|
181
|
-
daroMLightPopupModule.loadLightPopup(adUnitId)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@ReactMethod
|
|
185
|
-
fun showLightPopup(adUnitId: String) {
|
|
186
|
-
daroMLightPopupModule.showLightPopup(adUnitId)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@ReactMethod
|
|
190
|
-
fun setLightPopupAdConfiguration(adUnitId: String, configurationMap: ReadableMap) {
|
|
191
|
-
daroMLightPopupModule.setLightPopupAdConfiguration(adUnitId, configurationMap)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
@OptIn(ExperimentalStdlibApi::class)
|
|
195
|
-
internal abstract class DaroMBannerModule(context: ReactContext) : DaroMComponentModule(context) {
|
|
196
|
-
override fun getComponents(): MutableMap<String, Any> {
|
|
197
|
-
return InternalDaroMBannerSize.entries.associate { it.key to it.name }.toMutableMap()
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
private val daroMBannerModule: DaroMBannerModule =
|
|
202
|
-
DaroMBannerViewModuleImpl(context = reactContext)
|
|
203
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package com.darom
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage
|
|
4
|
-
import com.facebook.react.bridge.NativeModule
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.uimanager.ViewManager
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class DaroMPackage : ReactPackage {
|
|
10
|
-
|
|
11
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
12
|
-
return listOf(DaroMModule(reactContext))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
16
|
-
return listOf(
|
|
17
|
-
DaroMAdBannerViewManager(),
|
|
18
|
-
DaroMAdNativeViewManager(),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package com.darom.util
|
|
2
|
-
|
|
3
|
-
import android.view.View
|
|
4
|
-
import com.darom.event.DaroMEvent
|
|
5
|
-
import com.facebook.react.bridge.ReactContext
|
|
6
|
-
import com.facebook.react.bridge.WritableMap
|
|
7
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
8
|
-
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
9
|
-
|
|
10
|
-
internal object EventEmitterUtil {
|
|
11
|
-
// React Native Bridge
|
|
12
|
-
fun sendReactNativeEvent(reactContext: ReactContext, event: DaroMEvent, params: WritableMap?) {
|
|
13
|
-
reactContext
|
|
14
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
15
|
-
.emit(event.value, params)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
fun View.sendNativeViewEvent(reactContext: ReactContext, event: DaroMEvent, params: WritableMap?) {
|
|
19
|
-
reactContext
|
|
20
|
-
.getJSModule(RCTEventEmitter::class.java)
|
|
21
|
-
.receiveEvent(id, event.value, params)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
package com.darom.view
|
|
2
|
-
|
|
3
|
-
import android.annotation.SuppressLint
|
|
4
|
-
import android.view.View
|
|
5
|
-
import androidx.core.view.children
|
|
6
|
-
import androidx.core.view.isVisible
|
|
7
|
-
import com.darom.event.AdViewEvent
|
|
8
|
-
import com.darom.util.AdInfoUtil
|
|
9
|
-
import com.darom.util.EventEmitterUtil.sendNativeViewEvent
|
|
10
|
-
import com.facebook.react.bridge.ReactContext
|
|
11
|
-
import com.facebook.react.views.view.ReactViewGroup
|
|
12
|
-
import droom.daro.core.adunit.DaroBannerAdUnit
|
|
13
|
-
import droom.daro.core.model.DaroAdInfo
|
|
14
|
-
import droom.daro.core.model.DaroAdLoadError
|
|
15
|
-
import droom.daro.core.model.DaroBannerSize
|
|
16
|
-
import droom.daro.core.model.DaroViewAd
|
|
17
|
-
import droom.daro.view.DaroAdViewListener
|
|
18
|
-
import droom.daro.view.DaroBannerAdView
|
|
19
|
-
|
|
20
|
-
@SuppressLint("ViewConstructor")
|
|
21
|
-
class DaroMAdBannerViewContainer(val context: ReactContext) : ReactViewGroup(context),
|
|
22
|
-
DaroAdViewListener {
|
|
23
|
-
|
|
24
|
-
private var adView: DaroBannerAdView? = null
|
|
25
|
-
|
|
26
|
-
internal var adUnitId: String = ""
|
|
27
|
-
|
|
28
|
-
internal var adSize: DaroBannerSize? = null
|
|
29
|
-
|
|
30
|
-
internal var loadOnMount: Boolean = true
|
|
31
|
-
|
|
32
|
-
private var isVisible: Boolean = true
|
|
33
|
-
private var isAdPaused: Boolean = false
|
|
34
|
-
|
|
35
|
-
fun loadAd() {
|
|
36
|
-
(adView ?: buildAdView())?.apply {
|
|
37
|
-
adView = this
|
|
38
|
-
|
|
39
|
-
if (this.parent == null) {
|
|
40
|
-
this@DaroMAdBannerViewContainer.addView(this)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
loadAd()
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private fun buildAdView(): DaroBannerAdView? {
|
|
48
|
-
if (adUnitId.isEmpty() || adSize == null) {
|
|
49
|
-
return null
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return DaroBannerAdView(
|
|
53
|
-
context,
|
|
54
|
-
DaroBannerAdUnit(
|
|
55
|
-
key = adUnitId,
|
|
56
|
-
placement = adUnitId,
|
|
57
|
-
bannerSize = adSize!!,
|
|
58
|
-
)
|
|
59
|
-
).also { view ->
|
|
60
|
-
view.setListener(this)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
fun destroy() {
|
|
65
|
-
adView?.destroy()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
fun setAdVisibility(visible: Boolean) {
|
|
69
|
-
isVisible = visible
|
|
70
|
-
this.isVisible = visible
|
|
71
|
-
adView?.isVisible = visible
|
|
72
|
-
|
|
73
|
-
if (visible) {
|
|
74
|
-
resumeAd()
|
|
75
|
-
} else {
|
|
76
|
-
pauseAd()
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fun pauseAd() {
|
|
81
|
-
if (!isAdPaused) {
|
|
82
|
-
isAdPaused = true
|
|
83
|
-
adView?.pause()
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
fun resumeAd() {
|
|
88
|
-
if (isAdPaused) {
|
|
89
|
-
isAdPaused = false
|
|
90
|
-
adView?.resume()
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
override fun onAdClicked(adInfo: DaroAdInfo) {
|
|
95
|
-
sendNativeViewEvent(
|
|
96
|
-
reactContext = context,
|
|
97
|
-
event = AdViewEvent.ON_AD_CLICKED,
|
|
98
|
-
params = AdInfoUtil.getAdInfo(adUnitId, adInfo)
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
override fun onAdImpression(adInfo: DaroAdInfo) {
|
|
103
|
-
sendNativeViewEvent(
|
|
104
|
-
reactContext = context,
|
|
105
|
-
event = AdViewEvent.ON_AD_IMPRESSION,
|
|
106
|
-
params = AdInfoUtil.getAdInfo(adUnitId, adInfo),
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
override fun onAdLoadFail(err: DaroAdLoadError) {
|
|
111
|
-
sendNativeViewEvent(
|
|
112
|
-
reactContext = context,
|
|
113
|
-
event = AdViewEvent.ON_AD_FAILED_TO_LOAD,
|
|
114
|
-
params = AdInfoUtil.getAdLoadFailedInfo(adUnitId, err),
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
override fun onAdLoadSuccess(
|
|
119
|
-
ad: DaroViewAd,
|
|
120
|
-
adInfo: DaroAdInfo,
|
|
121
|
-
) {
|
|
122
|
-
sendNativeViewEvent(
|
|
123
|
-
reactContext = context,
|
|
124
|
-
event = AdViewEvent.ON_AD_LOADED,
|
|
125
|
-
params = AdInfoUtil.getAdInfo(adUnitId, adInfo),
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
adView?.children?.first()?.let {
|
|
129
|
-
it.measure(
|
|
130
|
-
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
131
|
-
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
it.layout(0, 0, width, height)
|
|
135
|
-
it.requestLayout()
|
|
136
|
-
adView!!.requestLayout()
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
override fun requestLayout() {
|
|
141
|
-
super.requestLayout()
|
|
142
|
-
|
|
143
|
-
// https://stackoverflow.com/a/39838774/5477988
|
|
144
|
-
// This is required to ensure ad refreshes render correctly in RN Android due to known issue
|
|
145
|
-
// where `getWidth()` and `getHeight()` return 0 on attach
|
|
146
|
-
try {
|
|
147
|
-
adView?.measure(
|
|
148
|
-
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
149
|
-
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
adView?.layout(0, 0, width, height)
|
|
153
|
-
} catch (_: Exception) {
|
|
154
|
-
// Ignore
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
fun onSetProps() {
|
|
159
|
-
if (loadOnMount) {
|
|
160
|
-
loadAd()
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|