react-native-daro 1.0.15 → 2.0.0-rc.1
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 +17 -14
- package/android/src/main/java/com/daro/reactnative/DaroMediaViewManager.kt +25 -0
- package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
- package/android/src/main/java/com/daro/reactnative/DaroRNAdNativeViewManager.kt +163 -0
- package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +376 -0
- package/android/src/main/java/com/daro/reactnative/DaroRNPackage.kt +45 -0
- 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} +22 -11
- 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/{DaroMLightPopupModuleImpl.kt → DaroRNLightPopupModuleImpl.kt} +4 -4
- package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
- 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 +20 -7
- package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +123 -0
- package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
- package/android/src/main/java/com/daro/reactnative/view/DaroRNAdNativeViewContainer.kt +623 -0
- package/android/src/newarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +6 -0
- package/android/src/oldarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +119 -0
- package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +22 -20
- package/ios/DaroRNModule+Consent.swift +88 -0
- package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +21 -18
- package/ios/{DaroMModule+LightPopup.swift → DaroRNModule+LightPopup.swift} +18 -15
- package/ios/DaroRNModule+Qa.swift +158 -0
- package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +22 -19
- package/ios/DaroRNModule.mm +88 -0
- package/ios/{DaroMModule.swift → DaroRNModule.swift} +24 -10
- package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
- package/ios/Fabric/DaroRNFabricEventSink.mm +31 -0
- package/ios/Fabric/DaroRNFabricPropApplier.mm +123 -0
- package/ios/Fabric/DaroRNNativeAdComponentView.mm +306 -0
- package/ios/{DaroMAdBannerViewManager.m → Paper/DaroRNAdBannerViewManager.m} +4 -2
- package/ios/Paper/DaroRNAdBannerViewManager.swift +21 -0
- package/ios/{DaroMNativeAdViewManager.m → Paper/DaroRNNativeAdViewManager.m} +3 -2
- package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMediationDebugger.swift +14 -0
- package/ios/{mediation/admob → Shared}/DaroMediationTypes.swift +1 -0
- package/ios/Shared/DaroRNAdEventSink.swift +24 -0
- package/ios/Shared/DaroRNBannerAdView.swift +188 -0
- package/ios/Shared/DaroRNNativeAdLoadCoordinator.swift +49 -0
- package/ios/Shared/DaroRNNativeAdView.swift +575 -0
- package/ios/Shared/DaroRNNativeAssetResolver.swift +53 -0
- package/lib/commonjs/AdBannerView.js +20 -41
- package/lib/commonjs/AdBannerView.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +45 -12
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/commonjs/DaroRNAdBannerViewNativeComponent.ts +50 -0
- package/lib/commonjs/DaroRNNativeAdViewNativeComponent.ts +65 -0
- package/lib/commonjs/EventEmitter.js +4 -5
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +9 -11
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/LightPopupAd.js +11 -12
- package/lib/commonjs/LightPopupAd.js.map +1 -1
- package/lib/commonjs/NativeDaroModule.js +9 -0
- package/lib/commonjs/NativeDaroModule.js.map +1 -0
- package/lib/commonjs/RewardedAd.js +9 -11
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/codegen-env.d.js +2 -0
- package/lib/commonjs/codegen-env.d.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +110 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useLightPopupAd.js +114 -0
- package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +113 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/index.js +150 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +23 -22
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +43 -31
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +34 -7
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/AdBannerView.js +19 -42
- package/lib/module/AdBannerView.js.map +1 -1
- package/lib/module/AppOpenAd.js +45 -13
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/DaroMediaViewNativeComponent.ts +9 -0
- package/lib/module/DaroRNAdBannerViewNativeComponent.ts +50 -0
- package/lib/module/DaroRNNativeAdViewNativeComponent.ts +65 -0
- package/lib/module/EventEmitter.js +4 -6
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +8 -11
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/LightPopupAd.js +11 -13
- package/lib/module/LightPopupAd.js.map +1 -1
- package/lib/module/NativeDaroModule.js +5 -0
- package/lib/module/NativeDaroModule.js.map +1 -0
- package/lib/module/RewardedAd.js +8 -11
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/codegen-env.d.js +2 -0
- package/lib/module/codegen-env.d.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +106 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useLightPopupAd.js +110 -0
- package/lib/module/hooks/useLightPopupAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +109 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/index.js +108 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +22 -23
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +45 -34
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +35 -8
- package/lib/module/nativeAd/NativeAdViewProvider.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 +2 -2
- 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/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts +33 -0
- package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts +43 -0
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +70 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +86 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.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 +2 -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 +2 -2
- 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/DaroMediaViewNativeComponent.d.ts +6 -0
- package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts +33 -0
- package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts +43 -0
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeDaroModule.d.ts +70 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -0
- package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +19 -0
- package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +23 -0
- package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +20 -0
- package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +86 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +1 -0
- package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
- package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.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 +2 -0
- package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/package.json +12 -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 +123 -83
- package/plugin/build/withIos.d.ts +2 -6
- package/plugin/build/withIos.js +37 -34
- package/react-native-daro.podspec +4 -2
- package/src/AdBannerView.tsx +24 -63
- package/src/AppOpenAd.ts +48 -17
- package/src/DaroMediaViewNativeComponent.ts +9 -0
- package/src/DaroRNAdBannerViewNativeComponent.ts +50 -0
- package/src/DaroRNNativeAdViewNativeComponent.ts +65 -0
- package/src/EventEmitter.ts +4 -5
- package/src/InterstitialAd.ts +8 -10
- package/src/LightPopupAd.ts +11 -12
- package/src/NativeDaroModule.ts +106 -0
- package/src/RewardedAd.ts +8 -10
- package/src/codegen-env.d.ts +45 -0
- package/src/hooks/useInterstitialAd.ts +117 -0
- package/src/hooks/useLightPopupAd.ts +132 -0
- package/src/hooks/useRewardedAd.ts +122 -0
- package/src/index.tsx +157 -22
- package/src/nativeAd/NativeAdView.tsx +41 -54
- package/src/nativeAd/NativeAdViewComponents.tsx +80 -42
- package/src/nativeAd/NativeAdViewProvider.tsx +75 -17
- package/src/types/AdInfo.ts +17 -0
- package/src/types/AdProps.ts +0 -2
- package/src/types/NativeAdViewProps.ts +7 -0
- package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
- package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -132
- package/android/src/main/java/com/daro/reactnative/DaroMAdNativeViewManager.kt +0 -136
- package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -202
- package/android/src/main/java/com/daro/reactnative/DaroMPackage.kt +0 -21
- package/android/src/main/java/com/daro/reactnative/view/DaroMAdNativeViewContainer.kt +0 -375
- package/ios/DaroMAdBannerViewManager.swift +0 -91
- package/ios/DaroMModule.mm +0 -45
- package/ios/DaroMNativeAdViewManager.swift +0 -291
- 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/types/DaroMMobileAds.d.ts +0 -6
- package/lib/typescript/commonjs/src/types/DaroMMobileAds.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/plugin/build/index.js
CHANGED
|
@@ -1,70 +1,35 @@
|
|
|
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
|
const withAndroid_1 = require("./withAndroid");
|
|
37
4
|
const withIos_1 = require("./withIos");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
'
|
|
42
|
-
'
|
|
5
|
+
// 통합 SDK 는 플랫폼당 INTEGRATION KEY 하나만 받는다. 구 프로퍼티가 오면 어디를
|
|
6
|
+
// 고쳐야 하는지 알려주며 실패한다.
|
|
7
|
+
const LEGACY_PROPS = {
|
|
8
|
+
android: ['daroAppKey', 'daroKeyFile'],
|
|
9
|
+
ios: ['daroAppKey', 'daroKeyFile', 'admobAppId'],
|
|
43
10
|
};
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return undefined;
|
|
11
|
+
function assertNoLegacyProps(platform, props) {
|
|
12
|
+
const legacy = LEGACY_PROPS[platform].filter((key) => key in props);
|
|
13
|
+
if (legacy.length > 0) {
|
|
14
|
+
throw new Error(`[daro-react-native] "${platform}.${legacy.join(`", "${platform}.`)}" ` +
|
|
15
|
+
'is no longer supported. The unified Daro SDK takes a single ' +
|
|
16
|
+
`"${platform}.daroIntegrationKey" instead — the build-time tooling ` +
|
|
17
|
+
'derives the app keys from it.');
|
|
52
18
|
}
|
|
53
19
|
}
|
|
20
|
+
// **미디에이션으로 분기하지 않는다.** 통합 SDK 는 AdMob·MAX 를 한 아티팩트에 담아
|
|
21
|
+
// 빌드타임 분기가 없다(android/build.gradle, DaroReactNative.podspec). 한때 여기서
|
|
22
|
+
// 패키지 이름을 읽어 admob/max 를 판정하고 둘 중 하나가 아니면 던졌는데, 판정한 값은
|
|
23
|
+
// 그 뒤로 쓰이지 않는 순수 게이트였고 통합 패키지명(daro-react-native)에서는 **항상**
|
|
24
|
+
// 걸렸다 — example 이 이 진입점을 우회하고 있어서 드러나지 않았을 뿐이다 (DARO-1458).
|
|
54
25
|
const withDaro = (config, props) => {
|
|
55
|
-
const mediation = getPackageMediation();
|
|
56
|
-
if (!mediation) {
|
|
57
|
-
throw new Error('[daro-react-native] The config plugin must be loaded from ' +
|
|
58
|
-
'"react-native-daro" or "react-native-daro-m".');
|
|
59
|
-
}
|
|
60
26
|
if (props?.ios) {
|
|
61
|
-
|
|
27
|
+
assertNoLegacyProps('ios', props.ios);
|
|
28
|
+
config = (0, withIos_1.withIosConfiguration)(config, props.ios);
|
|
62
29
|
}
|
|
63
30
|
if (props?.android) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
mediation,
|
|
67
|
-
});
|
|
31
|
+
assertNoLegacyProps('android', props.android);
|
|
32
|
+
config = (0, withAndroid_1.withAndroidConfiguration)(config, props.android);
|
|
68
33
|
}
|
|
69
34
|
return config;
|
|
70
35
|
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
-
import type { DaroAndroidProps
|
|
3
|
-
|
|
4
|
-
mediation: DaroMediation;
|
|
5
|
-
};
|
|
6
|
-
export declare const withAndroidConfiguration: ConfigPlugin<DaroResolvedAndroidProps>;
|
|
7
|
-
export {};
|
|
2
|
+
import type { DaroAndroidProps } from './index';
|
|
3
|
+
export declare const withAndroidConfiguration: ConfigPlugin<DaroAndroidProps>;
|
|
@@ -1,56 +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
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
5
|
+
const JETIFIER_IGNORELIST_KEY = 'android.jetifier.ignorelist';
|
|
6
|
+
const JETIFIER_IGNORELIST_ENTRIES = ['react-android', 'hermes-android'];
|
|
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:1.1.0-beta04';
|
|
14
|
+
// 통합 so.daro 플러그인이 release 빌드에 applovin-quality-service 를 스스로 적용한다 —
|
|
15
|
+
// 그 플러그인 id 가 해석되려면 classpath 와 AppLovin buildscript repo 가 앱에 있어야 한다.
|
|
42
16
|
const MAX_QUALITY_CLASSPATH = 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.5.2';
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
max: 'so.daro.m',
|
|
47
|
-
};
|
|
17
|
+
const APPLOVIN_MAVEN_REPO = 'https://artifacts.applovin.com/android';
|
|
18
|
+
// 통합 daro-sdk 가 싣는 어댑터 전체의 repo 목록 — android/daro-android-qa
|
|
19
|
+
// settings.gradle.kts 의 검증된 목록을 미러링한다 (QA 앱이 같은 좌표를 해결한다).
|
|
48
20
|
const DARO_MAVEN_REPOS = [
|
|
49
21
|
'https://artifact.bytedance.com/repository/pangle',
|
|
50
|
-
'https://
|
|
51
|
-
'https://android-sdk.is.com
|
|
22
|
+
'https://verve.jfrog.io/artifactory/verve-gradle-release',
|
|
23
|
+
'https://android-sdk.is.com',
|
|
52
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,
|
|
53
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.0-rc.2';
|
|
37
|
+
const DARO_SDK_DEPENDENCY_LINE_PATTERN = /^\s*(?:implementation|api|compileOnly|runtimeOnly)\s*(?:\(\s*)?['"]so\.daro:daro-(?:[am]|sdk):[^'"]+['"]\s*\)?\s*(?:\/\/.*)?$/gm;
|
|
54
38
|
function replaceOrThrow(contents, pattern, replacement, target) {
|
|
55
39
|
if (!pattern.test(contents)) {
|
|
56
40
|
throw new Error(`[daro-react-native] Cannot automatically update android/build.gradle. ` +
|
|
@@ -58,9 +42,65 @@ function replaceOrThrow(contents, pattern, replacement, target) {
|
|
|
58
42
|
}
|
|
59
43
|
return contents.replace(pattern, replacement);
|
|
60
44
|
}
|
|
45
|
+
function findClosingBrace(contents, openBraceIndex) {
|
|
46
|
+
let depth = 0;
|
|
47
|
+
for (let index = openBraceIndex; index < contents.length; index += 1) {
|
|
48
|
+
const char = contents[index];
|
|
49
|
+
if (char === '{') {
|
|
50
|
+
depth += 1;
|
|
51
|
+
}
|
|
52
|
+
else if (char === '}') {
|
|
53
|
+
depth -= 1;
|
|
54
|
+
if (depth === 0)
|
|
55
|
+
return index;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw new Error('[daro-react-native] Cannot automatically update android/build.gradle. ' +
|
|
59
|
+
'Expected to find a complete repositories block.');
|
|
60
|
+
}
|
|
61
|
+
function findRepositoriesBlock(contents, pattern, target) {
|
|
62
|
+
const match = pattern.exec(contents);
|
|
63
|
+
if (!match) {
|
|
64
|
+
throw new Error(`[daro-react-native] Cannot automatically update android/build.gradle. ` +
|
|
65
|
+
`Expected to find ${target}.`);
|
|
66
|
+
}
|
|
67
|
+
const openBraceIndex = match.index + match[0].lastIndexOf('{');
|
|
68
|
+
const closeBraceIndex = findClosingBrace(contents, openBraceIndex);
|
|
69
|
+
return {
|
|
70
|
+
insertIndex: match.index + match[0].length,
|
|
71
|
+
contentStartIndex: openBraceIndex + 1,
|
|
72
|
+
contents: contents.slice(openBraceIndex + 1, closeBraceIndex),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function addMavenRepositories(contents, pattern, urls, target) {
|
|
76
|
+
const repositoriesBlock = findRepositoriesBlock(contents, pattern, target);
|
|
77
|
+
const missingUrls = urls.filter((url) => !repositoriesBlock.contents.includes(url));
|
|
78
|
+
if (missingUrls.length === 0)
|
|
79
|
+
return contents;
|
|
80
|
+
const insertIndex = findRepositoryInsertIndex(repositoriesBlock);
|
|
81
|
+
return `${contents.slice(0, insertIndex)}\n${missingUrls
|
|
82
|
+
.map((url) => ` maven { url = uri("${url}") }`)
|
|
83
|
+
.join('\n')}${contents.slice(insertIndex)}`;
|
|
84
|
+
}
|
|
85
|
+
function findRepositoryInsertIndex(repositoriesBlock) {
|
|
86
|
+
const preferredAnchor = /mavenCentral\(\)[^\S\r\n]*/.exec(repositoriesBlock.contents) ??
|
|
87
|
+
/google\(\)[^\S\r\n]*/.exec(repositoriesBlock.contents);
|
|
88
|
+
return preferredAnchor
|
|
89
|
+
? repositoriesBlock.contentStartIndex +
|
|
90
|
+
preferredAnchor.index +
|
|
91
|
+
preferredAnchor[0].length
|
|
92
|
+
: repositoriesBlock.insertIndex;
|
|
93
|
+
}
|
|
94
|
+
function addAppLovinBuildscriptRepository(contents) {
|
|
95
|
+
const repositoriesBlock = findRepositoriesBlock(contents, /buildscript\s*\{[\s\S]*?repositories\s*\{/, 'a buildscript repositories block');
|
|
96
|
+
if (repositoriesBlock.contents.includes(APPLOVIN_MAVEN_REPO)) {
|
|
97
|
+
return contents;
|
|
98
|
+
}
|
|
99
|
+
const insertIndex = findRepositoryInsertIndex(repositoriesBlock);
|
|
100
|
+
const repositoryLine = `\n maven { url = uri("${APPLOVIN_MAVEN_REPO}") }`;
|
|
101
|
+
return `${contents.slice(0, insertIndex)}${repositoryLine}${contents.slice(insertIndex)}`;
|
|
102
|
+
}
|
|
61
103
|
const withAndroidConfiguration = (config, props) => {
|
|
62
|
-
const { mediation } = props;
|
|
63
|
-
const daroAppPluginId = DARO_APP_PLUGIN_IDS[mediation];
|
|
64
104
|
// 1. project build.gradle: classpath + maven repos
|
|
65
105
|
config = (0, config_plugins_1.withProjectBuildGradle)(config, (gradleConfig) => {
|
|
66
106
|
if (gradleConfig.modResults.language !== 'groovy') {
|
|
@@ -71,44 +111,59 @@ const withAndroidConfiguration = (config, props) => {
|
|
|
71
111
|
if (!contents.includes(DARO_GRADLE_PLUGIN_CLASSPATH)) {
|
|
72
112
|
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${DARO_GRADLE_PLUGIN_CLASSPATH}")`, 'a buildscript dependencies block');
|
|
73
113
|
}
|
|
74
|
-
if (
|
|
114
|
+
if (!contents.includes(MAX_QUALITY_CLASSPATH)) {
|
|
75
115
|
contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${MAX_QUALITY_CLASSPATH}")`, 'a buildscript dependencies block');
|
|
76
116
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
contents = replaceOrThrow(contents, /allprojects\s*\{[\s\S]*?repositories\s*\{/, (match) => `${match}\n maven { url = uri("${url}") }`, 'an allprojects repositories block');
|
|
84
|
-
}
|
|
85
|
-
if (mediation === 'max' &&
|
|
86
|
-
!contents.includes('daro-react-native-max-buildscript-repo')) {
|
|
87
|
-
contents = replaceOrThrow(contents, /buildscript\s*\{[\s\S]*?repositories\s*\{/, (match) => `${match}\n // daro-react-native-max-buildscript-repo\n maven { url = uri("${MAX_MAVEN_REPO}") }`, 'a buildscript repositories block');
|
|
88
|
-
}
|
|
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}')`);
|
|
89
123
|
gradleConfig.modResults.contents = contents;
|
|
90
124
|
return gradleConfig;
|
|
91
125
|
});
|
|
92
|
-
// 2. app/build.gradle:
|
|
126
|
+
// 2. app/build.gradle: add the unified Daro SDK dependency and plugin.
|
|
93
127
|
config = (0, config_plugins_1.withAppBuildGradle)(config, (gradleConfig) => {
|
|
94
128
|
if (gradleConfig.modResults.language !== 'groovy') {
|
|
95
129
|
config_plugins_1.WarningAggregator.addWarningAndroid('daro-react-native', 'Cannot automatically configure app/build.gradle if it is not groovy.');
|
|
96
130
|
return gradleConfig;
|
|
97
131
|
}
|
|
98
|
-
let contents = gradleConfig.modResults.contents.replace(/\n?apply plugin: ['"]so\.daro
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
132
|
+
let contents = gradleConfig.modResults.contents.replace(/\n?apply plugin: ['"]so\.daro(?:\.[am])?['"]\n?/g, '\n');
|
|
133
|
+
contents = contents.replace(DARO_SDK_DEPENDENCY_LINE_PATTERN, '');
|
|
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`;
|
|
136
|
+
gradleConfig.modResults.contents = contents;
|
|
102
137
|
return gradleConfig;
|
|
103
138
|
});
|
|
104
|
-
// 3. gradle.properties:
|
|
105
|
-
|
|
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
|
+
}
|
|
106
146
|
const entries = [
|
|
107
|
-
{ key: '
|
|
108
|
-
{ key: 'daroAppKey', value: props.daroAppKey },
|
|
147
|
+
{ key: 'daroIntegrationKey', value: props.daroIntegrationKey },
|
|
109
148
|
{ key: 'android.useAndroidX', value: 'true' },
|
|
110
149
|
{ key: 'android.enableJetifier', value: 'true' },
|
|
111
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
|
+
}
|
|
155
|
+
const existingIgnorelist = propertiesConfig.modResults
|
|
156
|
+
.filter((item) => item.type === 'property' && item.key === JETIFIER_IGNORELIST_KEY)
|
|
157
|
+
.flatMap((item) => item.value.split(','))
|
|
158
|
+
.map((item) => item.trim())
|
|
159
|
+
.filter(Boolean);
|
|
160
|
+
propertiesConfig.modResults = propertiesConfig.modResults.filter((item) => !(item.type === 'property' && item.key === JETIFIER_IGNORELIST_KEY));
|
|
161
|
+
entries.push({
|
|
162
|
+
key: JETIFIER_IGNORELIST_KEY,
|
|
163
|
+
value: [
|
|
164
|
+
...new Set([...existingIgnorelist, ...JETIFIER_IGNORELIST_ENTRIES]),
|
|
165
|
+
].join(','),
|
|
166
|
+
});
|
|
112
167
|
for (const { key, value } of entries) {
|
|
113
168
|
const existingIndex = propertiesConfig.modResults.findIndex((item) => item.type === 'property' && item.key === key);
|
|
114
169
|
const entry = { type: 'property', key, value };
|
|
@@ -121,20 +176,5 @@ const withAndroidConfiguration = (config, props) => {
|
|
|
121
176
|
}
|
|
122
177
|
return propertiesConfig;
|
|
123
178
|
});
|
|
124
|
-
// 4. daroKeyFile을 android/app/ 루트에 복사
|
|
125
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
126
|
-
'android',
|
|
127
|
-
async (dangerousConfig) => {
|
|
128
|
-
const sourcePath = path.resolve(dangerousConfig.modRequest.projectRoot, props.daroKeyFile);
|
|
129
|
-
if (!fs.existsSync(sourcePath)) {
|
|
130
|
-
throw new Error(`[daro-react-native] Cannot find Android key file at "${sourcePath}". ` +
|
|
131
|
-
`Set "android.daroKeyFile" in plugin options to a valid path.`);
|
|
132
|
-
}
|
|
133
|
-
const destinationPath = path.resolve(dangerousConfig.modRequest.platformProjectRoot, 'app', KEY_FILE_NAME);
|
|
134
|
-
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
|
135
|
-
fs.copyFileSync(sourcePath, destinationPath);
|
|
136
|
-
return dangerousConfig;
|
|
137
|
-
},
|
|
138
|
-
]);
|
|
139
179
|
};
|
|
140
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,46 +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 (mediation === 'admob') {
|
|
50
|
-
if (!props.admobAppId) {
|
|
51
|
-
throw new Error('[daro-react-native] "ios.admobAppId" is required when mediation is "admob".');
|
|
52
|
-
}
|
|
53
|
-
config.modResults.GADApplicationIdentifier = props.admobAppId;
|
|
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.');
|
|
54
56
|
}
|
|
57
|
+
plistConfig.modResults.DaroIntegrationKey = props.daroIntegrationKey;
|
|
58
|
+
plistConfig.modResults.NSUserTrackingUsageDescription =
|
|
59
|
+
props.attUsageDescription ?? DEFAULT_ATT_USAGE_DESCRIPTION;
|
|
55
60
|
// SKAdNetworkItems: 사용자가 미리 추가한 항목과 머지 (중복 제거)
|
|
56
|
-
const existing =
|
|
57
|
-
[];
|
|
61
|
+
const existing = plistConfig.modResults.SKAdNetworkItems ?? [];
|
|
58
62
|
const existingIds = new Set(existing.map((item) => item.SKAdNetworkIdentifier));
|
|
59
63
|
const additions = skAdNetworkIds_1.DARO_SK_AD_NETWORK_IDS.filter((id) => !existingIds.has(id)).map((id) => ({ SKAdNetworkIdentifier: id }));
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
});
|
|
63
|
-
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
64
|
-
const projectRoot = config.modRequest.projectRoot;
|
|
65
|
-
const projectName = config.modRequest.projectName ??
|
|
66
|
-
config_plugins_1.IOSConfig.XcodeUtils.getProjectName(projectRoot);
|
|
67
|
-
const sourcePath = path.resolve(projectRoot, props.daroKeyFile);
|
|
68
|
-
if (!fs.existsSync(sourcePath)) {
|
|
69
|
-
throw new Error(`[daro-react-native] Cannot find iOS key file at "${sourcePath}". ` +
|
|
70
|
-
`Set "ios.daroKeyFile" in plugin options to a valid path.`);
|
|
71
|
-
}
|
|
72
|
-
const destinationPath = path.resolve(config_plugins_1.IOSConfig.Paths.getSourceRoot(projectRoot), KEY_FILE_NAME);
|
|
73
|
-
fs.copyFileSync(sourcePath, destinationPath);
|
|
74
|
-
config_plugins_1.IOSConfig.XcodeUtils.addResourceFileToGroup({
|
|
75
|
-
filepath: `${projectName}/${KEY_FILE_NAME}`,
|
|
76
|
-
groupName: projectName,
|
|
77
|
-
project: config.modResults,
|
|
78
|
-
isBuildFile: true,
|
|
79
|
-
});
|
|
80
|
-
return config;
|
|
64
|
+
plistConfig.modResults.SKAdNetworkItems = [...existing, ...additions];
|
|
65
|
+
return plistConfig;
|
|
81
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
|
+
]);
|
|
82
85
|
};
|
|
83
86
|
exports.withIosConfiguration = withIosConfiguration;
|
|
@@ -15,11 +15,13 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
|
|
16
16
|
s.source_files = [
|
|
17
17
|
"ios/*.{h,m,mm,swift,cpp}",
|
|
18
|
-
"ios/
|
|
18
|
+
"ios/Shared/**/*.{h,m,mm,swift,cpp}",
|
|
19
|
+
"ios/Paper/**/*.{h,m,mm,swift,cpp}",
|
|
20
|
+
"ios/Fabric/**/*.{h,m,mm,swift,cpp}"
|
|
19
21
|
]
|
|
20
22
|
s.private_header_files = "ios/**/*.h"
|
|
21
23
|
|
|
22
|
-
s.dependency "DaroAds", "
|
|
24
|
+
s.dependency "DaroAds", "2.0.0-rc.5"
|
|
23
25
|
|
|
24
26
|
install_modules_dependencies(s)
|
|
25
27
|
end
|
package/src/AdBannerView.tsx
CHANGED
|
@@ -5,17 +5,13 @@ import {
|
|
|
5
5
|
useImperativeHandle,
|
|
6
6
|
useRef,
|
|
7
7
|
useState,
|
|
8
|
+
type ElementRef,
|
|
8
9
|
} from 'react';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
View,
|
|
15
|
-
type DimensionValue,
|
|
16
|
-
type NativeMethods,
|
|
17
|
-
type ViewProps,
|
|
18
|
-
} from 'react-native';
|
|
10
|
+
import { View, type ViewProps } from 'react-native';
|
|
11
|
+
import AdBannerViewNativeComponent, {
|
|
12
|
+
Commands,
|
|
13
|
+
} from './DaroRNAdBannerViewNativeComponent';
|
|
14
|
+
import NativeDaroModule from './NativeDaroModule';
|
|
19
15
|
import type {
|
|
20
16
|
AdBannerViewHandler,
|
|
21
17
|
AdBannerViewProps,
|
|
@@ -23,36 +19,26 @@ import type {
|
|
|
23
19
|
import type { AdNativeEvent } from './types/AdEvent';
|
|
24
20
|
import type { AdInfo, AdLoadFailedInfo } from './types/AdInfo';
|
|
25
21
|
|
|
26
|
-
const { DaroMModule } = NativeModules;
|
|
27
|
-
|
|
28
22
|
const { BANNER_AD_FORMAT_LABEL, MREC_AD_FORMAT_LABEL } =
|
|
29
|
-
|
|
23
|
+
NativeDaroModule.getConstants();
|
|
30
24
|
|
|
31
25
|
export enum AdFormat {
|
|
32
|
-
BANNER =
|
|
33
|
-
MREC =
|
|
26
|
+
BANNER = 'BANNER',
|
|
27
|
+
MREC = 'MREC',
|
|
34
28
|
}
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
const toNativeAdFormat = (adFormat: AdFormat | string): string => {
|
|
31
|
+
switch (adFormat) {
|
|
32
|
+
case AdFormat.BANNER:
|
|
33
|
+
return BANNER_AD_FORMAT_LABEL;
|
|
34
|
+
case AdFormat.MREC:
|
|
35
|
+
return MREC_AD_FORMAT_LABEL;
|
|
36
|
+
default:
|
|
37
|
+
return adFormat;
|
|
38
|
+
}
|
|
41
39
|
};
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
const AdViewComponent = requireNativeComponent<
|
|
45
|
-
AdBannerViewProps & ViewProps & AdViewNativeEvents
|
|
46
|
-
>(ComponentName);
|
|
47
|
-
type AdViewType = React.Component<AdBannerViewProps> & NativeMethods;
|
|
48
|
-
|
|
49
|
-
type SizeKey = 'width' | 'height';
|
|
50
|
-
type SizeRecord = Partial<Record<SizeKey, DimensionValue>>;
|
|
51
|
-
|
|
52
|
-
const ADVIEW_SIZE = {
|
|
53
|
-
banner: { width: 320, height: 50 },
|
|
54
|
-
mrec: { width: 300, height: 250 },
|
|
55
|
-
};
|
|
41
|
+
type AdViewType = ElementRef<typeof AdBannerViewNativeComponent>;
|
|
56
42
|
|
|
57
43
|
export const AdBannerView = forwardRef<
|
|
58
44
|
AdBannerViewHandler,
|
|
@@ -61,7 +47,6 @@ export const AdBannerView = forwardRef<
|
|
|
61
47
|
{
|
|
62
48
|
adUnitId,
|
|
63
49
|
adFormat,
|
|
64
|
-
placement,
|
|
65
50
|
loadOnMount = true,
|
|
66
51
|
isVisible = true,
|
|
67
52
|
onAdLoaded,
|
|
@@ -73,24 +58,12 @@ export const AdBannerView = forwardRef<
|
|
|
73
58
|
},
|
|
74
59
|
ref
|
|
75
60
|
) {
|
|
76
|
-
const adFormatSize = useRef<SizeRecord>({});
|
|
77
61
|
const adViewRef = useRef<AdViewType | null>(null);
|
|
78
62
|
const [isInitialized, setIsInitialized] = useState<boolean>(false);
|
|
79
63
|
|
|
80
64
|
const loadAd = useCallback(() => {
|
|
81
65
|
if (adViewRef.current) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof nodeHandle !== 'number') {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
UIManager.dispatchViewManagerCommand(
|
|
89
|
-
nodeHandle,
|
|
90
|
-
// @ts-ignore: Issue in RN ts defs
|
|
91
|
-
UIManager.getViewManagerConfig(ComponentName).Commands.loadAd,
|
|
92
|
-
[]
|
|
93
|
-
);
|
|
66
|
+
Commands.loadAd(adViewRef.current);
|
|
94
67
|
}
|
|
95
68
|
}, []);
|
|
96
69
|
|
|
@@ -102,18 +75,7 @@ export const AdBannerView = forwardRef<
|
|
|
102
75
|
|
|
103
76
|
useEffect(() => {
|
|
104
77
|
(async () => {
|
|
105
|
-
|
|
106
|
-
adFormatSize.current = {
|
|
107
|
-
width: ADVIEW_SIZE.banner.width,
|
|
108
|
-
height: ADVIEW_SIZE.banner.height,
|
|
109
|
-
};
|
|
110
|
-
} else {
|
|
111
|
-
adFormatSize.current = {
|
|
112
|
-
width: ADVIEW_SIZE.mrec.width,
|
|
113
|
-
height: ADVIEW_SIZE.mrec.height,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const initialized = await DaroMModule.isInitialized();
|
|
78
|
+
const initialized = await NativeDaroModule.isInitialized();
|
|
117
79
|
setIsInitialized(initialized);
|
|
118
80
|
|
|
119
81
|
if (!initialized) {
|
|
@@ -122,7 +84,7 @@ export const AdBannerView = forwardRef<
|
|
|
122
84
|
);
|
|
123
85
|
}
|
|
124
86
|
})();
|
|
125
|
-
}, [
|
|
87
|
+
}, []);
|
|
126
88
|
|
|
127
89
|
const onAdLoadedEvent = useCallback(
|
|
128
90
|
(event: AdNativeEvent<AdInfo>) => {
|
|
@@ -159,12 +121,11 @@ export const AdBannerView = forwardRef<
|
|
|
159
121
|
}
|
|
160
122
|
|
|
161
123
|
return (
|
|
162
|
-
<
|
|
124
|
+
<AdBannerViewNativeComponent
|
|
163
125
|
style={style}
|
|
164
|
-
adFormat={adFormat}
|
|
126
|
+
adFormat={toNativeAdFormat(adFormat)}
|
|
165
127
|
ref={saveElement}
|
|
166
128
|
adUnitId={adUnitId}
|
|
167
|
-
placement={placement}
|
|
168
129
|
loadOnMount={loadOnMount}
|
|
169
130
|
isVisible={isVisible}
|
|
170
131
|
onAdLoadedEvent={onAdLoadedEvent}
|