react-native-daro 2.0.6 → 2.0.8
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/README.md +2 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +3 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNAdNativeViewManager.kt +3 -3
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +34 -34
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNInterstitialModuleImpl.kt +13 -13
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNLightPopupModuleImpl.kt +12 -12
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNRewardedAdModuleImpl.kt +14 -14
- package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +16 -16
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdBannerViewContainer.kt +8 -8
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdNativeViewContainer.kt +8 -8
- package/android/src/oldarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +14 -14
- package/ios/DaroRNModule+AppOpen.swift +9 -9
- package/ios/DaroRNModule+Interstitial.swift +9 -9
- package/ios/DaroRNModule+LightPopup.swift +13 -13
- package/ios/DaroRNModule+Rewarded.swift +14 -14
- package/ios/DaroRNModule.mm +14 -14
- package/ios/DaroRNModule.swift +1 -1
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +7 -7
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +7 -7
- package/ios/Paper/DaroRNAdBannerViewManager.m +1 -1
- package/ios/Paper/DaroRNNativeAdViewManager.m +1 -1
- package/ios/Shared/DaroRNBannerAdView.swift +8 -8
- package/ios/Shared/DaroRNNativeAdView.swift +14 -14
- package/lib/commonjs/AdBannerView.js +2 -2
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +22 -22
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/lib/commonjs/DaroRNNativeAdViewNativeComponent.ts +3 -3
- package/lib/commonjs/InterstitialAd.js +24 -24
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +27 -27
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/RewardedAd.js +22 -22
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/hooks/useInterstitialAd.js +6 -6
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -1
- package/lib/commonjs/hooks/useLightPopupAd.js +5 -5
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -1
- package/lib/commonjs/hooks/useRewardedAd.js +6 -6
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +2 -2
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/AdBannerView.js +2 -2
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +22 -22
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/lib/module/DaroRNNativeAdViewNativeComponent.ts +3 -3
- package/lib/module/InterstitialAd.js +24 -24
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +27 -27
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/RewardedAd.js +22 -22
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/hooks/useInterstitialAd.js +6 -6
- package/lib/module/hooks/useInterstitialAd.js.map +1 -1
- package/lib/module/hooks/useLightPopupAd.js +5 -5
- package/lib/module/hooks/useLightPopupAd.js.map +1 -1
- package/lib/module/hooks/useRewardedAd.js +6 -6
- package/lib/module/hooks/useRewardedAd.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +2 -2
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts +3 -3
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts +3 -3
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +9 -9
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +14 -14
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RewardedAd.d.ts +8 -8
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts +2 -2
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +8 -8
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts +3 -3
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts +3 -3
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts +8 -8
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts +9 -9
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +14 -14
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/module/src/RewardedAd.d.ts +8 -8
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts +2 -2
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withAndroid.js +2 -2
- package/react-native-daro.podspec +1 -1
- package/src/AdBannerView.tsx +2 -2
- package/src/AppOpenAd.ts +21 -21
- package/src/DaroRNAdBannerViewNativeComponent.ts +3 -3
- package/src/DaroRNNativeAdViewNativeComponent.ts +3 -3
- package/src/InterstitialAd.ts +23 -23
- package/src/LightPopupAd.ts +26 -26
- package/src/NativeDaroModule.ts +14 -14
- package/src/RewardedAd.ts +21 -21
- package/src/hooks/useInterstitialAd.ts +6 -6
- package/src/hooks/useLightPopupAd.ts +5 -5
- package/src/hooks/useRewardedAd.ts +6 -6
- package/src/nativeAd/NativeAdView.tsx +2 -2
- package/src/types/AdInfo.ts +2 -2
- package/src/types/AdProps.ts +1 -1
package/src/LightPopupAd.ts
CHANGED
|
@@ -94,37 +94,37 @@ export class LightPopupAd {
|
|
|
94
94
|
|
|
95
95
|
private constructor(
|
|
96
96
|
private readonly requestId: number,
|
|
97
|
-
private readonly
|
|
97
|
+
private readonly adUnitKey: string
|
|
98
98
|
) {}
|
|
99
99
|
|
|
100
|
-
static createForAdRequest(
|
|
100
|
+
static createForAdRequest(adUnitKey: string): LightPopupAd {
|
|
101
101
|
const requestId = LightPopupAd._nextRequestId++;
|
|
102
|
-
return new LightPopupAd(requestId,
|
|
102
|
+
return new LightPopupAd(requestId, adUnitKey);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
isAdReady(): Promise<boolean> {
|
|
106
106
|
if (this.destroyed) return Promise.resolve(false);
|
|
107
107
|
return NativeDaroModule.isLightPopupReady(
|
|
108
108
|
this.requestId,
|
|
109
|
-
this.
|
|
109
|
+
this.adUnitKey
|
|
110
110
|
).then((ready) => !this.destroyed && ready);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
load(): void {
|
|
114
114
|
if (this.destroyed) return;
|
|
115
|
-
NativeDaroModule.loadLightPopup(this.requestId, this.
|
|
115
|
+
NativeDaroModule.loadLightPopup(this.requestId, this.adUnitKey);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
show(): void {
|
|
119
119
|
if (this.destroyed) return;
|
|
120
|
-
NativeDaroModule.showLightPopup(this.requestId, this.
|
|
120
|
+
NativeDaroModule.showLightPopup(this.requestId, this.adUnitKey);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
setConfiguration(configuration: LightPopupAdConfiguration): void {
|
|
124
124
|
if (this.destroyed) return;
|
|
125
125
|
NativeDaroModule.setLightPopupAdConfiguration(
|
|
126
126
|
this.requestId,
|
|
127
|
-
this.
|
|
127
|
+
this.adUnitKey,
|
|
128
128
|
normalizeConfiguration(configuration)
|
|
129
129
|
);
|
|
130
130
|
}
|
|
@@ -153,16 +153,16 @@ export class LightPopupAd {
|
|
|
153
153
|
if (this.destroyed) return;
|
|
154
154
|
this.destroyed = true;
|
|
155
155
|
this.removeAllListeners();
|
|
156
|
-
NativeDaroModule.destroyLightPopup(this.requestId, this.
|
|
156
|
+
NativeDaroModule.destroyLightPopup(this.requestId, this.adUnitKey);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// ---- Deprecated static API (backward compatibility) ----
|
|
160
160
|
|
|
161
|
-
private static _getLegacyRequestId(
|
|
162
|
-
let requestId = LightPopupAd._legacyRequestIds.get(
|
|
161
|
+
private static _getLegacyRequestId(adUnitKey: string): number {
|
|
162
|
+
let requestId = LightPopupAd._legacyRequestIds.get(adUnitKey);
|
|
163
163
|
if (requestId === undefined) {
|
|
164
164
|
requestId = LightPopupAd._nextRequestId++;
|
|
165
|
-
LightPopupAd._legacyRequestIds.set(
|
|
165
|
+
LightPopupAd._legacyRequestIds.set(adUnitKey, requestId);
|
|
166
166
|
LightPopupAd._legacyRequestIdSet.add(requestId);
|
|
167
167
|
}
|
|
168
168
|
return requestId;
|
|
@@ -180,33 +180,33 @@ export class LightPopupAd {
|
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
/** @deprecated `LightPopupAd.createForAdRequest(
|
|
184
|
-
static isAdReady(
|
|
185
|
-
const requestId = LightPopupAd._getLegacyRequestId(
|
|
186
|
-
return NativeDaroModule.isLightPopupReady(requestId,
|
|
183
|
+
/** @deprecated `LightPopupAd.createForAdRequest(adUnitKey)` 인스턴스의 `isAdReady()`를 사용하세요. */
|
|
184
|
+
static isAdReady(adUnitKey: string): Promise<boolean> {
|
|
185
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitKey);
|
|
186
|
+
return NativeDaroModule.isLightPopupReady(requestId, adUnitKey);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
/** @deprecated `LightPopupAd.createForAdRequest(
|
|
190
|
-
static loadAd(
|
|
191
|
-
const requestId = LightPopupAd._getLegacyRequestId(
|
|
192
|
-
NativeDaroModule.loadLightPopup(requestId,
|
|
189
|
+
/** @deprecated `LightPopupAd.createForAdRequest(adUnitKey)` 인스턴스의 `load()`를 사용하세요. */
|
|
190
|
+
static loadAd(adUnitKey: string): void {
|
|
191
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitKey);
|
|
192
|
+
NativeDaroModule.loadLightPopup(requestId, adUnitKey);
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
/** @deprecated `LightPopupAd.createForAdRequest(
|
|
196
|
-
static showAd(
|
|
197
|
-
const requestId = LightPopupAd._getLegacyRequestId(
|
|
198
|
-
NativeDaroModule.showLightPopup(requestId,
|
|
195
|
+
/** @deprecated `LightPopupAd.createForAdRequest(adUnitKey)` 인스턴스의 `show()`를 사용하세요. */
|
|
196
|
+
static showAd(adUnitKey: string): void {
|
|
197
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitKey);
|
|
198
|
+
NativeDaroModule.showLightPopup(requestId, adUnitKey);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/** @deprecated 인스턴스의 `setConfiguration()`을 사용하세요. */
|
|
202
202
|
static setLightPopupAdConfiguration(
|
|
203
|
-
|
|
203
|
+
adUnitKey: string,
|
|
204
204
|
configuration: LightPopupAdConfiguration
|
|
205
205
|
): void {
|
|
206
|
-
const requestId = LightPopupAd._getLegacyRequestId(
|
|
206
|
+
const requestId = LightPopupAd._getLegacyRequestId(adUnitKey);
|
|
207
207
|
NativeDaroModule.setLightPopupAdConfiguration(
|
|
208
208
|
requestId,
|
|
209
|
-
|
|
209
|
+
adUnitKey,
|
|
210
210
|
normalizeConfiguration(configuration)
|
|
211
211
|
);
|
|
212
212
|
}
|
package/src/NativeDaroModule.ts
CHANGED
|
@@ -73,34 +73,34 @@ export interface Spec extends TurboModule {
|
|
|
73
73
|
|
|
74
74
|
isInterstitialReady: (
|
|
75
75
|
requestId: Double,
|
|
76
|
-
|
|
76
|
+
adUnitKey: string
|
|
77
77
|
) => Promise<boolean>;
|
|
78
|
-
loadInterstitial: (requestId: Double,
|
|
79
|
-
showInterstitial: (requestId: Double,
|
|
78
|
+
loadInterstitial: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
79
|
+
showInterstitial: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
80
80
|
|
|
81
|
-
isRewardedAdReady: (requestId: Double,
|
|
82
|
-
loadRewardedAd: (requestId: Double,
|
|
81
|
+
isRewardedAdReady: (requestId: Double, adUnitKey: string) => Promise<boolean>;
|
|
82
|
+
loadRewardedAd: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
83
83
|
showRewardedAd: (
|
|
84
84
|
requestId: Double,
|
|
85
|
-
|
|
85
|
+
adUnitKey: string,
|
|
86
86
|
customData?: string | null
|
|
87
87
|
) => Promise<void>;
|
|
88
88
|
|
|
89
|
-
isAppOpenAdReady: (requestId: Double,
|
|
90
|
-
loadAppOpenAd: (requestId: Double,
|
|
89
|
+
isAppOpenAdReady: (requestId: Double, adUnitKey: string) => Promise<boolean>;
|
|
90
|
+
loadAppOpenAd: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
91
91
|
showAppOpenAd: (
|
|
92
92
|
requestId: Double,
|
|
93
|
-
|
|
93
|
+
adUnitKey: string,
|
|
94
94
|
customData?: string | null
|
|
95
95
|
) => Promise<void>;
|
|
96
96
|
|
|
97
|
-
isLightPopupReady: (requestId: Double,
|
|
98
|
-
loadLightPopup: (requestId: Double,
|
|
99
|
-
destroyLightPopup: (requestId: Double,
|
|
100
|
-
showLightPopup: (requestId: Double,
|
|
97
|
+
isLightPopupReady: (requestId: Double, adUnitKey: string) => Promise<boolean>;
|
|
98
|
+
loadLightPopup: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
99
|
+
destroyLightPopup: (requestId: Double, adUnitKey: string) => void;
|
|
100
|
+
showLightPopup: (requestId: Double, adUnitKey: string) => Promise<void>;
|
|
101
101
|
setLightPopupAdConfiguration: (
|
|
102
102
|
requestId: Double,
|
|
103
|
-
|
|
103
|
+
adUnitKey: string,
|
|
104
104
|
configuration: UnsafeObject
|
|
105
105
|
) => Promise<void>;
|
|
106
106
|
}
|
package/src/RewardedAd.ts
CHANGED
|
@@ -48,26 +48,26 @@ export class RewardedAd {
|
|
|
48
48
|
|
|
49
49
|
private constructor(
|
|
50
50
|
private readonly requestId: number,
|
|
51
|
-
private readonly
|
|
51
|
+
private readonly adUnitKey: string
|
|
52
52
|
) {}
|
|
53
53
|
|
|
54
|
-
static createForAdRequest(
|
|
54
|
+
static createForAdRequest(adUnitKey: string): RewardedAd {
|
|
55
55
|
const requestId = RewardedAd._nextRequestId++;
|
|
56
|
-
return new RewardedAd(requestId,
|
|
56
|
+
return new RewardedAd(requestId, adUnitKey);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
isAdReady(): Promise<boolean> {
|
|
60
|
-
return NativeDaroModule.isRewardedAdReady(this.requestId, this.
|
|
60
|
+
return NativeDaroModule.isRewardedAdReady(this.requestId, this.adUnitKey);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
load(): void {
|
|
64
|
-
NativeDaroModule.loadRewardedAd(this.requestId, this.
|
|
64
|
+
NativeDaroModule.loadRewardedAd(this.requestId, this.adUnitKey);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
show(customData?: string | null): void {
|
|
68
68
|
NativeDaroModule.showRewardedAd(
|
|
69
69
|
this.requestId,
|
|
70
|
-
this.
|
|
70
|
+
this.adUnitKey,
|
|
71
71
|
customData ?? null
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -92,11 +92,11 @@ export class RewardedAd {
|
|
|
92
92
|
|
|
93
93
|
// ---- Deprecated static API (backward compatibility) ----
|
|
94
94
|
|
|
95
|
-
private static _getLegacyRequestId(
|
|
96
|
-
let requestId = RewardedAd._legacyRequestIds.get(
|
|
95
|
+
private static _getLegacyRequestId(adUnitKey: string): number {
|
|
96
|
+
let requestId = RewardedAd._legacyRequestIds.get(adUnitKey);
|
|
97
97
|
if (requestId === undefined) {
|
|
98
98
|
requestId = RewardedAd._nextRequestId++;
|
|
99
|
-
RewardedAd._legacyRequestIds.set(
|
|
99
|
+
RewardedAd._legacyRequestIds.set(adUnitKey, requestId);
|
|
100
100
|
RewardedAd._legacyRequestIdSet.add(requestId);
|
|
101
101
|
}
|
|
102
102
|
return requestId;
|
|
@@ -114,22 +114,22 @@ export class RewardedAd {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/** @deprecated `RewardedAd.createForAdRequest(
|
|
118
|
-
static isAdReady(
|
|
119
|
-
const requestId = RewardedAd._getLegacyRequestId(
|
|
120
|
-
return NativeDaroModule.isRewardedAdReady(requestId,
|
|
117
|
+
/** @deprecated `RewardedAd.createForAdRequest(adUnitKey)` 인스턴스의 `isAdReady()`를 사용하세요. */
|
|
118
|
+
static isAdReady(adUnitKey: string): Promise<boolean> {
|
|
119
|
+
const requestId = RewardedAd._getLegacyRequestId(adUnitKey);
|
|
120
|
+
return NativeDaroModule.isRewardedAdReady(requestId, adUnitKey);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
/** @deprecated `RewardedAd.createForAdRequest(
|
|
124
|
-
static loadAd(
|
|
125
|
-
const requestId = RewardedAd._getLegacyRequestId(
|
|
126
|
-
NativeDaroModule.loadRewardedAd(requestId,
|
|
123
|
+
/** @deprecated `RewardedAd.createForAdRequest(adUnitKey)` 인스턴스의 `load()`를 사용하세요. */
|
|
124
|
+
static loadAd(adUnitKey: string): void {
|
|
125
|
+
const requestId = RewardedAd._getLegacyRequestId(adUnitKey);
|
|
126
|
+
NativeDaroModule.loadRewardedAd(requestId, adUnitKey);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
/** @deprecated `RewardedAd.createForAdRequest(
|
|
130
|
-
static showAd(
|
|
131
|
-
const requestId = RewardedAd._getLegacyRequestId(
|
|
132
|
-
NativeDaroModule.showRewardedAd(requestId,
|
|
129
|
+
/** @deprecated `RewardedAd.createForAdRequest(adUnitKey)` 인스턴스의 `show()`를 사용하세요. */
|
|
130
|
+
static showAd(adUnitKey: string, customData?: string | null): void {
|
|
131
|
+
const requestId = RewardedAd._getLegacyRequestId(adUnitKey);
|
|
132
|
+
NativeDaroModule.showRewardedAd(requestId, adUnitKey, customData ?? null);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
|
|
@@ -26,7 +26,7 @@ export type UseInterstitialAdResult = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export function useInterstitialAd(
|
|
29
|
-
|
|
29
|
+
adUnitKey: string | null,
|
|
30
30
|
options: UseInterstitialAdOptions = {}
|
|
31
31
|
): UseInterstitialAdResult {
|
|
32
32
|
const adRef = useRef<InterstitialAd | null>(null);
|
|
@@ -38,7 +38,7 @@ export function useInterstitialAd(
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const load = useCallback(() => {
|
|
41
|
-
if (!
|
|
41
|
+
if (!adUnitKey) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -49,7 +49,7 @@ export function useInterstitialAd(
|
|
|
49
49
|
|
|
50
50
|
setState({ isLoaded: false, isLoading: true });
|
|
51
51
|
ad.load();
|
|
52
|
-
}, [
|
|
52
|
+
}, [adUnitKey]);
|
|
53
53
|
|
|
54
54
|
const show = useCallback(() => {
|
|
55
55
|
adRef.current?.show();
|
|
@@ -66,11 +66,11 @@ export function useInterstitialAd(
|
|
|
66
66
|
adRef.current = null;
|
|
67
67
|
setState({ isLoaded: false, isLoading: false });
|
|
68
68
|
|
|
69
|
-
if (!
|
|
69
|
+
if (!adUnitKey) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const ad = InterstitialAd.createForAdRequest(
|
|
73
|
+
const ad = InterstitialAd.createForAdRequest(adUnitKey);
|
|
74
74
|
adRef.current = ad;
|
|
75
75
|
|
|
76
76
|
ad.addAdEventListener(AdEventType.LOADED, (info) => {
|
|
@@ -106,7 +106,7 @@ export function useInterstitialAd(
|
|
|
106
106
|
adRef.current = null;
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
}, [
|
|
109
|
+
}, [adUnitKey]);
|
|
110
110
|
|
|
111
111
|
return {
|
|
112
112
|
...state,
|
|
@@ -31,7 +31,7 @@ export type UseLightPopupAdResult = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export function useLightPopupAd(
|
|
34
|
-
|
|
34
|
+
adUnitKey: string | null,
|
|
35
35
|
options: UseLightPopupAdOptions = {}
|
|
36
36
|
): UseLightPopupAdResult {
|
|
37
37
|
const adRef = useRef<LightPopupAd | null>(null);
|
|
@@ -43,13 +43,13 @@ export function useLightPopupAd(
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
const createAd = useCallback(() => {
|
|
46
|
-
if (!
|
|
46
|
+
if (!adUnitKey) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
adRef.current?.destroy();
|
|
51
51
|
|
|
52
|
-
const ad = LightPopupAd.createForAdRequest(
|
|
52
|
+
const ad = LightPopupAd.createForAdRequest(adUnitKey);
|
|
53
53
|
adRef.current = ad;
|
|
54
54
|
|
|
55
55
|
ad.addAdEventListener(AdEventType.LOADED, (info) => {
|
|
@@ -80,7 +80,7 @@ export function useLightPopupAd(
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
return ad;
|
|
83
|
-
}, [
|
|
83
|
+
}, [adUnitKey]);
|
|
84
84
|
|
|
85
85
|
const load = useCallback(
|
|
86
86
|
(loadOptions?: UseLightPopupAdLoadOptions) => {
|
|
@@ -116,7 +116,7 @@ export function useLightPopupAd(
|
|
|
116
116
|
adRef.current?.destroy();
|
|
117
117
|
adRef.current = null;
|
|
118
118
|
setState({ isLoaded: false, isLoading: false });
|
|
119
|
-
}, [
|
|
119
|
+
}, [adUnitKey]);
|
|
120
120
|
|
|
121
121
|
useEffect(() => {
|
|
122
122
|
return () => {
|
|
@@ -28,7 +28,7 @@ export type UseRewardedAdResult = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export function useRewardedAd(
|
|
31
|
-
|
|
31
|
+
adUnitKey: string | null,
|
|
32
32
|
options: UseRewardedAdOptions = {}
|
|
33
33
|
): UseRewardedAdResult {
|
|
34
34
|
const adRef = useRef<RewardedAd | null>(null);
|
|
@@ -40,7 +40,7 @@ export function useRewardedAd(
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
const load = useCallback(() => {
|
|
43
|
-
if (!
|
|
43
|
+
if (!adUnitKey) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ export function useRewardedAd(
|
|
|
51
51
|
|
|
52
52
|
setState({ isLoaded: false, isLoading: true });
|
|
53
53
|
ad.load();
|
|
54
|
-
}, [
|
|
54
|
+
}, [adUnitKey]);
|
|
55
55
|
|
|
56
56
|
const show = useCallback((customData?: string | null) => {
|
|
57
57
|
adRef.current?.show(customData);
|
|
@@ -68,11 +68,11 @@ export function useRewardedAd(
|
|
|
68
68
|
adRef.current = null;
|
|
69
69
|
setState({ isLoaded: false, isLoading: false });
|
|
70
70
|
|
|
71
|
-
if (!
|
|
71
|
+
if (!adUnitKey) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const ad = RewardedAd.createForAdRequest(
|
|
75
|
+
const ad = RewardedAd.createForAdRequest(adUnitKey);
|
|
76
76
|
adRef.current = ad;
|
|
77
77
|
|
|
78
78
|
ad.addAdEventListener(AdEventType.LOADED, (info) => {
|
|
@@ -111,7 +111,7 @@ export function useRewardedAd(
|
|
|
111
111
|
adRef.current = null;
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
}, [
|
|
114
|
+
}, [adUnitKey]);
|
|
115
115
|
|
|
116
116
|
return {
|
|
117
117
|
...state,
|
|
@@ -68,7 +68,7 @@ const NativeAdViewImpl = forwardRef<
|
|
|
68
68
|
NativeAdViewProps & ViewProps
|
|
69
69
|
>(function NativeAdViewImpl(
|
|
70
70
|
{
|
|
71
|
-
|
|
71
|
+
adUnitKey,
|
|
72
72
|
onAdLoaded,
|
|
73
73
|
onNativeAdAssetLoaded,
|
|
74
74
|
onAdLoadFailed,
|
|
@@ -145,7 +145,7 @@ const NativeAdViewImpl = forwardRef<
|
|
|
145
145
|
<NativeAdViewNativeComponent
|
|
146
146
|
ref={saveElement}
|
|
147
147
|
{...otherProps}
|
|
148
|
-
|
|
148
|
+
adUnitKey={adUnitKey}
|
|
149
149
|
loadOnMount={loadOnMount}
|
|
150
150
|
adChoicesPosition={adChoicesPosition}
|
|
151
151
|
titleView={nativeAdAssetRegistrations.titleView?.nativeTag ?? 0}
|
package/src/types/AdInfo.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ErrorCode } from '../ErrorCode';
|
|
|
3
3
|
// Represents an ad
|
|
4
4
|
export type AdInfo = {
|
|
5
5
|
// The ad unit ID for which this ad was loaded.
|
|
6
|
-
|
|
6
|
+
adUnitKey: string;
|
|
7
7
|
// The total latency in milliseconds for this waterfall to finish processing.
|
|
8
8
|
latencyMillis: number;
|
|
9
9
|
|
|
@@ -28,7 +28,7 @@ export type AdInfo = {
|
|
|
28
28
|
// Encapsulates various data for MAX load errors.
|
|
29
29
|
export type AdLoadFailedInfo = {
|
|
30
30
|
// The ad unit ID for which this ad was loaded.
|
|
31
|
-
|
|
31
|
+
adUnitKey: string;
|
|
32
32
|
|
|
33
33
|
// The error code for the error.
|
|
34
34
|
code: ErrorCode;
|