react-native-daro 1.0.16 → 2.0.0

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 (179) hide show
  1. package/README.md +2 -5
  2. package/android/build.gradle +7 -13
  3. package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
  4. package/android/src/main/java/com/daro/reactnative/{DaroMAdNativeViewManager.kt → DaroRNAdNativeViewManager.kt} +34 -38
  5. package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +388 -0
  6. package/android/src/main/java/com/daro/reactnative/{DaroMPackage.kt → DaroRNPackage.kt} +7 -7
  7. package/android/src/main/java/com/daro/reactnative/DaroSdkBridge.kt +52 -0
  8. package/android/src/main/java/com/daro/reactnative/constants/{InternalDaroMBannerSize.kt → InternalDaroRNBannerSize.kt} +2 -2
  9. package/android/src/main/java/com/daro/reactnative/event/{DaroMEvent.kt → DaroRNEvent.kt} +8 -7
  10. package/android/src/main/java/com/daro/reactnative/impl/{DaroMBannerViewModuleImpl.kt → DaroRNBannerViewModuleImpl.kt} +3 -3
  11. package/android/src/main/java/com/daro/reactnative/impl/{DaroMInterstitialModuleImpl.kt → DaroRNInterstitialModuleImpl.kt} +4 -4
  12. package/android/src/main/java/com/daro/reactnative/impl/DaroRNLightPopupModuleImpl.kt +163 -0
  13. package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
  14. package/android/src/main/java/com/daro/reactnative/impl/LightPopupRequest.kt +51 -0
  15. package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +12 -0
  16. package/android/src/main/java/com/daro/reactnative/util/DaroQaProbe.kt +147 -0
  17. package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +2 -2
  18. package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
  19. package/android/src/main/java/com/daro/reactnative/view/{DaroMAdNativeViewContainer.kt → DaroRNAdNativeViewContainer.kt} +23 -4
  20. package/android/src/newarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +1 -1
  21. package/android/src/oldarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +35 -3
  22. package/android/src/test/java/com/daro/reactnative/impl/LightPopupRequestTest.kt +62 -0
  23. package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +10 -11
  24. package/ios/DaroRNModule+Consent.swift +88 -0
  25. package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +9 -9
  26. package/ios/DaroRNModule+LightPopup.swift +211 -0
  27. package/ios/DaroRNModule+Qa.swift +159 -0
  28. package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +10 -10
  29. package/ios/{DaroMModule.mm → DaroRNModule.mm} +20 -4
  30. package/ios/{DaroMModule.swift → DaroRNModule.swift} +32 -6
  31. package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
  32. package/ios/Fabric/{DaroMFabricEventSink.mm → DaroRNFabricEventSink.mm} +4 -4
  33. package/ios/Fabric/{DaroMFabricPropApplier.mm → DaroRNFabricPropApplier.mm} +14 -14
  34. package/ios/Fabric/DaroRNNativeAdComponentView.mm +320 -0
  35. package/ios/Paper/{DaroMAdBannerViewManager.m → DaroRNAdBannerViewManager.m} +1 -1
  36. package/ios/Paper/{DaroMAdBannerViewManager.swift → DaroRNAdBannerViewManager.swift} +5 -5
  37. package/ios/Paper/{DaroMNativeAdViewManager.m → DaroRNNativeAdViewManager.m} +2 -1
  38. package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
  39. package/ios/Shared/DaroMediationDebugger.swift +14 -0
  40. package/ios/Shared/{DaroMAdEventSink.swift → DaroRNAdEventSink.swift} +2 -1
  41. package/ios/Shared/{DaroMBannerAdView.swift → DaroRNBannerAdView.swift} +11 -11
  42. package/ios/Shared/{DaroMNativeAdLoadCoordinator.swift → DaroRNNativeAdLoadCoordinator.swift} +4 -4
  43. package/ios/Shared/{DaroMNativeAdView.swift → DaroRNNativeAdView.swift} +29 -21
  44. package/ios/Shared/{DaroMNativeAssetResolver.swift → DaroRNNativeAssetResolver.swift} +6 -6
  45. package/lib/commonjs/AdBannerView.js +3 -5
  46. package/lib/commonjs/AdBannerView.js.map +1 -1
  47. package/lib/commonjs/AppOpenAd.js +4 -4
  48. package/lib/commonjs/AppOpenAd.js.map +1 -1
  49. package/lib/commonjs/{DaroMAdBannerViewNativeComponent.ts → DaroRNAdBannerViewNativeComponent.ts} +5 -2
  50. package/{src/DaroMNativeAdViewNativeComponent.ts → lib/commonjs/DaroRNNativeAdViewNativeComponent.ts} +8 -2
  51. package/lib/commonjs/LightPopupAd.js +15 -1
  52. package/lib/commonjs/LightPopupAd.js.map +1 -1
  53. package/lib/commonjs/NativeDaroModule.js +1 -1
  54. package/lib/commonjs/NativeDaroModule.js.map +1 -1
  55. package/lib/commonjs/hooks/useLightPopupAd.js +6 -4
  56. package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -1
  57. package/lib/commonjs/index.js +121 -0
  58. package/lib/commonjs/index.js.map +1 -1
  59. package/lib/commonjs/nativeAd/NativeAdView.js +10 -3
  60. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  61. package/lib/commonjs/types/NativeAdViewProps.js +21 -0
  62. package/lib/commonjs/types/NativeAdViewProps.js.map +1 -1
  63. package/lib/module/AdBannerView.js +1 -3
  64. package/lib/module/AdBannerView.js.map +1 -1
  65. package/lib/module/AppOpenAd.js +4 -4
  66. package/lib/module/AppOpenAd.js.map +1 -1
  67. package/{src/DaroMAdBannerViewNativeComponent.ts → lib/module/DaroRNAdBannerViewNativeComponent.ts} +5 -2
  68. package/lib/{commonjs/DaroMNativeAdViewNativeComponent.ts → module/DaroRNNativeAdViewNativeComponent.ts} +8 -2
  69. package/lib/module/LightPopupAd.js +15 -1
  70. package/lib/module/LightPopupAd.js.map +1 -1
  71. package/lib/module/NativeDaroModule.js +1 -1
  72. package/lib/module/NativeDaroModule.js.map +1 -1
  73. package/lib/module/hooks/useLightPopupAd.js +6 -4
  74. package/lib/module/hooks/useLightPopupAd.js.map +1 -1
  75. package/lib/module/index.js +101 -0
  76. package/lib/module/index.js.map +1 -1
  77. package/lib/module/nativeAd/NativeAdView.js +8 -1
  78. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  79. package/lib/module/types/NativeAdViewProps.js +22 -1
  80. package/lib/module/types/NativeAdViewProps.js.map +1 -1
  81. package/lib/typescript/commonjs/plugin/src/index.d.ts +2 -6
  82. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +2 -6
  84. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/plugin/src/withIos.d.ts +2 -6
  86. package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +2 -2
  89. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
  91. package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +6 -2
  93. package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/src/LightPopupAd.d.ts +3 -0
  95. package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +11 -1
  97. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/src/index.d.ts +79 -0
  100. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +2 -0
  102. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/types/AdInfo.d.ts +15 -0
  104. package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/types/AdProps.d.ts +0 -1
  106. package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +9 -0
  108. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
  109. package/lib/typescript/module/plugin/src/index.d.ts +2 -6
  110. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
  111. package/lib/typescript/module/plugin/src/withAndroid.d.ts +2 -6
  112. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
  113. package/lib/typescript/module/plugin/src/withIos.d.ts +2 -6
  114. package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
  115. package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
  116. package/lib/typescript/module/src/AppOpenAd.d.ts +2 -2
  117. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  118. package/lib/typescript/module/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
  119. package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  120. package/lib/typescript/module/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +6 -2
  121. package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  122. package/lib/typescript/module/src/LightPopupAd.d.ts +3 -0
  123. package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
  124. package/lib/typescript/module/src/NativeDaroModule.d.ts +11 -1
  125. package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
  126. package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -1
  127. package/lib/typescript/module/src/index.d.ts +79 -0
  128. package/lib/typescript/module/src/index.d.ts.map +1 -1
  129. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +2 -0
  130. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
  131. package/lib/typescript/module/src/types/AdInfo.d.ts +15 -0
  132. package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
  133. package/lib/typescript/module/src/types/AdProps.d.ts +0 -1
  134. package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
  135. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +9 -0
  136. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
  137. package/package.json +8 -5
  138. package/plugin/build/index.d.ts +2 -6
  139. package/plugin/build/index.js +21 -56
  140. package/plugin/build/withAndroid.d.ts +2 -6
  141. package/plugin/build/withAndroid.js +48 -90
  142. package/plugin/build/withIos.d.ts +2 -6
  143. package/plugin/build/withIos.js +37 -33
  144. package/react-native-daro.podspec +2 -3
  145. package/src/AdBannerView.tsx +1 -3
  146. package/src/AppOpenAd.ts +2 -8
  147. package/{lib/module/DaroMAdBannerViewNativeComponent.ts → src/DaroRNAdBannerViewNativeComponent.ts} +5 -2
  148. package/{lib/module/DaroMNativeAdViewNativeComponent.ts → src/DaroRNNativeAdViewNativeComponent.ts} +8 -2
  149. package/src/LightPopupAd.ts +18 -1
  150. package/src/NativeDaroModule.ts +18 -2
  151. package/src/hooks/useLightPopupAd.ts +6 -4
  152. package/src/index.tsx +136 -0
  153. package/src/nativeAd/NativeAdView.tsx +22 -1
  154. package/src/types/AdInfo.ts +17 -0
  155. package/src/types/AdProps.ts +0 -2
  156. package/src/types/NativeAdViewProps.ts +10 -0
  157. package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
  158. package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -155
  159. package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -257
  160. package/android/src/main/java/com/daro/reactnative/impl/DaroMLightPopupModuleImpl.kt +0 -150
  161. package/ios/DaroMModule+LightPopup.swift +0 -183
  162. package/ios/Fabric/DaroMAdBannerComponentView.mm +0 -207
  163. package/ios/Fabric/DaroMNativeAdComponentView.mm +0 -294
  164. package/ios/Paper/DaroMNativeAdViewManager.swift +0 -22
  165. package/ios/mediation/admob/DaroMediationDebugger.swift +0 -11
  166. package/lib/commonjs/types/DaroMMobileAds.js +0 -2
  167. package/lib/commonjs/types/DaroMMobileAds.js.map +0 -1
  168. package/lib/module/types/DaroMMobileAds.js +0 -2
  169. package/lib/module/types/DaroMMobileAds.js.map +0 -1
  170. package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
  171. package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
  172. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts +0 -6
  173. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +0 -1
  174. package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
  175. package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
  176. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts +0 -6
  177. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +0 -1
  178. package/src/types/DaroMMobileAds.ts +0 -5
  179. /package/ios/{mediation/admob → Shared}/DaroMediationTypes.swift +0 -0
package/src/index.tsx CHANGED
@@ -35,6 +35,73 @@ export async function initialize() {
35
35
  await NativeDaroModule.initializeSdk();
36
36
  }
37
37
 
38
+ export async function isInitialized(): Promise<boolean> {
39
+ return NativeDaroModule.isInitialized();
40
+ }
41
+
42
+ export type DaroMediationStatus = {
43
+ mediationPlatform: string;
44
+ isReady: boolean;
45
+ hasFailed: boolean;
46
+ };
47
+
48
+ // 키가 공개 어휘(`daroa`/`darom`)를 따른다 (DARO-1594). 한때 `admob`/`applovin` 이었고
49
+ // 그것은 벤더 이름이라 공개 표면에서 걷었다.
50
+ export type DaroMediationWeights = {
51
+ daroa: number;
52
+ darom: number;
53
+ };
54
+
55
+ export async function getSdkVersion(): Promise<string | null> {
56
+ return (await NativeDaroModule.getSdkVersion()) ?? null;
57
+ }
58
+
59
+ export async function getMediationStatuses(): Promise<
60
+ DaroMediationStatus[] | null
61
+ > {
62
+ const statuses = await NativeDaroModule.getMediationStatuses();
63
+ return (statuses as DaroMediationStatus[] | null) ?? null;
64
+ }
65
+
66
+ export async function getMediationWeights(): Promise<DaroMediationWeights | null> {
67
+ const weights = await NativeDaroModule.getMediationWeights();
68
+ return (weights as DaroMediationWeights | null) ?? null;
69
+ }
70
+
71
+ /**
72
+ * 미디에이션별 벤더 검사기를 띄운다.
73
+ *
74
+ * 값은 {@link DaroAdInfo.mediationPlatform} 과 **같은 어휘**다. 구 어휘
75
+ * (`admob`/`applovin`)도 네이티브가 아직 받아주지만 타입으로는 광고하지 않는다 —
76
+ * 벤더 이름을 공개 표면에서 걷는 것이 이 어휘를 만든 이유다.
77
+ */
78
+ export async function showMediationDebuggerFor(mediation: 'daroa' | 'darom') {
79
+ await NativeDaroModule.showMediationDebuggerFor(mediation);
80
+ }
81
+
82
+ export type DaroAdapterRow = {
83
+ name: string;
84
+ detail: string;
85
+ isReady: boolean;
86
+ };
87
+
88
+ // QA 전용 — 벤더 SDK(GMA·MAX)에 직접 묻는다. SDK 는 서브네트워크 목록을 갖지 않는다.
89
+ export async function getAdapterInventory(): Promise<
90
+ Record<string, DaroAdapterRow[]>
91
+ > {
92
+ const inventory = await NativeDaroModule.getAdapterInventory();
93
+ return inventory as Record<string, DaroAdapterRow[]>;
94
+ }
95
+
96
+ // QA 전용 — 주입 결과(런타임 plist/manifest)의 파생 키를 그대로 돌려준다. JS 는
97
+ // 원문을 읽을 수 없어 이 브리지가 유일한 창이다. 판정·마스킹은 앱이 한다.
98
+ export async function getIntegrationKeyInfo(): Promise<
99
+ Record<string, string | null>
100
+ > {
101
+ const info = await NativeDaroModule.getIntegrationKeyInfo();
102
+ return info as Record<string, string | null>;
103
+ }
104
+
38
105
  export async function showMediationDebugger() {
39
106
  await NativeDaroModule.showMediationDebugger();
40
107
  }
@@ -42,3 +109,72 @@ export async function showMediationDebugger() {
42
109
  export async function setUserId(userId: string) {
43
110
  await NativeDaroModule.setUserId(userId);
44
111
  }
112
+
113
+ /**
114
+ * GDPR 동의 상태. `unknown` 이 SDK 기본값(미확정)이다.
115
+ *
116
+ * **네이티브의 표현을 노출하지 않는다.** Android 는 `GdprStatus` enum 이름
117
+ * (`OPT_IN`…), iOS 는 `DaroGdprStatus` 의 Int raw value(0…3)로 같은 개념을 서로 다르게
118
+ * 적는다. 둘 중 하나를 골라 JS 계약으로 삼으면 나머지 플랫폼이 그 표현을 되옮겨야 하고,
119
+ * 되옮기는 코드가 없거나 낡으면 **에러 없이 틀린 상태가 전달된다** — Flutter 가 Android
120
+ * enum 이름을 그대로 보내 iOS 에서 어긋난 것이 그 사고다(DARO-1471). 그래서 JS 는 어느
121
+ * 플랫폼 것도 아닌 문자열을 쓰고, 옮기는 일은 각 네이티브 어댑터가 자기 쪽에서 한다.
122
+ */
123
+ export type DaroGdprStatus = 'optIn' | 'optOut' | 'notApplicable' | 'unknown';
124
+
125
+ /** CCPA 동의 상태. GDPR 과 달리 `unknown` 이 없다. */
126
+ export type DaroCcpaStatus = 'optIn' | 'optOut' | 'notApplicable';
127
+
128
+ /** 퍼블리셔가 선언하는 COPPA 아동 대상 여부. */
129
+ export type DaroCoppaStatus = 'child' | 'notChild';
130
+
131
+ /**
132
+ * GDPR 동의 상태를 설정한다.
133
+ *
134
+ * **{@link initialize} 전에 호출한다.** 동의는 첫 광고 요청보다 먼저 확정돼 있어야 한다.
135
+ * 셋 중 {@link setCoppa} 는 이것이 권고가 아니라 요구이고, 나머지 둘의 순서를 거기에
136
+ * 맞춘다 — 세 API 의 규칙이 갈리면 지키는 쪽이 더 어렵다.
137
+ *
138
+ * 모르는 상태 문자열은 **기본값으로 떨어지지 않고 reject 된다**(`INVALID_CONSENT_STATUS`).
139
+ * 동의는 조용히 틀리면 안 되는 값이라, 오타가 "일단 옵트인"으로 흡수되는 쪽이 더 나쁘다.
140
+ *
141
+ * **이미 넘긴 동의 문자열이 있으면 상태만 갱신할 때도 같이 넘겨라.** 빈 문자열은 양쪽
142
+ * 플랫폼 모두 건너뛰므로 이전 값이 지워지지는 않지만, 상태와 문자열을 한 호출로 함께
143
+ * 넘기면 어느 쪽이 최신인지 따질 일이 아예 없다.
144
+ *
145
+ * @param consentString IAB TCF 동의 문자열. 없으면 비워 둔다.
146
+ */
147
+ export async function setGdpr(
148
+ status: DaroGdprStatus,
149
+ consentString: string = ''
150
+ ) {
151
+ await NativeDaroModule.setGdpr(status, consentString);
152
+ }
153
+
154
+ /**
155
+ * CCPA 동의 상태를 설정한다.
156
+ *
157
+ * **{@link initialize} 전에 호출한다** — {@link setGdpr} 과 같은 이유다.
158
+ *
159
+ * `consentString` 취급도 {@link setGdpr} 과 같다 — 빈 문자열은 이전 값을 덮지 않고,
160
+ * 상태만 갱신할 때도 이미 넘긴 문자열이 있으면 같이 넘기는 편이 낫다.
161
+ *
162
+ * @param consentString IAB US Privacy 문자열. 없으면 비워 둔다.
163
+ */
164
+ export async function setCcpa(
165
+ status: DaroCcpaStatus,
166
+ consentString: string = ''
167
+ ) {
168
+ await NativeDaroModule.setCcpa(status, consentString);
169
+ }
170
+
171
+ /**
172
+ * COPPA 아동 대상 여부를 설정한다.
173
+ *
174
+ * **{@link initialize} 전에 호출한다.** 셋 중 이것만은 순서가 권고가 아니라 요구다 —
175
+ * 아동 대상으로 선언하면 광고 식별자 전송이 차단되는데, 그 차단이 **초기화 요청부터**
176
+ * 걸려야 한다. 초기화 뒤에 부르면 첫 요청은 이미 식별자를 달고 나간 뒤다.
177
+ */
178
+ export async function setCoppa(status: DaroCoppaStatus) {
179
+ await NativeDaroModule.setCoppa(status);
180
+ }
@@ -11,10 +11,11 @@ import {
11
11
  import { View, type ViewProps } from 'react-native';
12
12
  import NativeAdViewNativeComponent, {
13
13
  Commands,
14
- } from '../DaroMNativeAdViewNativeComponent';
14
+ } from '../DaroRNNativeAdViewNativeComponent';
15
15
  import NativeDaroModule from '../NativeDaroModule';
16
16
  import type { AdNativeEvent } from '../types/AdEvent';
17
17
  import type { AdInfo, AdLoadFailedInfo } from '../types/AdInfo';
18
+ import { NativeAdAssetType } from '../types/NativeAdViewProps';
18
19
  import type {
19
20
  NativeAdViewHandler,
20
21
  NativeAdViewProps,
@@ -26,6 +27,10 @@ import {
26
27
 
27
28
  type NativeAdViewElement = ElementRef<typeof NativeAdViewNativeComponent>;
28
29
 
30
+ const KNOWN_NATIVE_AD_ASSET_TYPES: ReadonlySet<string> = new Set(
31
+ Object.values(NativeAdAssetType)
32
+ );
33
+
29
34
  export const NativeAdView = forwardRef<
30
35
  NativeAdViewHandler,
31
36
  NativeAdViewProps & ViewProps
@@ -65,6 +70,7 @@ const NativeAdViewImpl = forwardRef<
65
70
  {
66
71
  adUnitId,
67
72
  onAdLoaded,
73
+ onNativeAdAssetLoaded,
68
74
  onAdLoadFailed,
69
75
  onAdClicked,
70
76
  onAdImpressionRecorded,
@@ -93,6 +99,20 @@ const NativeAdViewImpl = forwardRef<
93
99
  nativeAdViewRef.current = element;
94
100
  }, []);
95
101
 
102
+ const onNativeAdAssetLoadedEvent = useCallback(
103
+ (event: { nativeEvent: { assetTypes: readonly string[] } }) => {
104
+ onNativeAdAssetLoaded?.(
105
+ new Set(
106
+ event.nativeEvent.assetTypes.filter(
107
+ (value): value is NativeAdAssetType =>
108
+ KNOWN_NATIVE_AD_ASSET_TYPES.has(value)
109
+ )
110
+ )
111
+ );
112
+ },
113
+ [onNativeAdAssetLoaded]
114
+ );
115
+
96
116
  const onAdLoadedEvent = useCallback(
97
117
  (event: AdNativeEvent<AdInfo>) => {
98
118
  onAdLoaded?.(event.nativeEvent);
@@ -150,6 +170,7 @@ const NativeAdViewImpl = forwardRef<
150
170
  mediaViewStyleProps={
151
171
  nativeAdAssetRegistrations.mediaView?.styleProps ?? null
152
172
  }
173
+ onNativeAdAssetLoadedEvent={onNativeAdAssetLoadedEvent}
153
174
  onAdLoadedEvent={onAdLoadedEvent}
154
175
  onAdLoadFailedEvent={onAdLoadFailedEvent}
155
176
  onAdClickedEvent={onAdClickedEvent}
@@ -6,6 +6,23 @@ export type AdInfo = {
6
6
  adUnitId: string;
7
7
  // The total latency in milliseconds for this waterfall to finish processing.
8
8
  latencyMillis: number;
9
+
10
+ /**
11
+ * 이 광고를 서빙한 미디에이션. `"daroa"` 또는 `"darom"`.
12
+ *
13
+ * **열거형이 아니라 문자열이다.** 값이 늘어날 수 있고, 그때 앱이 다시 빌드되지
14
+ * 않아야 한다.
15
+ *
16
+ * 로드 응답이 있어야 알 수 있으므로 요청 시점 이벤트에는 없다.
17
+ */
18
+ mediationPlatform?: string;
19
+
20
+ /**
21
+ * 이 광고를 실제로 채운 네트워크 이름. **벤더 어휘이고 정규화하지 않는다** —
22
+ * AdMob 은 `adSourceName`, AppLovin 은 `networkName` 이 출처다. 보기 좋게
23
+ * 매핑하면 벤더가 이름을 바꿀 때 조용히 틀린 값을 보여준다.
24
+ */
25
+ adNetwork?: string;
9
26
  };
10
27
 
11
28
  // Encapsulates various data for MAX load errors.
@@ -5,8 +5,6 @@ import type { AdInfo } from './AdInfo';
5
5
  export type AdProps = {
6
6
  adUnitId: string;
7
7
 
8
- placement?: string | null;
9
-
10
8
  onAdLoaded?: (adInfo: AdInfo) => void;
11
9
 
12
10
  onAdLoadFailed?: (error: AdLoadFailedInfo) => void;
@@ -1,5 +1,14 @@
1
1
  import type { AdProps } from './AdProps';
2
2
 
3
+ export enum NativeAdAssetType {
4
+ TITLE = 'title', // 광고 제목
5
+ BODY = 'body', // 광고 본문
6
+ ICON = 'icon', // 광고 아이콘
7
+ MEDIA = 'media', // 광고 이미지 또는 동영상
8
+ CALL_TO_ACTION = 'callToAction', // 행동 유도 버튼 문구
9
+ ADVERTISER = 'advertiser', // 광고주명
10
+ }
11
+
3
12
  export type AdChoicesPosition =
4
13
  | 'topLeft'
5
14
  | 'topRight'
@@ -20,6 +29,7 @@ export type NativeAdViewHandler = {
20
29
  * Represents a {@link NativeAdView}.
21
30
  */
22
31
  export type NativeAdViewProps = AdProps & {
32
+ onNativeAdAssetLoaded?: (assetTypes: ReadonlySet<NativeAdAssetType>) => void;
23
33
  loadOnMount?: boolean;
24
34
  adChoicesPosition?: AdChoicesPosition;
25
35
  };
@@ -1,23 +0,0 @@
1
- package com.daro.reactnative
2
-
3
- import android.app.Application
4
- import android.content.Context
5
- import droom.daro.SDKConfig
6
- import droom.daro.a.Daro
7
-
8
- internal object DaroSdkBridge {
9
- fun initialize(application: Application, sdkConfig: SDKConfig) {
10
- Daro.init(
11
- application = application,
12
- sdkConfig = sdkConfig,
13
- )
14
- }
15
-
16
- fun openDebugger(context: Context) {
17
- Daro.openDebugger(context)
18
- }
19
-
20
- fun setUserId(context: Context, userId: String) {
21
- Daro.setUserId(context, userId)
22
- }
23
- }
@@ -1,155 +0,0 @@
1
- package com.daro.reactnative
2
-
3
- import com.daro.reactnative.constants.InternalDaroMBannerSize
4
- import com.daro.reactnative.event.AdViewEvent
5
- import com.daro.reactnative.view.DaroMAdBannerViewContainer
6
- import com.facebook.react.bridge.ReadableArray
7
- import com.facebook.react.uimanager.ReactStylesDiffMap
8
- import com.facebook.react.uimanager.SimpleViewManager
9
- import com.facebook.react.uimanager.StateWrapper
10
- import com.facebook.react.uimanager.ThemedReactContext
11
- import com.facebook.react.uimanager.ViewManagerDelegate
12
- import com.facebook.react.uimanager.annotations.ReactProp
13
- import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerDelegate
14
- import com.facebook.react.viewmanagers.DaroMAdBannerViewManagerInterface
15
-
16
- class DaroMAdBannerViewManager : SimpleViewManager<DaroMAdBannerViewContainer>(),
17
- DaroMAdBannerViewManagerInterface<DaroMAdBannerViewContainer> {
18
-
19
- private val delegate: ViewManagerDelegate<DaroMAdBannerViewContainer> =
20
- DaroMAdBannerViewManagerDelegate(this)
21
-
22
- override fun getDelegate(): ViewManagerDelegate<DaroMAdBannerViewContainer> = delegate
23
-
24
- override fun getName(): String {
25
- return "DaroMAdBannerView"
26
- }
27
-
28
- companion object {
29
- private const val COMMAND_LOAD_AD: Int = 1
30
-
31
- private val viewCache: MutableMap<String, DaroMAdBannerViewContainer> = mutableMapOf()
32
- }
33
-
34
- override fun createViewInstance(
35
- reactTag: Int,
36
- reactContext: ThemedReactContext,
37
- initialProps: ReactStylesDiffMap?,
38
- stateWrapper: StateWrapper?,
39
- ): DaroMAdBannerViewContainer {
40
- val placement = initialProps?.getString("placement")
41
- val adUnitId = initialProps?.getString("adUnitId")
42
-
43
- val cacheKey = when {
44
- adUnitId.isNullOrBlank() || placement.isNullOrBlank() -> ""
45
- else -> "{$adUnitId}_${placement}${reactContext.hashCode()}"
46
- }
47
-
48
- if (cacheKey.isNotBlank()) {
49
- viewCache.keys
50
- .filter { it.contains(cacheKey) && it != cacheKey }
51
- .forEach { viewCache.remove(it)?.destroy() }
52
- }
53
-
54
- return cacheKey.let {
55
- viewCache[cacheKey].let { cachedView ->
56
- cachedView?.id = reactTag
57
-
58
- if (cachedView?.parent == null) {
59
- cachedView?.resumeAd()
60
- cachedView
61
- } else {
62
- null
63
- }
64
- }
65
- } ?: super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper).also { view ->
66
- if (cacheKey.isNotBlank()) viewCache[cacheKey] = view
67
- }
68
- }
69
-
70
- override fun createViewInstance(reactContext: ThemedReactContext): DaroMAdBannerViewContainer {
71
- return DaroMAdBannerViewContainer(reactContext).apply {
72
- loadOnMount = true
73
- }
74
- }
75
-
76
- override fun getCommandsMap(): MutableMap<String, Int> {
77
- return mutableMapOf(
78
- "loadAd" to COMMAND_LOAD_AD,
79
- )
80
- }
81
-
82
- override fun onAfterUpdateTransaction(view: DaroMAdBannerViewContainer) {
83
- super.onAfterUpdateTransaction(view)
84
- view.onSetProps()
85
- }
86
-
87
- override fun onDropViewInstance(view: DaroMAdBannerViewContainer) {
88
- super.onDropViewInstance(view)
89
-
90
- val isCached = viewCache.values.contains(view)
91
- if (isCached) {
92
- view.pauseAd()
93
- } else {
94
- view.destroy()
95
- }
96
- }
97
-
98
- @Deprecated("")
99
- override fun receiveCommand(
100
- root: DaroMAdBannerViewContainer,
101
- commandId: Int,
102
- args: ReadableArray?,
103
- ) {
104
- when (commandId) {
105
- COMMAND_LOAD_AD -> {
106
- root.loadAd()
107
- }
108
- }
109
- }
110
-
111
- override fun receiveCommand(
112
- root: DaroMAdBannerViewContainer,
113
- commandId: String,
114
- args: ReadableArray?,
115
- ) {
116
- when (commandId) {
117
- "loadAd" -> root.loadAd()
118
- }
119
- }
120
-
121
- @ReactProp(name = "isVisible")
122
- override fun setIsVisible(view: DaroMAdBannerViewContainer, isVisible: Boolean) {
123
- view.setAdVisibility(isVisible)
124
- }
125
-
126
- @ReactProp(name = "adUnitId")
127
- override fun setAdUnitId(view: DaroMAdBannerViewContainer, adUnitId: String?) {
128
- view.adUnitId = adUnitId.orEmpty()
129
- }
130
-
131
- @ReactProp(name = "adFormat")
132
- override fun setAdFormat(view: DaroMAdBannerViewContainer, adFormat: String?) {
133
- view.adSize = adFormat?.let { InternalDaroMBannerSize.fromName(it).toBannerSize() }
134
- }
135
-
136
- @ReactProp(name = "loadOnMount")
137
- override fun setLoadOnMount(view: DaroMAdBannerViewContainer, loadOnMount: Boolean) {
138
- view.loadOnMount = loadOnMount
139
- }
140
-
141
- @ReactProp(name = "placement")
142
- override fun setPlacement(view: DaroMAdBannerViewContainer, placement: String?) {
143
- }
144
-
145
- override fun loadAd(view: DaroMAdBannerViewContainer) {
146
- view.loadAd()
147
- }
148
-
149
- @OptIn(ExperimentalStdlibApi::class)
150
- override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
151
- return AdViewEvent.entries.associate {
152
- it.value to mutableMapOf("registrationName" to it.registrationName)
153
- }.toMutableMap()
154
- }
155
- }
@@ -1,257 +0,0 @@
1
- package com.daro.reactnative
2
-
3
- import android.app.Application
4
- import android.content.Context
5
- import com.daro.reactnative.constants.InternalDaroMBannerSize
6
- import com.daro.reactnative.event.AppOpenEvent
7
- import com.daro.reactnative.event.DaroMEvent
8
- import com.daro.reactnative.event.InterstitialEvent
9
- import com.daro.reactnative.event.LightPopupEvent
10
- import com.daro.reactnative.event.RewardedEvent
11
- import com.daro.reactnative.impl.DaroMBannerViewModuleImpl
12
- import com.daro.reactnative.impl.DaroMInterstitialModuleImpl
13
- import com.daro.reactnative.impl.DaroMLightPopupModuleImpl
14
- import com.daro.reactnative.impl.DaroMRewardedAdModuleImpl
15
- import com.daro.reactnative.util.EventEmitterUtil
16
- import com.facebook.react.bridge.Promise
17
- import com.facebook.react.bridge.ReactApplicationContext
18
- import com.facebook.react.bridge.ReactContext
19
- import com.facebook.react.bridge.ReactMethod
20
- import com.facebook.react.bridge.ReadableMap
21
- import com.facebook.react.bridge.WritableMap
22
- import droom.daro.SDKConfig
23
-
24
- class DaroMModule(reactContext: ReactApplicationContext) :
25
- DaroMModuleSpec(reactContext) {
26
-
27
- companion object {
28
- const val NAME = "DaroMModule"
29
- private const val APP_OPEN_UNSUPPORTED_CODE = "APP_OPEN_UNSUPPORTED"
30
- private const val APP_OPEN_UNSUPPORTED_MESSAGE = "AppOpen ad is not supported on Android"
31
- }
32
-
33
- private val context: Context = reactApplicationContext
34
-
35
- private var isInitialized: Boolean = false
36
-
37
- @ReactMethod
38
- override fun addListener(eventName: String) = Unit
39
-
40
- @ReactMethod
41
- override fun removeListeners(count: Double) = Unit
42
-
43
- @ReactMethod
44
- override fun initializeSdk(promise: Promise) {
45
- DaroSdkBridge.initialize(
46
- application = context.applicationContext as Application,
47
- sdkConfig = SDKConfig.Builder()
48
- .setDebugMode(false)
49
- .build()
50
- )
51
-
52
- isInitialized = true
53
- promise.resolve(null)
54
- }
55
-
56
- @ReactMethod
57
- override fun isInitialized(promise: Promise) {
58
- promise.resolve(isInitialized)
59
- }
60
-
61
- @ReactMethod
62
- override fun showMediationDebugger(promise: Promise) {
63
- DaroSdkBridge.openDebugger(context)
64
- promise.resolve(null)
65
- }
66
-
67
- @ReactMethod
68
- override fun setUserId(userId: String, promise: Promise) {
69
- DaroSdkBridge.setUserId(context, userId)
70
- promise.resolve(null)
71
- }
72
-
73
- protected override fun getTypedExportedConstants(): MutableMap<String, Any> {
74
- val constants = mutableMapOf<String, Any>()
75
- constants.putAll(daroMInterstitialModule.getComponents())
76
- constants.putAll(daroMRewardedModule.getComponents())
77
- constants.putAll(daroMLightPopupModule.getComponents())
78
- constants.putAll(daroMAppOpenModule.getComponents())
79
- constants.putAll(daroMBannerModule.getComponents())
80
-
81
- return constants
82
- }
83
-
84
- internal abstract class DaroMComponentModule(protected val context: ReactContext) {
85
- abstract fun getComponents(): MutableMap<String, Any>
86
-
87
- fun sendNativeEvent(event: DaroMEvent, params: WritableMap?) {
88
- EventEmitterUtil.sendReactNativeEvent(
89
- reactContext = context,
90
- event = event,
91
- params = params,
92
- )
93
- }
94
- }
95
-
96
- @OptIn(ExperimentalStdlibApi::class)
97
- internal abstract class DaroMInterstitialModule(context: ReactContext) :
98
- DaroMComponentModule(context) {
99
- abstract fun isInterstitialReady(requestId: Int, adUnitId: String, promise: Promise)
100
- abstract fun loadInterstitial(requestId: Int, adUnitId: String)
101
- abstract fun showInterstitial(requestId: Int, adUnitId: String)
102
-
103
- override fun getComponents(): MutableMap<String, Any> {
104
- return InterstitialEvent.entries.associate { it.value to it.value }.toMutableMap()
105
- }
106
- }
107
-
108
- private val daroMInterstitialModule: DaroMInterstitialModule =
109
- DaroMInterstitialModuleImpl(
110
- context = reactContext,
111
- getCurrentActivity = { reactApplicationContext.currentActivity }
112
- )
113
-
114
- @ReactMethod
115
- override fun isInterstitialReady(requestId: Double, adUnitId: String, promise: Promise) {
116
- daroMInterstitialModule.isInterstitialReady(requestId.toInt(), adUnitId, promise)
117
- }
118
-
119
- @ReactMethod
120
- override fun loadInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
121
- daroMInterstitialModule.loadInterstitial(requestId.toInt(), adUnitId)
122
- promise.resolve(null)
123
- }
124
-
125
- @ReactMethod
126
- override fun showInterstitial(requestId: Double, adUnitId: String, promise: Promise) {
127
- daroMInterstitialModule.showInterstitial(requestId.toInt(), adUnitId)
128
- promise.resolve(null)
129
- }
130
-
131
- @OptIn(ExperimentalStdlibApi::class)
132
- internal abstract class DaroMRewardedModule(context: ReactContext) :
133
- DaroMComponentModule(context) {
134
- abstract fun isRewardedAdReady(requestId: Int, adUnitId: String, promise: Promise)
135
- abstract fun loadRewardedAd(requestId: Int, adUnitId: String)
136
- abstract fun showRewardedAd(requestId: Int, adUnitId: String, customData: String?)
137
-
138
- override fun getComponents(): MutableMap<String, Any> {
139
- return RewardedEvent.entries.associate { it.value to it.value }.toMutableMap()
140
- }
141
- }
142
-
143
- private val daroMRewardedModule: DaroMRewardedModule =
144
- DaroMRewardedAdModuleImpl(
145
- context = reactContext,
146
- getCurrentActivity = { reactApplicationContext.currentActivity }
147
- )
148
-
149
- @ReactMethod
150
- override fun isRewardedAdReady(requestId: Double, adUnitId: String, promise: Promise) {
151
- daroMRewardedModule.isRewardedAdReady(requestId.toInt(), adUnitId, promise)
152
- }
153
-
154
- @ReactMethod
155
- override fun loadRewardedAd(requestId: Double, adUnitId: String, promise: Promise) {
156
- daroMRewardedModule.loadRewardedAd(requestId.toInt(), adUnitId)
157
- promise.resolve(null)
158
- }
159
-
160
- @ReactMethod
161
- override fun showRewardedAd(
162
- requestId: Double,
163
- adUnitId: String,
164
- customData: String?,
165
- promise: Promise,
166
- ) {
167
- daroMRewardedModule.showRewardedAd(requestId.toInt(), adUnitId, customData)
168
- promise.resolve(null)
169
- }
170
-
171
- @OptIn(ExperimentalStdlibApi::class)
172
- internal abstract class DaroMLightPopupModule(context: ReactContext) :
173
- DaroMComponentModule(context) {
174
- abstract fun isLightPopupReady(requestId: Int, adUnitId: String, promise: Promise)
175
- abstract fun loadLightPopup(requestId: Int, adUnitId: String)
176
- abstract fun showLightPopup(requestId: Int, adUnitId: String)
177
-
178
- abstract fun setLightPopupAdConfiguration(requestId: Int, adUnitId: String, parameterMap: ReadableMap)
179
-
180
- override fun getComponents(): MutableMap<String, Any> {
181
- return LightPopupEvent.entries.associate { it.value to it.value }.toMutableMap()
182
- }
183
- }
184
-
185
- private val daroMLightPopupModule: DaroMLightPopupModule = DaroMLightPopupModuleImpl(
186
- context = reactContext,
187
- getCurrentActivity = { reactApplicationContext.currentActivity }
188
- )
189
-
190
- @ReactMethod
191
- override fun isLightPopupReady(requestId: Double, adUnitId: String, promise: Promise) {
192
- daroMLightPopupModule.isLightPopupReady(requestId.toInt(), adUnitId, promise)
193
- }
194
-
195
- @ReactMethod
196
- override fun loadLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
197
- daroMLightPopupModule.loadLightPopup(requestId.toInt(), adUnitId)
198
- promise.resolve(null)
199
- }
200
-
201
- @ReactMethod
202
- override fun showLightPopup(requestId: Double, adUnitId: String, promise: Promise) {
203
- daroMLightPopupModule.showLightPopup(requestId.toInt(), adUnitId)
204
- promise.resolve(null)
205
- }
206
-
207
- @ReactMethod
208
- override fun setLightPopupAdConfiguration(
209
- requestId: Double,
210
- adUnitId: String,
211
- configuration: ReadableMap,
212
- promise: Promise,
213
- ) {
214
- daroMLightPopupModule.setLightPopupAdConfiguration(requestId.toInt(), adUnitId, configuration)
215
- promise.resolve(null)
216
- }
217
-
218
- @OptIn(ExperimentalStdlibApi::class)
219
- internal abstract class DaroMAppOpenModule(context: ReactContext) : DaroMComponentModule(context) {
220
- override fun getComponents(): MutableMap<String, Any> {
221
- return AppOpenEvent.entries.associate { it.value to it.value }.toMutableMap()
222
- }
223
- }
224
-
225
- private val daroMAppOpenModule: DaroMAppOpenModule = object : DaroMAppOpenModule(reactContext) {}
226
-
227
- @ReactMethod
228
- override fun isAppOpenAdReady(requestId: Double, adUnitId: String, promise: Promise) {
229
- promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
230
- }
231
-
232
- @ReactMethod
233
- override fun loadAppOpenAd(requestId: Double, adUnitId: String, promise: Promise) {
234
- promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
235
- }
236
-
237
- @ReactMethod
238
- override fun showAppOpenAd(
239
- requestId: Double,
240
- adUnitId: String,
241
- placement: String?,
242
- customData: String?,
243
- promise: Promise,
244
- ) {
245
- promise.reject(APP_OPEN_UNSUPPORTED_CODE, APP_OPEN_UNSUPPORTED_MESSAGE)
246
- }
247
-
248
- @OptIn(ExperimentalStdlibApi::class)
249
- internal abstract class DaroMBannerModule(context: ReactContext) : DaroMComponentModule(context) {
250
- override fun getComponents(): MutableMap<String, Any> {
251
- return InternalDaroMBannerSize.entries.associate { it.key to it.name }.toMutableMap()
252
- }
253
- }
254
-
255
- private val daroMBannerModule: DaroMBannerModule =
256
- DaroMBannerViewModuleImpl(context = reactContext)
257
- }