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.
- package/README.md +2 -5
- package/android/build.gradle +7 -13
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
- package/android/src/main/java/com/daro/reactnative/{DaroMAdNativeViewManager.kt → DaroRNAdNativeViewManager.kt} +34 -38
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +388 -0
- package/android/src/main/java/com/daro/reactnative/{DaroMPackage.kt → DaroRNPackage.kt} +7 -7
- package/android/src/main/java/com/daro/reactnative/DaroSdkBridge.kt +52 -0
- package/android/src/main/java/com/daro/reactnative/constants/{InternalDaroMBannerSize.kt → InternalDaroRNBannerSize.kt} +2 -2
- package/android/src/main/java/com/daro/reactnative/event/{DaroMEvent.kt → DaroRNEvent.kt} +8 -7
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMBannerViewModuleImpl.kt → DaroRNBannerViewModuleImpl.kt} +3 -3
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMInterstitialModuleImpl.kt → DaroRNInterstitialModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/impl/DaroRNLightPopupModuleImpl.kt +163 -0
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/impl/LightPopupRequest.kt +51 -0
- package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +12 -0
- package/android/src/main/java/com/daro/reactnative/util/DaroQaProbe.kt +147 -0
- package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +2 -2
- package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
- package/android/src/main/java/com/daro/reactnative/view/{DaroMAdNativeViewContainer.kt → DaroRNAdNativeViewContainer.kt} +23 -4
- package/android/src/newarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +1 -1
- package/android/src/oldarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +35 -3
- package/android/src/test/java/com/daro/reactnative/impl/LightPopupRequestTest.kt +62 -0
- package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +10 -11
- package/ios/DaroRNModule+Consent.swift +88 -0
- package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +9 -9
- package/ios/DaroRNModule+LightPopup.swift +211 -0
- package/ios/DaroRNModule+Qa.swift +159 -0
- package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +10 -10
- package/ios/{DaroMModule.mm → DaroRNModule.mm} +20 -4
- package/ios/{DaroMModule.swift → DaroRNModule.swift} +32 -6
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
- package/ios/Fabric/{DaroMFabricEventSink.mm → DaroRNFabricEventSink.mm} +4 -4
- package/ios/Fabric/{DaroMFabricPropApplier.mm → DaroRNFabricPropApplier.mm} +14 -14
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +320 -0
- package/ios/Paper/{DaroMAdBannerViewManager.m → DaroRNAdBannerViewManager.m} +1 -1
- package/ios/Paper/{DaroMAdBannerViewManager.swift → DaroRNAdBannerViewManager.swift} +5 -5
- package/ios/Paper/{DaroMNativeAdViewManager.m → DaroRNNativeAdViewManager.m} +2 -1
- package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMediationDebugger.swift +14 -0
- package/ios/Shared/{DaroMAdEventSink.swift → DaroRNAdEventSink.swift} +2 -1
- package/ios/Shared/{DaroMBannerAdView.swift → DaroRNBannerAdView.swift} +11 -11
- package/ios/Shared/{DaroMNativeAdLoadCoordinator.swift → DaroRNNativeAdLoadCoordinator.swift} +4 -4
- package/ios/Shared/{DaroMNativeAdView.swift → DaroRNNativeAdView.swift} +29 -21
- package/ios/Shared/{DaroMNativeAssetResolver.swift → DaroRNNativeAssetResolver.swift} +6 -6
- package/lib/commonjs/AdBannerView.js +3 -5
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +4 -4
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/{DaroMAdBannerViewNativeComponent.ts → DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/{src/DaroMNativeAdViewNativeComponent.ts → lib/commonjs/DaroRNNativeAdViewNativeComponent.ts} +8 -2
- package/lib/commonjs/LightPopupAd.js +15 -1
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js +1 -1
- package/lib/commonjs/NativeDaroModule.js.map +1 -1
- package/lib/commonjs/hooks/useLightPopupAd.js +6 -4
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -1
- package/lib/commonjs/index.js +121 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +10 -3
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/types/NativeAdViewProps.js +21 -0
- package/lib/commonjs/types/NativeAdViewProps.js.map +1 -1
- package/lib/module/AdBannerView.js +1 -3
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +4 -4
- package/lib/module/AppOpenAd.js.map +1 -1
- package/{src/DaroMAdBannerViewNativeComponent.ts → lib/module/DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/lib/{commonjs/DaroMNativeAdViewNativeComponent.ts → module/DaroRNNativeAdViewNativeComponent.ts} +8 -2
- package/lib/module/LightPopupAd.js +15 -1
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js +1 -1
- package/lib/module/NativeDaroModule.js.map +1 -1
- package/lib/module/hooks/useLightPopupAd.js +6 -4
- package/lib/module/hooks/useLightPopupAd.js.map +1 -1
- package/lib/module/index.js +101 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +8 -1
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/types/NativeAdViewProps.js +22 -1
- package/lib/module/types/NativeAdViewProps.js.map +1 -1
- package/lib/typescript/commonjs/plugin/src/index.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts +2 -6
- package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts +2 -2
- package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +6 -2
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts +3 -0
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +11 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +79 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +2 -0
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts +15 -0
- package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts +0 -1
- package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +9 -0
- package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/index.d.ts +2 -6
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +2 -6
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
- package/lib/typescript/module/plugin/src/withIos.d.ts +2 -6
- package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
- package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
- package/lib/typescript/module/src/AppOpenAd.d.ts +2 -2
- package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/module/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +6 -2
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/LightPopupAd.d.ts +3 -0
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +11 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +79 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +2 -0
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdInfo.d.ts +15 -0
- package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdProps.d.ts +0 -1
- package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +9 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +8 -5
- package/plugin/build/index.d.ts +2 -6
- package/plugin/build/index.js +21 -56
- package/plugin/build/withAndroid.d.ts +2 -6
- package/plugin/build/withAndroid.js +48 -90
- package/plugin/build/withIos.d.ts +2 -6
- package/plugin/build/withIos.js +37 -33
- package/react-native-daro.podspec +2 -3
- package/src/AdBannerView.tsx +1 -3
- package/src/AppOpenAd.ts +2 -8
- package/{lib/module/DaroMAdBannerViewNativeComponent.ts → src/DaroRNAdBannerViewNativeComponent.ts} +5 -2
- package/{lib/module/DaroMNativeAdViewNativeComponent.ts → src/DaroRNNativeAdViewNativeComponent.ts} +8 -2
- package/src/LightPopupAd.ts +18 -1
- package/src/NativeDaroModule.ts +18 -2
- package/src/hooks/useLightPopupAd.ts +6 -4
- package/src/index.tsx +136 -0
- package/src/nativeAd/NativeAdView.tsx +22 -1
- package/src/types/AdInfo.ts +17 -0
- package/src/types/AdProps.ts +0 -2
- package/src/types/NativeAdViewProps.ts +10 -0
- package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
- package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -155
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -257
- package/android/src/main/java/com/daro/reactnative/impl/DaroMLightPopupModuleImpl.kt +0 -150
- package/ios/DaroMModule+LightPopup.swift +0 -183
- package/ios/Fabric/DaroMAdBannerComponentView.mm +0 -207
- package/ios/Fabric/DaroMNativeAdComponentView.mm +0 -294
- package/ios/Paper/DaroMNativeAdViewManager.swift +0 -22
- package/ios/mediation/admob/DaroMediationDebugger.swift +0 -11
- package/lib/commonjs/types/DaroMMobileAds.js +0 -2
- package/lib/commonjs/types/DaroMMobileAds.js.map +0 -1
- package/lib/module/types/DaroMMobileAds.js +0 -2
- package/lib/module/types/DaroMMobileAds.js.map +0 -1
- package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts +0 -6
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +0 -1
- package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts +0 -6
- package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +0 -1
- package/src/types/DaroMMobileAds.ts +0 -5
- /package/ios/{mediation/admob → Shared}/DaroMediationTypes.swift +0 -0
|
@@ -1,72 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.withAndroidConfiguration = void 0;
|
|
37
4
|
const config_plugins_1 = require("expo/config-plugins");
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const KEY_FILE_NAME = 'android-daro-key.txt';
|
|
41
5
|
const JETIFIER_IGNORELIST_KEY = 'android.jetifier.ignorelist';
|
|
42
6
|
const JETIFIER_IGNORELIST_ENTRIES = ['react-android', 'hermes-android'];
|
|
43
|
-
|
|
7
|
+
// daro-sdk 의 Google 미디에이션 어댑터들(fyber·inmobi·ironsource 등)이 kotlin-stdlib
|
|
8
|
+
// 2.3.0 을 끌어온다 — 2.3 메타데이터는 Kotlin ≥2.2 컴파일러만 읽는다. Expo 기본
|
|
9
|
+
// 툴체인(2.1.x)은 컴파일이 깨지므로, 앱이 직접 지정하지 않았을 때만 올려준다.
|
|
10
|
+
// 2.2.20 인 이유: Expo 의 Kotlin→KSP 매핑이 지원하는 최신 2.2 계열이다.
|
|
11
|
+
const KOTLIN_VERSION_KEY = 'android.kotlinVersion';
|
|
12
|
+
const MIN_KOTLIN_VERSION = '2.2.20';
|
|
13
|
+
const DARO_GRADLE_PLUGIN_CLASSPATH = 'so.daro:daro-plugin:2.0.0';
|
|
14
|
+
// 통합 so.daro 플러그인이 release 빌드에 applovin-quality-service 를 스스로 적용한다 —
|
|
15
|
+
// 그 플러그인 id 가 해석되려면 classpath 와 AppLovin buildscript repo 가 앱에 있어야 한다.
|
|
44
16
|
const MAX_QUALITY_CLASSPATH = 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.5.2';
|
|
45
17
|
const APPLOVIN_MAVEN_REPO = 'https://artifacts.applovin.com/android';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea',
|
|
49
|
-
'https://maven.ogury.co',
|
|
50
|
-
'https://artifact.bytedance.com/repository/pangle',
|
|
51
|
-
'https://s3.amazonaws.com/smaato-sdk-releases/',
|
|
52
|
-
'https://cboost.jfrog.io/artifactory/chartboost-ads/',
|
|
53
|
-
APPLOVIN_MAVEN_REPO,
|
|
54
|
-
];
|
|
55
|
-
const DARO_APP_PLUGIN_IDS = {
|
|
56
|
-
admob: 'so.daro.a',
|
|
57
|
-
max: 'so.daro.m',
|
|
58
|
-
};
|
|
59
|
-
const DARO_SDK_DEPENDENCIES = {
|
|
60
|
-
admob: 'so.daro:daro-a:1.5.5',
|
|
61
|
-
max: 'so.daro:daro-m:1.3.8',
|
|
62
|
-
};
|
|
63
|
-
const DARO_SDK_DEPENDENCY_LINE_PATTERN = /^\s*(?:implementation|api|compileOnly|runtimeOnly)\s*(?:\(\s*)?['"]so\.daro:daro-[am]:[^'"]+['"]\s*\)?\s*(?:\/\/.*)?$/gm;
|
|
18
|
+
// 통합 daro-sdk 가 싣는 어댑터 전체의 repo 목록 — android/daro-android-qa
|
|
19
|
+
// settings.gradle.kts 의 검증된 목록을 미러링한다 (QA 앱이 같은 좌표를 해결한다).
|
|
64
20
|
const DARO_MAVEN_REPOS = [
|
|
65
21
|
'https://artifact.bytedance.com/repository/pangle',
|
|
66
|
-
'https://
|
|
22
|
+
'https://verve.jfrog.io/artifactory/verve-gradle-release',
|
|
67
23
|
'https://android-sdk.is.com',
|
|
68
24
|
'https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea',
|
|
25
|
+
'https://repo.premiumads.net/artifactory/mobile-ads-sdk/',
|
|
26
|
+
'https://repo.pubmatic.com/artifactory/public-repos',
|
|
27
|
+
'https://maven.ogury.co',
|
|
28
|
+
APPLOVIN_MAVEN_REPO,
|
|
69
29
|
];
|
|
30
|
+
const DARO_APP_PLUGIN_ID = 'so.daro';
|
|
31
|
+
const DARO_APP_PLUGIN_LINE = `apply plugin: "${DARO_APP_PLUGIN_ID}"`;
|
|
32
|
+
// **이 값은 android/build.gradle 의 daroSdkDependency 와 같아야 한다.** 라이브러리는
|
|
33
|
+
// compileOnly 로 물고 compileOnly 는 전이되지 않으므로, 소비자 런타임에 실제로 실리는
|
|
34
|
+
// 것은 여기서 꽂는 이 좌표 하나뿐이다. 갈리면 우리 Kotlin 이 새 시그니처로 컴파일되어
|
|
35
|
+
// 옛 아티팩트 위에서 돈다 (DARO-1591 — 복제 자체를 없애는 것은 그 이슈에 남아 있다).
|
|
36
|
+
const DARO_SDK_DEPENDENCY = 'so.daro:daro-sdk:2.0.1';
|
|
37
|
+
const DARO_SDK_DEPENDENCY_LINE_PATTERN = /^\s*(?:implementation|api|compileOnly|runtimeOnly)\s*(?:\(\s*)?['"]so\.daro:daro-(?:[am]|sdk):[^'"]+['"]\s*\)?\s*(?:\/\/.*)?$/gm;
|
|
70
38
|
function replaceOrThrow(contents, pattern, replacement, target) {
|
|
71
39
|
if (!pattern.test(contents)) {
|
|
72
40
|
throw new Error(`[daro-react-native] Cannot automatically update android/build.gradle. ` +
|
|
@@ -123,7 +91,7 @@ function findRepositoryInsertIndex(repositoriesBlock) {
|
|
|
123
91
|
preferredAnchor[0].length
|
|
124
92
|
: repositoriesBlock.insertIndex;
|
|
125
93
|
}
|
|
126
|
-
function
|
|
94
|
+
function addAppLovinBuildscriptRepository(contents) {
|
|
127
95
|
const repositoriesBlock = findRepositoriesBlock(contents, /buildscript\s*\{[\s\S]*?repositories\s*\{/, 'a buildscript repositories block');
|
|
128
96
|
if (repositoriesBlock.contents.includes(APPLOVIN_MAVEN_REPO)) {
|
|
129
97
|
return contents;
|
|
@@ -133,9 +101,6 @@ function addMaxBuildscriptRepository(contents) {
|
|
|
133
101
|
return `${contents.slice(0, insertIndex)}${repositoryLine}${contents.slice(insertIndex)}`;
|
|
134
102
|
}
|
|
135
103
|
const withAndroidConfiguration = (config, props) => {
|
|
136
|
-
const { mediation } = props;
|
|
137
|
-
const daroAppPluginId = DARO_APP_PLUGIN_IDS[mediation];
|
|
138
|
-
const daroSdkDependency = DARO_SDK_DEPENDENCIES[mediation];
|
|
139
104
|
// 1. project build.gradle: classpath + maven repos
|
|
140
105
|
config = (0, config_plugins_1.withProjectBuildGradle)(config, (gradleConfig) => {
|
|
141
106
|
if (gradleConfig.modResults.language !== 'groovy') {
|
|
@@ -146,39 +111,47 @@ const withAndroidConfiguration = (config, props) => {
|
|
|
146
111
|
if (!contents.includes(DARO_GRADLE_PLUGIN_CLASSPATH)) {
|
|
147
112
|
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${DARO_GRADLE_PLUGIN_CLASSPATH}")`, 'a buildscript dependencies block');
|
|
148
113
|
}
|
|
149
|
-
if (
|
|
114
|
+
if (!contents.includes(MAX_QUALITY_CLASSPATH)) {
|
|
150
115
|
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${MAX_QUALITY_CLASSPATH}")`, 'a buildscript dependencies block');
|
|
151
116
|
}
|
|
152
|
-
contents = addMavenRepositories(contents, /allprojects\s*\{[\s\S]*?repositories\s*\{/,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
117
|
+
contents = addMavenRepositories(contents, /allprojects\s*\{[\s\S]*?repositories\s*\{/, DARO_MAVEN_REPOS, 'an allprojects repositories block');
|
|
118
|
+
contents = addAppLovinBuildscriptRepository(contents);
|
|
119
|
+
// 버전 없는 KGP classpath 는 RN gradle plugin 제약(2.1.x)으로 해석된다 —
|
|
120
|
+
// android.kotlinVersion 속성만으로는 앱 모듈 컴파일러가 안 바뀌므로 여기서 버전을
|
|
121
|
+
// 명시해 conflict resolution 에서 이기게 한다 (위 MIN_KOTLIN_VERSION 주석 참조).
|
|
122
|
+
contents = contents.replace(/classpath\((['"])org\.jetbrains\.kotlin:kotlin-gradle-plugin\1\)/, `classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:${MIN_KOTLIN_VERSION}')`);
|
|
156
123
|
gradleConfig.modResults.contents = contents;
|
|
157
124
|
return gradleConfig;
|
|
158
125
|
});
|
|
159
|
-
// 2. app/build.gradle: add
|
|
126
|
+
// 2. app/build.gradle: add the unified Daro SDK dependency and plugin.
|
|
160
127
|
config = (0, config_plugins_1.withAppBuildGradle)(config, (gradleConfig) => {
|
|
161
128
|
if (gradleConfig.modResults.language !== 'groovy') {
|
|
162
129
|
config_plugins_1.WarningAggregator.addWarningAndroid('daro-react-native', 'Cannot automatically configure app/build.gradle if it is not groovy.');
|
|
163
130
|
return gradleConfig;
|
|
164
131
|
}
|
|
165
|
-
let contents = gradleConfig.modResults.contents.replace(/\n?apply plugin: ['"]so\.daro
|
|
132
|
+
let contents = gradleConfig.modResults.contents.replace(/\n?apply plugin: ['"]so\.daro(?:\.[am])?['"]\n?/g, '\n');
|
|
166
133
|
contents = contents.replace(DARO_SDK_DEPENDENCY_LINE_PATTERN, '');
|
|
167
|
-
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n implementation("${
|
|
168
|
-
|
|
169
|
-
contents = `${contents.trimEnd()}\napply plugin: "${daroAppPluginId}"\n`;
|
|
170
|
-
}
|
|
134
|
+
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n implementation("${DARO_SDK_DEPENDENCY}")`, 'an app dependencies block');
|
|
135
|
+
contents = `${contents.trimEnd()}\n${DARO_APP_PLUGIN_LINE}\n`;
|
|
171
136
|
gradleConfig.modResults.contents = contents;
|
|
172
137
|
return gradleConfig;
|
|
173
138
|
});
|
|
174
|
-
// 3. gradle.properties:
|
|
175
|
-
|
|
139
|
+
// 3. gradle.properties: daroIntegrationKey + Jetifier
|
|
140
|
+
// so.daro 플러그인이 빌드타임에 이 속성을 풀어 manifestPlaceholders 를 채운다.
|
|
141
|
+
return (0, config_plugins_1.withGradleProperties)(config, (propertiesConfig) => {
|
|
142
|
+
if (!props.daroIntegrationKey?.trim()) {
|
|
143
|
+
throw new Error('[daro-react-native] "android.daroIntegrationKey" is required. ' +
|
|
144
|
+
'Set it to the INTEGRATION KEY issued for your Android app.');
|
|
145
|
+
}
|
|
176
146
|
const entries = [
|
|
177
|
-
{ key: '
|
|
178
|
-
{ key: 'daroAppKey', value: props.daroAppKey },
|
|
147
|
+
{ key: 'daroIntegrationKey', value: props.daroIntegrationKey },
|
|
179
148
|
{ key: 'android.useAndroidX', value: 'true' },
|
|
180
149
|
{ key: 'android.enableJetifier', value: 'true' },
|
|
181
150
|
];
|
|
151
|
+
const hasKotlinVersion = propertiesConfig.modResults.some((item) => item.type === 'property' && item.key === KOTLIN_VERSION_KEY);
|
|
152
|
+
if (!hasKotlinVersion) {
|
|
153
|
+
entries.push({ key: KOTLIN_VERSION_KEY, value: MIN_KOTLIN_VERSION });
|
|
154
|
+
}
|
|
182
155
|
const existingIgnorelist = propertiesConfig.modResults
|
|
183
156
|
.filter((item) => item.type === 'property' && item.key === JETIFIER_IGNORELIST_KEY)
|
|
184
157
|
.flatMap((item) => item.value.split(','))
|
|
@@ -203,20 +176,5 @@ const withAndroidConfiguration = (config, props) => {
|
|
|
203
176
|
}
|
|
204
177
|
return propertiesConfig;
|
|
205
178
|
});
|
|
206
|
-
// 4. daroKeyFile을 android/app/ 루트에 복사
|
|
207
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
208
|
-
'android',
|
|
209
|
-
async (dangerousConfig) => {
|
|
210
|
-
const sourcePath = path.resolve(dangerousConfig.modRequest.projectRoot, props.daroKeyFile);
|
|
211
|
-
if (!fs.existsSync(sourcePath)) {
|
|
212
|
-
throw new Error(`[daro-react-native] Cannot find Android key file at "${sourcePath}". ` +
|
|
213
|
-
`Set "android.daroKeyFile" in plugin options to a valid path.`);
|
|
214
|
-
}
|
|
215
|
-
const destinationPath = path.resolve(dangerousConfig.modRequest.platformProjectRoot, 'app', KEY_FILE_NAME);
|
|
216
|
-
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
|
217
|
-
fs.copyFileSync(sourcePath, destinationPath);
|
|
218
|
-
return dangerousConfig;
|
|
219
|
-
},
|
|
220
|
-
]);
|
|
221
179
|
};
|
|
222
180
|
exports.withAndroidConfiguration = withAndroidConfiguration;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
-
import type { DaroIosProps
|
|
3
|
-
|
|
4
|
-
mediation: DaroMediation;
|
|
5
|
-
};
|
|
6
|
-
export declare const withIosConfiguration: ConfigPlugin<DaroResolvedIosProps>;
|
|
7
|
-
export {};
|
|
2
|
+
import type { DaroIosProps } from './index';
|
|
3
|
+
export declare const withIosConfiguration: ConfigPlugin<DaroIosProps>;
|
package/plugin/build/withIos.js
CHANGED
|
@@ -38,45 +38,49 @@ const config_plugins_1 = require("expo/config-plugins");
|
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
40
|
const skAdNetworkIds_1 = require("./skAdNetworkIds");
|
|
41
|
-
const KEY_FILE_NAME = 'ios-daro-key.txt';
|
|
42
41
|
const DEFAULT_ATT_USAGE_DESCRIPTION = 'This identifier will be used to deliver personalized ads to you.';
|
|
42
|
+
// pod install 때 통합 Daro pod 에 실려 오는 INTEGRATION KEY 훅. 소스 Info.plist 의
|
|
43
|
+
// DaroIntegrationKey 를 풀어 DaroAppKey·GADApplicationIdentifier·AppLovin 키를 심는다.
|
|
44
|
+
// post_install 블록은 Podfile 에 하나만 둘 수 있으므로 Expo 가 생성한 기존 블록 안에
|
|
45
|
+
// 끼워 넣는다 — 새로 선언하면 CocoaPods 가 죽는다.
|
|
46
|
+
const PODFILE_HOOK_MARKER = 'daro_integration_key';
|
|
47
|
+
const PODFILE_HOOK_LINES = ` daro_integration_key_hook = Dir.glob(File.expand_path('Pods/*/**/Scripts/daro_integration_key.rb', __dir__)).first
|
|
48
|
+
raise '[Daro] INTEGRATION KEY hook not found in pods — is the published pod carrying Scripts/?' unless daro_integration_key_hook
|
|
49
|
+
require daro_integration_key_hook
|
|
50
|
+
Daro::IntegrationKey.install!(installer)`;
|
|
43
51
|
const withIosConfiguration = (config, props) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
props.attUsageDescription ?? DEFAULT_ATT_USAGE_DESCRIPTION;
|
|
49
|
-
if (!props.admobAppId) {
|
|
50
|
-
throw new Error(`[daro-react-native] "ios.admobAppId" is required when mediation is "${mediation}". ` +
|
|
51
|
-
'Google Mobile Ads SDK requires GADApplicationIdentifier.');
|
|
52
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (plistConfig) => {
|
|
53
|
+
if (!props.daroIntegrationKey?.trim()) {
|
|
54
|
+
throw new Error('[daro-react-native] "ios.daroIntegrationKey" is required. ' +
|
|
55
|
+
'Set it to the INTEGRATION KEY issued for your iOS app.');
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
plistConfig.modResults.DaroIntegrationKey = props.daroIntegrationKey;
|
|
58
|
+
plistConfig.modResults.NSUserTrackingUsageDescription =
|
|
59
|
+
props.attUsageDescription ?? DEFAULT_ATT_USAGE_DESCRIPTION;
|
|
54
60
|
// SKAdNetworkItems: 사용자가 미리 추가한 항목과 머지 (중복 제거)
|
|
55
|
-
const existing =
|
|
56
|
-
[];
|
|
61
|
+
const existing = plistConfig.modResults.SKAdNetworkItems ?? [];
|
|
57
62
|
const existingIds = new Set(existing.map((item) => item.SKAdNetworkIdentifier));
|
|
58
63
|
const additions = skAdNetworkIds_1.DARO_SK_AD_NETWORK_IDS.filter((id) => !existingIds.has(id)).map((id) => ({ SKAdNetworkIdentifier: id }));
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
});
|
|
62
|
-
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
63
|
-
const projectRoot = config.modRequest.projectRoot;
|
|
64
|
-
const projectName = config.modRequest.projectName ??
|
|
65
|
-
config_plugins_1.IOSConfig.XcodeUtils.getProjectName(projectRoot);
|
|
66
|
-
const sourcePath = path.resolve(projectRoot, props.daroKeyFile);
|
|
67
|
-
if (!fs.existsSync(sourcePath)) {
|
|
68
|
-
throw new Error(`[daro-react-native] Cannot find iOS key file at "${sourcePath}". ` +
|
|
69
|
-
`Set "ios.daroKeyFile" in plugin options to a valid path.`);
|
|
70
|
-
}
|
|
71
|
-
const destinationPath = path.resolve(config_plugins_1.IOSConfig.Paths.getSourceRoot(projectRoot), KEY_FILE_NAME);
|
|
72
|
-
fs.copyFileSync(sourcePath, destinationPath);
|
|
73
|
-
config_plugins_1.IOSConfig.XcodeUtils.addResourceFileToGroup({
|
|
74
|
-
filepath: `${projectName}/${KEY_FILE_NAME}`,
|
|
75
|
-
groupName: projectName,
|
|
76
|
-
project: config.modResults,
|
|
77
|
-
isBuildFile: true,
|
|
78
|
-
});
|
|
79
|
-
return config;
|
|
64
|
+
plistConfig.modResults.SKAdNetworkItems = [...existing, ...additions];
|
|
65
|
+
return plistConfig;
|
|
80
66
|
});
|
|
67
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
68
|
+
'ios',
|
|
69
|
+
async (dangerousConfig) => {
|
|
70
|
+
const podfilePath = path.join(dangerousConfig.modRequest.platformProjectRoot, 'Podfile');
|
|
71
|
+
const contents = fs.readFileSync(podfilePath, 'utf8');
|
|
72
|
+
if (contents.includes(PODFILE_HOOK_MARKER)) {
|
|
73
|
+
return dangerousConfig;
|
|
74
|
+
}
|
|
75
|
+
const anchor = /post_install do \|installer\|\n/;
|
|
76
|
+
if (!anchor.test(contents)) {
|
|
77
|
+
throw new Error('[daro-react-native] Cannot find a "post_install do |installer|" ' +
|
|
78
|
+
'block in the generated Podfile to install the Daro INTEGRATION ' +
|
|
79
|
+
'KEY hook into.');
|
|
80
|
+
}
|
|
81
|
+
fs.writeFileSync(podfilePath, contents.replace(anchor, (match) => `${match}${PODFILE_HOOK_LINES}\n`));
|
|
82
|
+
return dangerousConfig;
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
81
85
|
};
|
|
82
86
|
exports.withIosConfiguration = withIosConfiguration;
|
|
@@ -17,12 +17,11 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
"ios/*.{h,m,mm,swift,cpp}",
|
|
18
18
|
"ios/Shared/**/*.{h,m,mm,swift,cpp}",
|
|
19
19
|
"ios/Paper/**/*.{h,m,mm,swift,cpp}",
|
|
20
|
-
"ios/Fabric/**/*.{h,m,mm,swift,cpp}"
|
|
21
|
-
"ios/mediation/admob/**/*.{h,m,mm,swift,cpp}"
|
|
20
|
+
"ios/Fabric/**/*.{h,m,mm,swift,cpp}"
|
|
22
21
|
]
|
|
23
22
|
s.private_header_files = "ios/**/*.h"
|
|
24
23
|
|
|
25
|
-
s.dependency "DaroAds", "
|
|
24
|
+
s.dependency "DaroAds", "2.0.1"
|
|
26
25
|
|
|
27
26
|
install_modules_dependencies(s)
|
|
28
27
|
end
|
package/src/AdBannerView.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { View, type ViewProps } from 'react-native';
|
|
11
11
|
import AdBannerViewNativeComponent, {
|
|
12
12
|
Commands,
|
|
13
|
-
} from './
|
|
13
|
+
} from './DaroRNAdBannerViewNativeComponent';
|
|
14
14
|
import NativeDaroModule from './NativeDaroModule';
|
|
15
15
|
import type {
|
|
16
16
|
AdBannerViewHandler,
|
|
@@ -47,7 +47,6 @@ export const AdBannerView = forwardRef<
|
|
|
47
47
|
{
|
|
48
48
|
adUnitId,
|
|
49
49
|
adFormat,
|
|
50
|
-
placement,
|
|
51
50
|
loadOnMount = true,
|
|
52
51
|
isVisible = true,
|
|
53
52
|
onAdLoaded,
|
|
@@ -127,7 +126,6 @@ export const AdBannerView = forwardRef<
|
|
|
127
126
|
adFormat={toNativeAdFormat(adFormat)}
|
|
128
127
|
ref={saveElement}
|
|
129
128
|
adUnitId={adUnitId}
|
|
130
|
-
placement={placement}
|
|
131
129
|
loadOnMount={loadOnMount}
|
|
132
130
|
isVisible={isVisible}
|
|
133
131
|
onAdLoadedEvent={onAdLoadedEvent}
|
package/src/AppOpenAd.ts
CHANGED
|
@@ -70,7 +70,7 @@ export class AppOpenAd {
|
|
|
70
70
|
NativeDaroModule.loadAppOpenAd(this.requestId, this.adUnitId);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
show(
|
|
73
|
+
show(customData?: string | null): void {
|
|
74
74
|
if (!IS_SUPPORTED_PLATFORM) {
|
|
75
75
|
warnUnsupportedPlatform();
|
|
76
76
|
return;
|
|
@@ -78,7 +78,6 @@ export class AppOpenAd {
|
|
|
78
78
|
NativeDaroModule.showAppOpenAd(
|
|
79
79
|
this.requestId,
|
|
80
80
|
this.adUnitId,
|
|
81
|
-
placement ?? undefined,
|
|
82
81
|
customData ?? undefined
|
|
83
82
|
);
|
|
84
83
|
}
|
|
@@ -155,11 +154,7 @@ export class AppOpenAd {
|
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
/** @deprecated `AppOpenAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
|
|
158
|
-
static showAd(
|
|
159
|
-
adUnitId: string,
|
|
160
|
-
placement?: string | null,
|
|
161
|
-
customData?: string | null
|
|
162
|
-
): void {
|
|
157
|
+
static showAd(adUnitId: string, customData?: string | null): void {
|
|
163
158
|
if (!IS_SUPPORTED_PLATFORM) {
|
|
164
159
|
warnUnsupportedPlatform();
|
|
165
160
|
return;
|
|
@@ -168,7 +163,6 @@ export class AppOpenAd {
|
|
|
168
163
|
NativeDaroModule.showAppOpenAd(
|
|
169
164
|
requestId,
|
|
170
165
|
adUnitId,
|
|
171
|
-
placement ?? undefined,
|
|
172
166
|
customData ?? undefined
|
|
173
167
|
);
|
|
174
168
|
}
|
package/{lib/module/DaroMAdBannerViewNativeComponent.ts → src/DaroRNAdBannerViewNativeComponent.ts}
RENAMED
|
@@ -10,9 +10,13 @@ import type {
|
|
|
10
10
|
WithDefault,
|
|
11
11
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
12
12
|
|
|
13
|
+
// 필드 구성은 src/types/AdInfo.ts 의 AdInfo 와 같은 것을 뜻한다. 이쪽은 codegen 이
|
|
14
|
+
// 읽는 선언이라 **여기 없으면 네이티브가 실어 보내도 Fabric 이 걸러낸다.**
|
|
13
15
|
type AdInfoPayload = {
|
|
14
16
|
adUnitId: string;
|
|
15
17
|
latencyMillis: Double;
|
|
18
|
+
mediationPlatform?: string;
|
|
19
|
+
adNetwork?: string;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
type AdLoadFailedInfoPayload = {
|
|
@@ -25,7 +29,6 @@ type AdLoadFailedInfoPayload = {
|
|
|
25
29
|
export interface NativeProps extends ViewProps {
|
|
26
30
|
adUnitId: string;
|
|
27
31
|
adFormat: string;
|
|
28
|
-
placement?: string | null;
|
|
29
32
|
loadOnMount?: WithDefault<boolean, true>;
|
|
30
33
|
isVisible?: WithDefault<boolean, true>;
|
|
31
34
|
onAdLoadedEvent?: DirectEventHandler<AdInfoPayload>;
|
|
@@ -44,4 +47,4 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
44
47
|
supportedCommands: ['loadAd'],
|
|
45
48
|
});
|
|
46
49
|
|
|
47
|
-
export default codegenNativeComponent<NativeProps>('
|
|
50
|
+
export default codegenNativeComponent<NativeProps>('DaroRNAdBannerView');
|
package/{lib/module/DaroMNativeAdViewNativeComponent.ts → src/DaroRNNativeAdViewNativeComponent.ts}
RENAMED
|
@@ -11,9 +11,13 @@ import type {
|
|
|
11
11
|
WithDefault,
|
|
12
12
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
13
13
|
|
|
14
|
+
// 필드 구성은 src/types/AdInfo.ts 의 AdInfo 와 같은 것을 뜻한다. 이쪽은 codegen 이
|
|
15
|
+
// 읽는 선언이라 **여기 없으면 네이티브가 실어 보내도 Fabric 이 걸러낸다.**
|
|
14
16
|
type AdInfoPayload = {
|
|
15
17
|
adUnitId: string;
|
|
16
18
|
latencyMillis: Double;
|
|
19
|
+
mediationPlatform?: string;
|
|
20
|
+
adNetwork?: string;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
type AdLoadFailedInfoPayload = {
|
|
@@ -27,7 +31,6 @@ type AdChoicesPosition = 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft';
|
|
|
27
31
|
|
|
28
32
|
export interface NativeProps extends ViewProps {
|
|
29
33
|
adUnitId: string;
|
|
30
|
-
placement?: string | null;
|
|
31
34
|
loadOnMount?: WithDefault<boolean, true>;
|
|
32
35
|
adChoicesPosition?: WithDefault<AdChoicesPosition, 'bottomRight'>;
|
|
33
36
|
|
|
@@ -43,6 +46,9 @@ export interface NativeProps extends ViewProps {
|
|
|
43
46
|
iconViewStyleProps?: UnsafeMixed;
|
|
44
47
|
mediaViewStyleProps?: UnsafeMixed;
|
|
45
48
|
|
|
49
|
+
onNativeAdAssetLoadedEvent?: DirectEventHandler<{
|
|
50
|
+
assetTypes: string[];
|
|
51
|
+
}>;
|
|
46
52
|
onAdLoadedEvent?: DirectEventHandler<AdInfoPayload>;
|
|
47
53
|
onAdLoadFailedEvent?: DirectEventHandler<AdLoadFailedInfoPayload>;
|
|
48
54
|
onAdClickedEvent?: DirectEventHandler<AdInfoPayload>;
|
|
@@ -59,4 +65,4 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
59
65
|
supportedCommands: ['loadAd'],
|
|
60
66
|
});
|
|
61
67
|
|
|
62
|
-
export default codegenNativeComponent<NativeProps>('
|
|
68
|
+
export default codegenNativeComponent<NativeProps>('DaroRNNativeAdView');
|
package/src/LightPopupAd.ts
CHANGED
|
@@ -90,6 +90,7 @@ export class LightPopupAd {
|
|
|
90
90
|
private static _legacyRequestIdSet = new Set<number>();
|
|
91
91
|
|
|
92
92
|
private readonly eventEmitter = new AdEventEmitter();
|
|
93
|
+
private destroyed = false;
|
|
93
94
|
|
|
94
95
|
private constructor(
|
|
95
96
|
private readonly requestId: number,
|
|
@@ -102,18 +103,25 @@ export class LightPopupAd {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
isAdReady(): Promise<boolean> {
|
|
105
|
-
|
|
106
|
+
if (this.destroyed) return Promise.resolve(false);
|
|
107
|
+
return NativeDaroModule.isLightPopupReady(
|
|
108
|
+
this.requestId,
|
|
109
|
+
this.adUnitId
|
|
110
|
+
).then((ready) => !this.destroyed && ready);
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
load(): void {
|
|
114
|
+
if (this.destroyed) return;
|
|
109
115
|
NativeDaroModule.loadLightPopup(this.requestId, this.adUnitId);
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
show(): void {
|
|
119
|
+
if (this.destroyed) return;
|
|
113
120
|
NativeDaroModule.showLightPopup(this.requestId, this.adUnitId);
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
setConfiguration(configuration: LightPopupAdConfiguration): void {
|
|
124
|
+
if (this.destroyed) return;
|
|
117
125
|
NativeDaroModule.setLightPopupAdConfiguration(
|
|
118
126
|
this.requestId,
|
|
119
127
|
this.adUnitId,
|
|
@@ -125,6 +133,7 @@ export class LightPopupAd {
|
|
|
125
133
|
type: T,
|
|
126
134
|
listener: (info: AdEventPayloadMap[T]) => void
|
|
127
135
|
): () => void {
|
|
136
|
+
if (this.destroyed) return () => {};
|
|
128
137
|
const nativeEvent = NATIVE_EVENT_BY_TYPE[type];
|
|
129
138
|
const requestId = this.requestId;
|
|
130
139
|
return this.eventEmitter.addEventListener(nativeEvent, (payload: any) => {
|
|
@@ -139,6 +148,14 @@ export class LightPopupAd {
|
|
|
139
148
|
this.eventEmitter.removeAllListeners();
|
|
140
149
|
}
|
|
141
150
|
|
|
151
|
+
/** Release this request and its popup. Create a new instance to load again. */
|
|
152
|
+
destroy(): void {
|
|
153
|
+
if (this.destroyed) return;
|
|
154
|
+
this.destroyed = true;
|
|
155
|
+
this.removeAllListeners();
|
|
156
|
+
NativeDaroModule.destroyLightPopup(this.requestId, this.adUnitId);
|
|
157
|
+
}
|
|
158
|
+
|
|
142
159
|
// ---- Deprecated static API (backward compatibility) ----
|
|
143
160
|
|
|
144
161
|
private static _getLegacyRequestId(adUnitId: string): number {
|
package/src/NativeDaroModule.ts
CHANGED
|
@@ -52,7 +52,23 @@ export interface Spec extends TurboModule {
|
|
|
52
52
|
isInitialized: () => Promise<boolean>;
|
|
53
53
|
initializeSdk: () => Promise<void>;
|
|
54
54
|
setUserId: (userId: string) => Promise<void>;
|
|
55
|
+
|
|
56
|
+
// 동의 상태는 **문자열**로 건넨다. Android 는 enum 이름, iOS 는 Int raw value 라
|
|
57
|
+
// 표현이 애초에 다르고, 어느 한쪽 표현을 브리지 계약으로 삼으면 다른 쪽이 그것을
|
|
58
|
+
// 되옮기다 조용히 틀린다 — Flutter 가 Android enum 이름(`nativeName`)을 그대로
|
|
59
|
+
// 넘겨 iOS 에서 깨진 전례가 있다(DARO-1471). 여기서는 플랫폼 중립 문자열만 오가고,
|
|
60
|
+
// 각 네이티브 어댑터가 자기 표현으로 옮긴다.
|
|
61
|
+
setGdpr: (status: string, consentString: string) => Promise<void>;
|
|
62
|
+
setCcpa: (status: string, consentString: string) => Promise<void>;
|
|
63
|
+
setCoppa: (status: string) => Promise<void>;
|
|
64
|
+
|
|
55
65
|
showMediationDebugger: () => Promise<void>;
|
|
66
|
+
showMediationDebuggerFor: (mediation: string) => Promise<void>;
|
|
67
|
+
getSdkVersion: () => Promise<string | null>;
|
|
68
|
+
getMediationStatuses: () => Promise<UnsafeObject[] | null>;
|
|
69
|
+
getMediationWeights: () => Promise<UnsafeObject | null>;
|
|
70
|
+
getAdapterInventory: () => Promise<UnsafeObject>;
|
|
71
|
+
getIntegrationKeyInfo: () => Promise<UnsafeObject>;
|
|
56
72
|
|
|
57
73
|
isInterstitialReady: (
|
|
58
74
|
requestId: Double,
|
|
@@ -74,12 +90,12 @@ export interface Spec extends TurboModule {
|
|
|
74
90
|
showAppOpenAd: (
|
|
75
91
|
requestId: Double,
|
|
76
92
|
adUnitId: string,
|
|
77
|
-
placement?: string | null,
|
|
78
93
|
customData?: string | null
|
|
79
94
|
) => Promise<void>;
|
|
80
95
|
|
|
81
96
|
isLightPopupReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
|
|
82
97
|
loadLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
98
|
+
destroyLightPopup: (requestId: Double, adUnitId: string) => void;
|
|
83
99
|
showLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
|
|
84
100
|
setLightPopupAdConfiguration: (
|
|
85
101
|
requestId: Double,
|
|
@@ -88,4 +104,4 @@ export interface Spec extends TurboModule {
|
|
|
88
104
|
) => Promise<void>;
|
|
89
105
|
}
|
|
90
106
|
|
|
91
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('
|
|
107
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('DaroRNModule');
|
|
@@ -47,7 +47,7 @@ export function useLightPopupAd(
|
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
adRef.current?.
|
|
50
|
+
adRef.current?.destroy();
|
|
51
51
|
|
|
52
52
|
const ad = LightPopupAd.createForAdRequest(adUnitId);
|
|
53
53
|
adRef.current = ad;
|
|
@@ -105,20 +105,22 @@ export function useLightPopupAd(
|
|
|
105
105
|
}, []);
|
|
106
106
|
|
|
107
107
|
const isAdReady = useCallback(async () => {
|
|
108
|
-
const
|
|
108
|
+
const ad = adRef.current;
|
|
109
|
+
const isLoaded = (await ad?.isAdReady()) ?? false;
|
|
110
|
+
if (adRef.current !== ad) return false;
|
|
109
111
|
setState((prevState) => ({ ...prevState, isLoaded }));
|
|
110
112
|
return isLoaded;
|
|
111
113
|
}, []);
|
|
112
114
|
|
|
113
115
|
useEffect(() => {
|
|
114
|
-
adRef.current?.
|
|
116
|
+
adRef.current?.destroy();
|
|
115
117
|
adRef.current = null;
|
|
116
118
|
setState({ isLoaded: false, isLoading: false });
|
|
117
119
|
}, [adUnitId]);
|
|
118
120
|
|
|
119
121
|
useEffect(() => {
|
|
120
122
|
return () => {
|
|
121
|
-
adRef.current?.
|
|
123
|
+
adRef.current?.destroy();
|
|
122
124
|
adRef.current = null;
|
|
123
125
|
};
|
|
124
126
|
}, []);
|