react-native-daro 1.0.12 → 1.0.15
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 +42 -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 +4 -4
- package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdNativeViewManager.kt +4 -4
- package/android/src/main/java/com/{darom → daro/reactnative}/DaroMModule.kt +44 -45
- package/android/src/main/java/com/{darom → daro/reactnative}/DaroMPackage.kt +1 -1
- 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 +1 -1
- 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 +33 -27
- package/android/src/main/java/com/{darom → daro/reactnative}/util/AdInfoUtil.kt +25 -1
- package/android/src/main/java/com/{darom → daro/reactnative}/util/EventEmitterUtil.kt +2 -2
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdBannerViewContainer.kt +417 -0
- package/android/src/main/java/com/{darom → daro/reactnative}/view/DaroMAdNativeViewContainer.kt +4 -4
- package/app.plugin.js +1 -0
- package/ios/DaroMAdBannerViewManager.swift +5 -1
- package/ios/DaroMModule+AppOpen.swift +34 -31
- package/ios/DaroMModule+Interstitial.swift +29 -26
- package/ios/DaroMModule+LightPopup.swift +40 -33
- package/ios/DaroMModule+Rewarded.swift +35 -27
- package/ios/DaroMModule.mm +13 -13
- package/ios/DaroMModule.swift +20 -13
- package/ios/DaroMNativeAdViewManager.swift +1 -1
- package/ios/mediation/admob/DaroMediationDebugger.swift +11 -0
- package/ios/mediation/admob/DaroMediationTypes.swift +22 -0
- package/lib/commonjs/AdBannerView.js +6 -1
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +155 -70
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/EventEmitter.js +39 -11
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +157 -70
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +181 -99
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/RewardedAd.js +164 -80
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +5 -1
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/AdEvent.js +17 -0
- package/lib/commonjs/types/AdEvent.js.map +1 -1
- package/lib/module/AdBannerView.js +6 -1
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +155 -71
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/EventEmitter.js +37 -10
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +158 -72
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +182 -100
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/RewardedAd.js +165 -82
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +5 -1
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types/AdEvent.js +18 -1
- package/lib/module/types/AdEvent.js.map +1 -1
- 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 +124 -2
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +53 -2
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/EventEmitter.d.ts +9 -1
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts +53 -2
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +57 -2
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RewardedAd.d.ts +57 -2
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +124 -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.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/AdEvent.d.ts +24 -0
- package/lib/typescript/commonjs/src/types/AdEvent.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/LightPopupAd.d.ts +1 -5
- package/lib/typescript/commonjs/src/types/LightPopupAd.d.ts.map +1 -1
- 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 +124 -2
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +53 -2
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/module/src/EventEmitter.d.ts +9 -1
- package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts +53 -2
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts +57 -2
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/RewardedAd.d.ts +57 -2
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +124 -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.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/AdEvent.d.ts +24 -0
- package/lib/typescript/module/src/types/AdEvent.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/LightPopupAd.d.ts +1 -5
- package/lib/typescript/module/src/types/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +88 -101
- 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 +140 -0
- package/plugin/build/withIos.d.ts +7 -0
- package/plugin/build/withIos.js +83 -0
- package/react-native-daro.podspec +25 -0
- package/src/AdBannerView.tsx +54 -17
- package/src/AppOpenAd.ts +216 -104
- package/src/ErrorCode.ts +1 -2
- package/src/EventEmitter.ts +63 -14
- package/src/InterstitialAd.ts +216 -104
- package/src/LightPopupAd.ts +240 -114
- package/src/RewardedAd.ts +233 -122
- package/src/index.tsx +20 -12
- package/src/nativeAd/NativeAdView.tsx +65 -14
- package/src/nativeAd/NativeAdViewComponents.tsx +54 -27
- package/src/nativeAd/NativeAdViewProvider.tsx +17 -7
- package/src/types/AdBannerViewProps.ts +11 -11
- package/src/types/AdEvent.ts +39 -2
- package/src/types/AdInfo.ts +17 -17
- package/src/types/AdProps.ts +8 -9
- package/src/types/DaroMMobileAds.ts +3 -6
- package/src/types/LightPopupAd.ts +2 -7
- package/src/types/NativeAdViewProps.ts +5 -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/view/DaroMAdBannerViewContainer.kt +0 -163
- 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/lib/commonjs/types/AppOpenAd.js +0 -6
- package/lib/commonjs/types/AppOpenAd.js.map +0 -1
- package/lib/commonjs/types/FullScreenAd.js +0 -6
- package/lib/commonjs/types/FullScreenAd.js.map +0 -1
- package/lib/commonjs/types/InterstitialAd.js +0 -6
- package/lib/commonjs/types/InterstitialAd.js.map +0 -1
- package/lib/commonjs/types/RewardedAd.js +0 -6
- package/lib/commonjs/types/RewardedAd.js.map +0 -1
- package/lib/module/types/AppOpenAd.js +0 -4
- package/lib/module/types/AppOpenAd.js.map +0 -1
- package/lib/module/types/FullScreenAd.js +0 -4
- package/lib/module/types/FullScreenAd.js.map +0 -1
- package/lib/module/types/InterstitialAd.js +0 -4
- package/lib/module/types/InterstitialAd.js.map +0 -1
- package/lib/module/types/RewardedAd.js +0 -4
- package/lib/module/types/RewardedAd.js.map +0 -1
- package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts +0 -3
- package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts +0 -21
- package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts +0 -3
- package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/RewardedAd.d.ts +0 -9
- package/lib/typescript/commonjs/src/types/RewardedAd.d.ts.map +0 -1
- package/lib/typescript/module/src/types/AppOpenAd.d.ts +0 -3
- package/lib/typescript/module/src/types/AppOpenAd.d.ts.map +0 -1
- package/lib/typescript/module/src/types/FullScreenAd.d.ts +0 -21
- package/lib/typescript/module/src/types/FullScreenAd.d.ts.map +0 -1
- package/lib/typescript/module/src/types/InterstitialAd.d.ts +0 -3
- package/lib/typescript/module/src/types/InterstitialAd.d.ts.map +0 -1
- package/lib/typescript/module/src/types/RewardedAd.d.ts +0 -9
- package/lib/typescript/module/src/types/RewardedAd.d.ts.map +0 -1
- package/react-native-daro-m.podspec +0 -44
- package/src/types/AppOpenAd.ts +0 -3
- package/src/types/FullScreenAd.ts +0 -28
- package/src/types/InterstitialAd.ts +0 -3
- package/src/types/RewardedAd.ts +0 -15
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
type ComponentRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import type {
|
|
11
|
+
ImageProps,
|
|
12
|
+
StyleProp,
|
|
13
|
+
TextProps,
|
|
14
|
+
TextStyle,
|
|
15
|
+
ImageStyle,
|
|
16
|
+
ViewProps,
|
|
17
|
+
} from 'react-native';
|
|
4
18
|
import { findNodeHandle, Image, Platform, Text, View } from 'react-native';
|
|
5
19
|
import { NativeAdViewContext } from './NativeAdViewProvider';
|
|
6
20
|
|
|
@@ -62,32 +76,37 @@ const useStyleProps = (style: StyleProp<TextStyle>): StyleProps => {
|
|
|
62
76
|
fontWeight: styleObj.fontWeight as string,
|
|
63
77
|
fontFamily: styleObj.fontFamily as string,
|
|
64
78
|
color: styleObj.color as string,
|
|
65
|
-
|
|
79
|
+
|
|
66
80
|
// 2. 배경색
|
|
67
81
|
backgroundColor: styleObj.backgroundColor as string,
|
|
68
|
-
|
|
82
|
+
|
|
69
83
|
// 3. 정렬
|
|
70
|
-
textAlign: styleObj.textAlign as
|
|
71
|
-
|
|
84
|
+
textAlign: styleObj.textAlign as
|
|
85
|
+
| 'auto'
|
|
86
|
+
| 'left'
|
|
87
|
+
| 'right'
|
|
88
|
+
| 'center'
|
|
89
|
+
| 'justify',
|
|
90
|
+
|
|
72
91
|
// 6. 투명도
|
|
73
92
|
opacity: styleObj.opacity as number,
|
|
74
|
-
|
|
93
|
+
|
|
75
94
|
// 7. 숨김
|
|
76
95
|
display: styleObj.display as 'none' | 'flex',
|
|
77
|
-
|
|
96
|
+
|
|
78
97
|
// 10. 모서리 둥글게
|
|
79
98
|
borderRadius: styleObj.borderRadius as number,
|
|
80
|
-
|
|
99
|
+
|
|
81
100
|
// 11. 테두리
|
|
82
101
|
borderWidth: styleObj.borderWidth as number,
|
|
83
102
|
borderColor: styleObj.borderColor as string,
|
|
84
|
-
|
|
103
|
+
|
|
85
104
|
// 12. 그림자
|
|
86
105
|
shadowColor: styleObj.shadowColor as string,
|
|
87
106
|
shadowOffset: styleObj.shadowOffset as { width: number; height: number },
|
|
88
107
|
shadowOpacity: styleObj.shadowOpacity as number,
|
|
89
108
|
shadowRadius: styleObj.shadowRadius as number,
|
|
90
|
-
|
|
109
|
+
|
|
91
110
|
// 13. 여백
|
|
92
111
|
padding: styleObj.padding as number,
|
|
93
112
|
margin: styleObj.margin as number,
|
|
@@ -99,21 +118,21 @@ const useStyleProps = (style: StyleProp<TextStyle>): StyleProps => {
|
|
|
99
118
|
marginRight: styleObj.marginRight as number,
|
|
100
119
|
marginBottom: styleObj.marginBottom as number,
|
|
101
120
|
marginLeft: styleObj.marginLeft as number,
|
|
102
|
-
|
|
121
|
+
|
|
103
122
|
// 14. 위치
|
|
104
123
|
position: styleObj.position as 'absolute' | 'relative',
|
|
105
124
|
top: styleObj.top as number,
|
|
106
125
|
right: styleObj.right as number,
|
|
107
126
|
bottom: styleObj.bottom as number,
|
|
108
127
|
left: styleObj.left as number,
|
|
109
|
-
|
|
128
|
+
|
|
110
129
|
// 15. 크기
|
|
111
130
|
width: styleObj.width as number,
|
|
112
131
|
height: styleObj.height as number,
|
|
113
|
-
|
|
132
|
+
|
|
114
133
|
// 16. 변환
|
|
115
134
|
transform: styleObj.transform as any[],
|
|
116
|
-
|
|
135
|
+
|
|
117
136
|
// 17. 기타
|
|
118
137
|
zIndex: styleObj.zIndex as number,
|
|
119
138
|
overflow: styleObj.overflow as 'visible' | 'hidden' | 'scroll',
|
|
@@ -155,7 +174,12 @@ const useImageStyleProps = (style: StyleProp<ImageStyle>): ImageStyleProps => {
|
|
|
155
174
|
height: styleObj.height as number,
|
|
156
175
|
|
|
157
176
|
// Image 전용 스타일 속성
|
|
158
|
-
resizeMode: styleObj.resizeMode as
|
|
177
|
+
resizeMode: styleObj.resizeMode as
|
|
178
|
+
| 'cover'
|
|
179
|
+
| 'contain'
|
|
180
|
+
| 'stretch'
|
|
181
|
+
| 'repeat'
|
|
182
|
+
| 'center',
|
|
159
183
|
tintColor: styleObj.tintColor as string,
|
|
160
184
|
overlayColor: styleObj.overlayColor as string,
|
|
161
185
|
aspectRatio: styleObj.aspectRatio as number,
|
|
@@ -164,7 +188,11 @@ const useImageStyleProps = (style: StyleProp<ImageStyle>): ImageStyleProps => {
|
|
|
164
188
|
};
|
|
165
189
|
|
|
166
190
|
// 네이티브 뷰 속성 설정 커스텀 훅
|
|
167
|
-
const useNativeAdViewProps = (
|
|
191
|
+
const useNativeAdViewProps = (
|
|
192
|
+
ref: React.RefObject<any>,
|
|
193
|
+
nativePropKey: string,
|
|
194
|
+
styleProps?: StyleProps
|
|
195
|
+
) => {
|
|
168
196
|
const { nativeAdView } = useContext(NativeAdViewContext);
|
|
169
197
|
|
|
170
198
|
const setNativeProps = useCallback(() => {
|
|
@@ -172,11 +200,11 @@ const useNativeAdViewProps = (ref: React.RefObject<any>, nativePropKey: string,
|
|
|
172
200
|
const props: any = {
|
|
173
201
|
[nativePropKey]: findNodeHandle(ref.current),
|
|
174
202
|
};
|
|
175
|
-
|
|
203
|
+
|
|
176
204
|
if (styleProps) {
|
|
177
205
|
props[`${nativePropKey}StyleProps`] = styleProps;
|
|
178
206
|
}
|
|
179
|
-
|
|
207
|
+
|
|
180
208
|
nativeAdView?.setNativeProps(props);
|
|
181
209
|
}, [nativeAdView, ref, nativePropKey, styleProps]);
|
|
182
210
|
|
|
@@ -188,9 +216,9 @@ const useNativeAdViewProps = (ref: React.RefObject<any>, nativePropKey: string,
|
|
|
188
216
|
// 공통 Text 컴포넌트
|
|
189
217
|
const AdTextView = (props: TextProps & { nativePropKey: string }) => {
|
|
190
218
|
const { nativePropKey, ...restProps } = props;
|
|
191
|
-
const textRef = useRef<Text | null>(null);
|
|
219
|
+
const textRef = useRef<ComponentRef<typeof Text> | null>(null);
|
|
192
220
|
const styleProps = useStyleProps(props.style);
|
|
193
|
-
|
|
221
|
+
|
|
194
222
|
useNativeAdViewProps(textRef, nativePropKey, styleProps);
|
|
195
223
|
|
|
196
224
|
return <Text {...restProps} ref={textRef} />;
|
|
@@ -205,11 +233,11 @@ export const BodyView = (props: TextProps) => {
|
|
|
205
233
|
};
|
|
206
234
|
|
|
207
235
|
export const CallToActionView = (props: TextProps) => {
|
|
208
|
-
const callToActionRef = useRef<Text | null>(null);
|
|
236
|
+
const callToActionRef = useRef<ComponentRef<typeof Text> | null>(null);
|
|
209
237
|
const styleProps = useStyleProps(props.style);
|
|
210
|
-
|
|
238
|
+
|
|
211
239
|
useNativeAdViewProps(callToActionRef, 'callToActionView', styleProps);
|
|
212
|
-
|
|
240
|
+
|
|
213
241
|
// TouchableOpacity disables clicking on certain Android devices.
|
|
214
242
|
if (Platform.OS === 'android') {
|
|
215
243
|
return <Text {...props} ref={callToActionRef} />;
|
|
@@ -223,7 +251,7 @@ export const CallToActionView = (props: TextProps) => {
|
|
|
223
251
|
};
|
|
224
252
|
|
|
225
253
|
export const IconView = (props: Omit<ImageProps, 'source'>) => {
|
|
226
|
-
const imageRef = useRef<Image | null>(null);
|
|
254
|
+
const imageRef = useRef<ComponentRef<typeof Image> | null>(null);
|
|
227
255
|
const iconViewStyleProps = useImageStyleProps(props.style);
|
|
228
256
|
useNativeAdViewProps(imageRef, 'iconView', iconViewStyleProps);
|
|
229
257
|
|
|
@@ -231,9 +259,8 @@ export const IconView = (props: Omit<ImageProps, 'source'>) => {
|
|
|
231
259
|
};
|
|
232
260
|
|
|
233
261
|
export const MediaView = (props: ViewProps) => {
|
|
234
|
-
const viewRef = useRef<View | null>(null);
|
|
262
|
+
const viewRef = useRef<ComponentRef<typeof View> | null>(null);
|
|
235
263
|
useNativeAdViewProps(viewRef, 'mediaView');
|
|
236
264
|
|
|
237
265
|
return <View {...props} ref={viewRef} />;
|
|
238
266
|
};
|
|
239
|
-
|
|
@@ -4,21 +4,27 @@ import { createContext, useState } from 'react';
|
|
|
4
4
|
import type { NativeMethods } from 'react-native';
|
|
5
5
|
import type { NativeAdViewProps } from '../types/NativeAdViewProps';
|
|
6
6
|
|
|
7
|
-
export type NativeAdViewType = React.Component<NativeAdViewProps> &
|
|
7
|
+
export type NativeAdViewType = React.Component<NativeAdViewProps> &
|
|
8
|
+
NativeMethods;
|
|
8
9
|
|
|
9
10
|
export type NativeAdViewContextType = {
|
|
10
11
|
nativeAdView: NativeAdViewType | null;
|
|
11
|
-
setNativeAdView: React.Dispatch<
|
|
12
|
+
setNativeAdView: React.Dispatch<
|
|
13
|
+
React.SetStateAction<NativeAdViewType | null>
|
|
14
|
+
>;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
|
-
|
|
15
17
|
export const NativeAdViewContext = createContext<NativeAdViewContextType>({
|
|
16
18
|
nativeAdView: null,
|
|
17
|
-
setNativeAdView: () => {
|
|
19
|
+
setNativeAdView: () => {},
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
export const NativeAdViewProvider: React.FC<{ children: ReactNode }> = ({
|
|
21
|
-
|
|
22
|
+
export const NativeAdViewProvider: React.FC<{ children: ReactNode }> = ({
|
|
23
|
+
children,
|
|
24
|
+
}) => {
|
|
25
|
+
const [nativeAdView, setNativeAdView] = useState<NativeAdViewType | null>(
|
|
26
|
+
null
|
|
27
|
+
);
|
|
22
28
|
|
|
23
29
|
const providerValue = React.useMemo(
|
|
24
30
|
() => ({
|
|
@@ -28,5 +34,9 @@ export const NativeAdViewProvider: React.FC<{ children: ReactNode }> = ({ childr
|
|
|
28
34
|
[nativeAdView]
|
|
29
35
|
);
|
|
30
36
|
|
|
31
|
-
return
|
|
37
|
+
return (
|
|
38
|
+
<NativeAdViewContext.Provider value={providerValue}>
|
|
39
|
+
{children}
|
|
40
|
+
</NativeAdViewContext.Provider>
|
|
41
|
+
);
|
|
32
42
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { AdFormat } from
|
|
2
|
-
import type { AdProps } from
|
|
1
|
+
import type { AdFormat } from '../AdBannerView';
|
|
2
|
+
import type { AdProps } from './AdProps';
|
|
3
3
|
|
|
4
4
|
export type AdBannerViewHandler = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* If the {@link loadOnMount} attribute is set to false, you can call this API to start loading ads in this AdView.
|
|
7
|
+
*/
|
|
8
|
+
loadAd(): void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type AdBannerViewProps = AdProps & {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
12
|
+
color?: string;
|
|
13
|
+
adFormat: AdFormat;
|
|
14
|
+
loadOnMount?: boolean;
|
|
15
|
+
isVisible?: boolean;
|
|
16
|
+
};
|
package/src/types/AdEvent.ts
CHANGED
|
@@ -1,9 +1,46 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AdInfo,
|
|
3
|
+
AdLoadFailedInfo,
|
|
4
|
+
AdDisplayFailedInfo,
|
|
5
|
+
AdRewardInfo,
|
|
6
|
+
} from './AdInfo';
|
|
2
7
|
|
|
3
|
-
export type AdEventObject =
|
|
8
|
+
export type AdEventObject =
|
|
9
|
+
| AdInfo
|
|
10
|
+
| AdLoadFailedInfo
|
|
11
|
+
| AdDisplayFailedInfo
|
|
12
|
+
| AdRewardInfo;
|
|
4
13
|
|
|
5
14
|
// Defines a generic event listener for the pragrammatic methods to receive an event from the native module.
|
|
6
15
|
export type AdEventListener<T extends AdEventObject> = (event: T) => void;
|
|
7
16
|
|
|
8
17
|
// Defines a generic event object for the UI components i.e. AdView and NativeAdView to receive an event from the native module.
|
|
9
18
|
export type AdNativeEvent<T extends AdEventObject> = { nativeEvent: T };
|
|
19
|
+
|
|
20
|
+
export enum AdEventType {
|
|
21
|
+
LOADED = 'LOADED',
|
|
22
|
+
LOAD_FAILED = 'LOAD_FAILED',
|
|
23
|
+
CLICKED = 'CLICKED',
|
|
24
|
+
DISPLAYED = 'DISPLAYED',
|
|
25
|
+
FAILED_TO_DISPLAY = 'FAILED_TO_DISPLAY',
|
|
26
|
+
HIDDEN = 'HIDDEN',
|
|
27
|
+
IMPRESSION_RECORDED = 'IMPRESSION_RECORDED',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export enum RewardedAdEventType {
|
|
31
|
+
RECEIVED_REWARD = 'RECEIVED_REWARD',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AdEventPayloadMap {
|
|
35
|
+
[AdEventType.LOADED]: AdInfo;
|
|
36
|
+
[AdEventType.LOAD_FAILED]: AdLoadFailedInfo;
|
|
37
|
+
[AdEventType.CLICKED]: AdInfo;
|
|
38
|
+
[AdEventType.DISPLAYED]: AdInfo;
|
|
39
|
+
[AdEventType.FAILED_TO_DISPLAY]: AdDisplayFailedInfo;
|
|
40
|
+
[AdEventType.HIDDEN]: AdInfo;
|
|
41
|
+
[AdEventType.IMPRESSION_RECORDED]: AdInfo;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RewardedAdEventPayloadMap extends AdEventPayloadMap {
|
|
45
|
+
[RewardedAdEventType.RECEIVED_REWARD]: AdRewardInfo;
|
|
46
|
+
}
|
package/src/types/AdInfo.ts
CHANGED
|
@@ -2,36 +2,36 @@ import type { ErrorCode } from '../ErrorCode';
|
|
|
2
2
|
|
|
3
3
|
// Represents an ad
|
|
4
4
|
export type AdInfo = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
// The ad unit ID for which this ad was loaded.
|
|
6
|
+
adUnitId: string;
|
|
7
|
+
// The total latency in milliseconds for this waterfall to finish processing.
|
|
8
|
+
latencyMillis: number;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// Encapsulates various data for MAX load errors.
|
|
12
12
|
export type AdLoadFailedInfo = {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// The ad unit ID for which this ad was loaded.
|
|
14
|
+
adUnitId: string;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// The error code for the error.
|
|
17
|
+
code: ErrorCode;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
message: string;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// The total latency in milliseconds for this waterfall to finish processing.
|
|
22
|
+
latencyMillis: number;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// Encapsulates various data for MAX display errors.
|
|
26
26
|
export type AdDisplayFailedInfo = {
|
|
27
|
-
|
|
27
|
+
message: string | null;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// Represents a reward given to the user.
|
|
31
31
|
export type AdRewardInfo = {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// The reward label.
|
|
33
|
+
rewardLabel?: string | null;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
35
|
+
// The rewarded amount.
|
|
36
|
+
rewardAmount: string;
|
|
37
|
+
};
|
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,9 +1,4 @@
|
|
|
1
|
-
import type { ColorValue } from
|
|
2
|
-
import type { FullScreenAdType } from "./FullScreenAd";
|
|
3
|
-
|
|
4
|
-
export interface LightPopupAdType extends FullScreenAdType {
|
|
5
|
-
setLightPopupAdConfiguration: (adUnitId: string, configuration: LightPopupAdConfiguration) => void;
|
|
6
|
-
}
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
7
2
|
|
|
8
3
|
export interface LightPopupAdConfiguration {
|
|
9
4
|
backgroundColor?: ColorValue;
|
|
@@ -16,4 +11,4 @@ export interface LightPopupAdConfiguration {
|
|
|
16
11
|
bodyTextColor?: ColorValue;
|
|
17
12
|
ctaButtonTextColor?: ColorValue;
|
|
18
13
|
ctaButtonBackgroundColor?: ColorValue;
|
|
19
|
-
}
|
|
14
|
+
}
|
|
@@ -4,15 +4,15 @@ import type { AdProps } from './AdProps';
|
|
|
4
4
|
* A handler of {@link NativeAdView}.
|
|
5
5
|
*/
|
|
6
6
|
export type NativeAdViewHandler = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Loads a native ad.
|
|
9
|
+
*/
|
|
10
|
+
loadAd(): void;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Represents a {@link NativeAdView}.
|
|
15
15
|
*/
|
|
16
16
|
export type NativeAdViewProps = AdProps & {
|
|
17
|
-
|
|
17
|
+
loadOnMount?: boolean;
|
|
18
18
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<style name="Theme.TransparentActivity" parent="Theme.AppCompat.NoActionBar">
|
|
4
|
-
<item name="android:windowBackground">@android:color/transparent</item>
|
|
5
|
-
<item name="android:windowIsTranslucent">true</item>
|
|
6
|
-
<item name="android:windowNoTitle">true</item>
|
|
7
|
-
<item name="android:statusBarColor">@android:color/transparent</item> <!-- 상태 바 투명 -->
|
|
8
|
-
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
9
|
-
<item name="android:fitsSystemWindows">true</item>
|
|
10
|
-
</style>
|
|
11
|
-
</resources>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/AppOpenAd.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/FullScreenAd.ts"],"mappings":"","ignoreList":[]}
|