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.
Files changed (222) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +30 -30
  3. package/android/build.gradle +42 -59
  4. package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +23 -0
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdBannerViewManager.kt +4 -4
  7. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdNativeViewManager.kt +4 -4
  8. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMModule.kt +44 -45
  9. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMPackage.kt +1 -1
  10. package/android/src/main/java/com/{darom → daro/reactnative}/constants/InternalDaroMBannerSize.kt +1 -1
  11. package/android/src/main/java/com/{darom → daro/reactnative}/event/DaroMEvent.kt +1 -1
  12. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMBannerViewModuleImpl.kt +2 -2
  13. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMInterstitialModuleImpl.kt +26 -26
  14. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMLightPopupModuleImpl.kt +30 -29
  15. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMRewardedAdModuleImpl.kt +33 -27
  16. package/android/src/main/java/com/{darom → daro/reactnative}/util/AdInfoUtil.kt +25 -1
  17. package/android/src/main/java/com/{darom → daro/reactnative}/util/EventEmitterUtil.kt +2 -2
  18. package/android/src/main/java/com/daro/reactnative/view/DaroMAdBannerViewContainer.kt +417 -0
  19. package/android/src/main/java/com/{darom → daro/reactnative}/view/DaroMAdNativeViewContainer.kt +4 -4
  20. package/app.plugin.js +1 -0
  21. package/ios/DaroMAdBannerViewManager.swift +5 -1
  22. package/ios/DaroMModule+AppOpen.swift +34 -31
  23. package/ios/DaroMModule+Interstitial.swift +29 -26
  24. package/ios/DaroMModule+LightPopup.swift +40 -33
  25. package/ios/DaroMModule+Rewarded.swift +35 -27
  26. package/ios/DaroMModule.mm +13 -13
  27. package/ios/DaroMModule.swift +20 -13
  28. package/ios/DaroMNativeAdViewManager.swift +1 -1
  29. package/ios/mediation/admob/DaroMediationDebugger.swift +11 -0
  30. package/ios/mediation/admob/DaroMediationTypes.swift +22 -0
  31. package/lib/commonjs/AdBannerView.js +6 -1
  32. package/lib/commonjs/AdBannerView.js.map +1 -1
  33. package/lib/commonjs/AppOpenAd.js +155 -70
  34. package/lib/commonjs/AppOpenAd.js.map +1 -1
  35. package/lib/commonjs/ErrorCode.js.map +1 -1
  36. package/lib/commonjs/EventEmitter.js +39 -11
  37. package/lib/commonjs/EventEmitter.js.map +1 -1
  38. package/lib/commonjs/InterstitialAd.js +157 -70
  39. package/lib/commonjs/InterstitialAd.js.map +1 -1
  40. package/lib/commonjs/LightPopupAd.js +181 -99
  41. package/lib/commonjs/LightPopupAd.js.map +1 -1
  42. package/lib/commonjs/RewardedAd.js +164 -80
  43. package/lib/commonjs/RewardedAd.js.map +1 -1
  44. package/lib/commonjs/index.js +1 -2
  45. package/lib/commonjs/index.js.map +1 -1
  46. package/lib/commonjs/nativeAd/NativeAdView.js +5 -1
  47. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  48. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  49. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  50. package/lib/commonjs/package.json +1 -0
  51. package/lib/commonjs/types/AdEvent.js +17 -0
  52. package/lib/commonjs/types/AdEvent.js.map +1 -1
  53. package/lib/module/AdBannerView.js +6 -1
  54. package/lib/module/AdBannerView.js.map +1 -1
  55. package/lib/module/AppOpenAd.js +155 -71
  56. package/lib/module/AppOpenAd.js.map +1 -1
  57. package/lib/module/ErrorCode.js.map +1 -1
  58. package/lib/module/EventEmitter.js +37 -10
  59. package/lib/module/EventEmitter.js.map +1 -1
  60. package/lib/module/InterstitialAd.js +158 -72
  61. package/lib/module/InterstitialAd.js.map +1 -1
  62. package/lib/module/LightPopupAd.js +182 -100
  63. package/lib/module/LightPopupAd.js.map +1 -1
  64. package/lib/module/RewardedAd.js +165 -82
  65. package/lib/module/RewardedAd.js.map +1 -1
  66. package/lib/module/index.js +1 -2
  67. package/lib/module/index.js.map +1 -1
  68. package/lib/module/nativeAd/NativeAdView.js +5 -1
  69. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  70. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  71. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  72. package/lib/module/package.json +1 -0
  73. package/lib/module/types/AdEvent.js +18 -1
  74. package/lib/module/types/AdEvent.js.map +1 -1
  75. package/lib/typescript/commonjs/plugin/src/index.d.ts +19 -0
  76. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts +6 -0
  78. package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +8 -0
  80. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/plugin/src/withIos.d.ts +8 -0
  82. package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/src/AdBannerView.d.ts +124 -2
  84. package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +53 -2
  86. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/ErrorCode.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/src/EventEmitter.d.ts +9 -1
  89. package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/InterstitialAd.d.ts +53 -2
  91. package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/src/LightPopupAd.d.ts +57 -2
  93. package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
  94. package/lib/typescript/commonjs/src/RewardedAd.d.ts +57 -2
  95. package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/src/index.d.ts +1 -1
  97. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +124 -2
  99. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts +2 -2
  103. package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/src/types/AdEvent.d.ts +24 -0
  105. package/lib/typescript/commonjs/src/types/AdEvent.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/types/AdProps.d.ts +2 -2
  108. package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/src/types/LightPopupAd.d.ts +1 -5
  111. package/lib/typescript/commonjs/src/types/LightPopupAd.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
  113. package/lib/typescript/module/plugin/src/index.d.ts +19 -0
  114. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
  115. package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts +6 -0
  116. package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts.map +1 -0
  117. package/lib/typescript/module/plugin/src/withAndroid.d.ts +8 -0
  118. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
  119. package/lib/typescript/module/plugin/src/withIos.d.ts +8 -0
  120. package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -0
  121. package/lib/typescript/module/src/AdBannerView.d.ts +124 -2
  122. package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
  123. package/lib/typescript/module/src/AppOpenAd.d.ts +53 -2
  124. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  125. package/lib/typescript/module/src/ErrorCode.d.ts.map +1 -1
  126. package/lib/typescript/module/src/EventEmitter.d.ts +9 -1
  127. package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
  128. package/lib/typescript/module/src/InterstitialAd.d.ts +53 -2
  129. package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
  130. package/lib/typescript/module/src/LightPopupAd.d.ts +57 -2
  131. package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
  132. package/lib/typescript/module/src/RewardedAd.d.ts +57 -2
  133. package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
  134. package/lib/typescript/module/src/index.d.ts +1 -1
  135. package/lib/typescript/module/src/index.d.ts.map +1 -1
  136. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +124 -2
  137. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
  138. package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  139. package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  140. package/lib/typescript/module/src/types/AdBannerViewProps.d.ts +2 -2
  141. package/lib/typescript/module/src/types/AdBannerViewProps.d.ts.map +1 -1
  142. package/lib/typescript/module/src/types/AdEvent.d.ts +24 -0
  143. package/lib/typescript/module/src/types/AdEvent.d.ts.map +1 -1
  144. package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
  145. package/lib/typescript/module/src/types/AdProps.d.ts +2 -2
  146. package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
  147. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +1 -1
  148. package/lib/typescript/module/src/types/LightPopupAd.d.ts +1 -5
  149. package/lib/typescript/module/src/types/LightPopupAd.d.ts.map +1 -1
  150. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
  151. package/package.json +88 -101
  152. package/plugin/build/index.d.ts +18 -0
  153. package/plugin/build/index.js +71 -0
  154. package/plugin/build/skAdNetworkIds.d.ts +5 -0
  155. package/plugin/build/skAdNetworkIds.js +205 -0
  156. package/plugin/build/withAndroid.d.ts +7 -0
  157. package/plugin/build/withAndroid.js +140 -0
  158. package/plugin/build/withIos.d.ts +7 -0
  159. package/plugin/build/withIos.js +83 -0
  160. package/react-native-daro.podspec +25 -0
  161. package/src/AdBannerView.tsx +54 -17
  162. package/src/AppOpenAd.ts +216 -104
  163. package/src/ErrorCode.ts +1 -2
  164. package/src/EventEmitter.ts +63 -14
  165. package/src/InterstitialAd.ts +216 -104
  166. package/src/LightPopupAd.ts +240 -114
  167. package/src/RewardedAd.ts +233 -122
  168. package/src/index.tsx +20 -12
  169. package/src/nativeAd/NativeAdView.tsx +65 -14
  170. package/src/nativeAd/NativeAdViewComponents.tsx +54 -27
  171. package/src/nativeAd/NativeAdViewProvider.tsx +17 -7
  172. package/src/types/AdBannerViewProps.ts +11 -11
  173. package/src/types/AdEvent.ts +39 -2
  174. package/src/types/AdInfo.ts +17 -17
  175. package/src/types/AdProps.ts +8 -9
  176. package/src/types/DaroMMobileAds.ts +3 -6
  177. package/src/types/LightPopupAd.ts +2 -7
  178. package/src/types/NativeAdViewProps.ts +5 -5
  179. package/src/types/index.ts +1 -1
  180. package/android/gradle.properties +0 -5
  181. package/android/src/main/AndroidManifestNew.xml +0 -7
  182. package/android/src/main/java/com/darom/view/DaroMAdBannerViewContainer.kt +0 -163
  183. package/android/src/main/res/layout/layout_activity_transparent.xml +0 -7
  184. package/android/src/main/res/values/styles.xml +0 -11
  185. package/ios/DaroM-Bridging-Header.h +0 -6
  186. package/lib/commonjs/types/AppOpenAd.js +0 -6
  187. package/lib/commonjs/types/AppOpenAd.js.map +0 -1
  188. package/lib/commonjs/types/FullScreenAd.js +0 -6
  189. package/lib/commonjs/types/FullScreenAd.js.map +0 -1
  190. package/lib/commonjs/types/InterstitialAd.js +0 -6
  191. package/lib/commonjs/types/InterstitialAd.js.map +0 -1
  192. package/lib/commonjs/types/RewardedAd.js +0 -6
  193. package/lib/commonjs/types/RewardedAd.js.map +0 -1
  194. package/lib/module/types/AppOpenAd.js +0 -4
  195. package/lib/module/types/AppOpenAd.js.map +0 -1
  196. package/lib/module/types/FullScreenAd.js +0 -4
  197. package/lib/module/types/FullScreenAd.js.map +0 -1
  198. package/lib/module/types/InterstitialAd.js +0 -4
  199. package/lib/module/types/InterstitialAd.js.map +0 -1
  200. package/lib/module/types/RewardedAd.js +0 -4
  201. package/lib/module/types/RewardedAd.js.map +0 -1
  202. package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts +0 -3
  203. package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts.map +0 -1
  204. package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts +0 -21
  205. package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts.map +0 -1
  206. package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts +0 -3
  207. package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts.map +0 -1
  208. package/lib/typescript/commonjs/src/types/RewardedAd.d.ts +0 -9
  209. package/lib/typescript/commonjs/src/types/RewardedAd.d.ts.map +0 -1
  210. package/lib/typescript/module/src/types/AppOpenAd.d.ts +0 -3
  211. package/lib/typescript/module/src/types/AppOpenAd.d.ts.map +0 -1
  212. package/lib/typescript/module/src/types/FullScreenAd.d.ts +0 -21
  213. package/lib/typescript/module/src/types/FullScreenAd.d.ts.map +0 -1
  214. package/lib/typescript/module/src/types/InterstitialAd.d.ts +0 -3
  215. package/lib/typescript/module/src/types/InterstitialAd.d.ts.map +0 -1
  216. package/lib/typescript/module/src/types/RewardedAd.d.ts +0 -9
  217. package/lib/typescript/module/src/types/RewardedAd.d.ts.map +0 -1
  218. package/react-native-daro-m.podspec +0 -44
  219. package/src/types/AppOpenAd.ts +0 -3
  220. package/src/types/FullScreenAd.ts +0 -28
  221. package/src/types/InterstitialAd.ts +0 -3
  222. package/src/types/RewardedAd.ts +0 -15
@@ -1,6 +1,20 @@
1
1
  import * as React from 'react';
2
- import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
3
- import type { ImageProps, StyleProp, TextProps, TextStyle, ImageStyle, ViewProps } from 'react-native';
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 'auto' | 'left' | 'right' | 'center' | 'justify',
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 'cover' | 'contain' | 'stretch' | 'repeat' | 'center',
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 = (ref: React.RefObject<any>, nativePropKey: string, styleProps?: StyleProps) => {
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> & NativeMethods;
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<React.SetStateAction<NativeAdViewType | null>>;
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 }> = ({ children }) => {
21
- const [nativeAdView, setNativeAdView] = useState<NativeAdViewType | null>(null);
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 <NativeAdViewContext.Provider value={providerValue}>{children}</NativeAdViewContext.Provider>;
37
+ return (
38
+ <NativeAdViewContext.Provider value={providerValue}>
39
+ {children}
40
+ </NativeAdViewContext.Provider>
41
+ );
32
42
  };
@@ -1,16 +1,16 @@
1
- import type { AdFormat } from "../AdBannerView";
2
- import type { AdProps } from "./AdProps";
1
+ import type { AdFormat } from '../AdBannerView';
2
+ import type { AdProps } from './AdProps';
3
3
 
4
4
  export type AdBannerViewHandler = {
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;
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
- color?: string;
13
- adFormat: AdFormat;
14
- loadOnMount?: boolean;
15
- isVisible?: boolean;
16
- }
12
+ color?: string;
13
+ adFormat: AdFormat;
14
+ loadOnMount?: boolean;
15
+ isVisible?: boolean;
16
+ };
@@ -1,9 +1,46 @@
1
- import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
1
+ import type {
2
+ AdInfo,
3
+ AdLoadFailedInfo,
4
+ AdDisplayFailedInfo,
5
+ AdRewardInfo,
6
+ } from './AdInfo';
2
7
 
3
- export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
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
+ }
@@ -2,36 +2,36 @@ import type { ErrorCode } from '../ErrorCode';
2
2
 
3
3
  // Represents an ad
4
4
  export type AdInfo = {
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;
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
- // The ad unit ID for which this ad was loaded.
14
- adUnitId: string;
13
+ // The ad unit ID for which this ad was loaded.
14
+ adUnitId: string;
15
15
 
16
- // The error code for the error.
17
- code: ErrorCode;
16
+ // The error code for the error.
17
+ code: ErrorCode;
18
18
 
19
- message: string;
19
+ message: string;
20
20
 
21
- // The total latency in milliseconds for this waterfall to finish processing.
22
- latencyMillis: number;
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
- message: string | null;
27
+ message: string | null;
28
28
  };
29
29
 
30
30
  // Represents a reward given to the user.
31
31
  export type AdRewardInfo = {
32
- // The reward label.
33
- rewardLabel?: string | null;
32
+ // The reward label.
33
+ rewardLabel?: string | null;
34
34
 
35
- // The rewarded amount.
36
- rewardAmount: string;
37
- };
35
+ // The rewarded amount.
36
+ rewardAmount: string;
37
+ };
@@ -1,18 +1,17 @@
1
- import type { AdLoadFailedInfo } from "./AdInfo";
1
+ import type { AdLoadFailedInfo } from './AdInfo';
2
2
 
3
- import type { AdInfo } from "./AdInfo";
3
+ import type { AdInfo } from './AdInfo';
4
4
 
5
5
  export type AdProps = {
6
+ adUnitId: string;
6
7
 
7
- adUnitId: string;
8
+ placement?: string | null;
8
9
 
9
- placement?: string | null;
10
+ onAdLoaded?: (adInfo: AdInfo) => void;
10
11
 
11
- onAdLoaded?: (adInfo: AdInfo) => void;
12
+ onAdLoadFailed?: (error: AdLoadFailedInfo) => void;
12
13
 
13
- onAdLoadFailed?: (error: AdLoadFailedInfo) => void;
14
+ onAdClicked?: (adInfo: AdInfo) => void;
14
15
 
15
- onAdClicked?: (adInfo: AdInfo) => void;
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
- isInitialized: () => Promise<boolean>;
5
- initialize: (sdkKey: string) => Promise<void>;
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 "react-native";
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
- * Loads a native ad.
9
- */
10
- loadAd(): void;
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
- loadOnMount?: boolean;
17
+ loadOnMount?: boolean;
18
18
  };
@@ -2,4 +2,4 @@ export * from './AdInfo';
2
2
  export * from './NativeAdViewProps';
3
3
  export * from './AdBannerViewProps';
4
4
  export * from './AdEvent';
5
- export * from './AdProps';
5
+ export * from './AdProps';
@@ -1,5 +0,0 @@
1
- DaroM_kotlinVersion=2.0.21
2
- DaroM_minSdkVersion=23
3
- DaroM_targetSdkVersion=34
4
- DaroM_compileSdkVersion=35
5
- DaroM_ndkversion=21.4.7075529
@@ -1,7 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- <application>
3
- <activity
4
- android:name=".cheat.DummyActivity"
5
- android:theme="@style/Theme.TransparentActivity" />
6
- </application>
7
- </manifest>
@@ -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,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <LinearLayout
3
- xmlns:android="http://schemas.android.com/apk/res/android"
4
- android:layout_width="match_parent"
5
- android:layout_height="match_parent"
6
- android:orientation="vertical">
7
- </LinearLayout>
@@ -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,6 +0,0 @@
1
- #import <React/RCTViewManager.h>
2
- #import <React/RCTBridgeModule.h>
3
- #import <React/RCTEventEmitter.h>
4
- #import <React/RCTUIManager.h>
5
- #import <React/RCTImageView.h>
6
- #import <React/RCTTextView.h>
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=AppOpenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/AppOpenAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=FullScreenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/FullScreenAd.ts"],"mappings":"","ignoreList":[]}