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,6 +1,6 @@
|
|
|
1
1
|
import React
|
|
2
2
|
|
|
3
|
-
extension
|
|
3
|
+
extension DaroRNModule {
|
|
4
4
|
@objc(isRewardedAdReady:adUnitId:resolve:reject:)
|
|
5
5
|
func isRewardedAdReady(
|
|
6
6
|
requestId: Double,
|
|
@@ -10,7 +10,7 @@ extension DaroMModule {
|
|
|
10
10
|
) {
|
|
11
11
|
let requestId = Int(requestId)
|
|
12
12
|
if !Self.sdkInitialized {
|
|
13
|
-
|
|
13
|
+
DaroRNModule.logger.debug("[DaroRNMobileAds] !isInitialized")
|
|
14
14
|
resolve(false)
|
|
15
15
|
return
|
|
16
16
|
}
|
|
@@ -63,25 +63,25 @@ extension DaroMModule {
|
|
|
63
63
|
} else {
|
|
64
64
|
let rewardedAdLoader = DaroRewardedAdLoader(unit: DaroAdUnit(unitId: adUnitId))
|
|
65
65
|
rewardedAdLoader.listener.onAdClicked = { [weak self] adInfo in
|
|
66
|
-
|
|
66
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad clicked")
|
|
67
67
|
self?.sendEvent(with: .onRewardedAdClickedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
rewardedAdLoader.listener.onAdImpression = { [weak self] adInfo in
|
|
71
|
-
|
|
71
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad impression")
|
|
72
72
|
self?.rewardedAds[requestId]?.loadedAd = nil
|
|
73
73
|
self?.sendEvent(with: .onRewardedAdImpressionRecordedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
rewardedAdLoader.listener.onAdLoadSuccess = { [weak self] ad, adInfo in
|
|
77
|
-
|
|
77
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad loaded")
|
|
78
78
|
self?.rewardedAds[requestId]?.loadedAd = ad
|
|
79
79
|
self?.sendEvent(with: .onRewardedAdLoadedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
80
80
|
self?.setupRewardedListener(for: ad, requestId: requestId)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
rewardedAdLoader.listener.onAdLoadFail = { [weak self] error in
|
|
84
|
-
|
|
84
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad failed to load: \(error)")
|
|
85
85
|
self?.sendEvent(with: .onRewardedAdLoadFailedEvent, body: error.toBody(requestId: requestId))
|
|
86
86
|
}
|
|
87
87
|
self.rewardedAds[requestId] = RewardedAd(loader: rewardedAdLoader)
|
|
@@ -91,22 +91,22 @@ extension DaroMModule {
|
|
|
91
91
|
|
|
92
92
|
private func setupRewardedListener(for ad: DaroRewardedAd, requestId: Int) {
|
|
93
93
|
ad.rewardedAdListener.onShown = { [weak self] adInfo in
|
|
94
|
-
|
|
94
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad displayed")
|
|
95
95
|
self?.sendEvent(with: .onRewardedAdDisplayedEvent, body: adInfo?.toBody(requestId: requestId))
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
ad.rewardedAdListener.onDismiss = { [weak self] adInfo in
|
|
99
|
-
|
|
99
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad hidden")
|
|
100
100
|
self?.sendEvent(with: .onRewardedAdHiddenEvent, body: adInfo?.toBody(requestId: requestId))
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
ad.rewardedAdListener.onFailedToShow = { [weak self] adInfo, error in
|
|
104
|
-
|
|
104
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad failed to display: \(error)")
|
|
105
105
|
self?.sendEvent(with: .onRewardedAdFailedToDisplayEvent, body: adInfo?.toBody(requestId: requestId))
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
ad.rewardedAdListener.onEarnedReward = { [weak self] adInfo, rewardItem in
|
|
109
|
-
|
|
109
|
+
DaroRNModule.logger.debug("[DARO] Sample Rewarded Ad received reward")
|
|
110
110
|
self?.sendEvent(with: .onRewardedAdReceivedRewardEvent, body: rewardItem?.toBody(requestId: requestId, unitId: adInfo?.adUnitId ?? ""))
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#import <DaroReactNativeSpec/DaroReactNativeSpec.h>
|
|
6
6
|
#endif
|
|
7
7
|
|
|
8
|
-
@interface RCT_EXTERN_MODULE (
|
|
8
|
+
@interface RCT_EXTERN_MODULE (DaroRNModule, RCTEventEmitter)
|
|
9
9
|
|
|
10
10
|
#pragma mark - Initialization
|
|
11
11
|
|
|
@@ -13,9 +13,24 @@ RCT_EXTERN_METHOD(isInitialized:(RCTPromiseResolveBlock)resolve reject:(RCTPromi
|
|
|
13
13
|
RCT_EXTERN_METHOD(initializeSdk:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
14
14
|
RCT_EXTERN_METHOD(setUserId:(NSString *)userId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
15
15
|
|
|
16
|
+
#pragma mark - Consent
|
|
17
|
+
|
|
18
|
+
RCT_EXTERN_METHOD(setGdpr:(NSString *)status consentString:(NSString *)consentString resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
19
|
+
RCT_EXTERN_METHOD(setCcpa:(NSString *)status consentString:(NSString *)consentString resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
20
|
+
RCT_EXTERN_METHOD(setCoppa:(NSString *)status resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
21
|
+
|
|
16
22
|
#pragma mark - Mediation Debugger
|
|
17
23
|
|
|
18
24
|
RCT_EXTERN_METHOD(showMediationDebugger:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
25
|
+
RCT_EXTERN_METHOD(showMediationDebuggerFor:(NSString *)mediation resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
26
|
+
|
|
27
|
+
#pragma mark - QA Surface
|
|
28
|
+
|
|
29
|
+
RCT_EXTERN_METHOD(getSdkVersion:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
30
|
+
RCT_EXTERN_METHOD(getMediationStatuses:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
31
|
+
RCT_EXTERN_METHOD(getMediationWeights:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
32
|
+
RCT_EXTERN_METHOD(getAdapterInventory:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
33
|
+
RCT_EXTERN_METHOD(getIntegrationKeyInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
19
34
|
|
|
20
35
|
#pragma mark - Interstitial
|
|
21
36
|
|
|
@@ -33,10 +48,11 @@ RCT_EXTERN_METHOD(showRewardedAd:(double)requestId adUnitId:(NSString *)adUnitId
|
|
|
33
48
|
|
|
34
49
|
RCT_EXTERN_METHOD(isAppOpenAdReady:(double)requestId adUnitId:(NSString *)adUnitId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
35
50
|
RCT_EXTERN_METHOD(loadAppOpenAd:(double)requestId adUnitId:(NSString *)adUnitId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
36
|
-
RCT_EXTERN_METHOD(showAppOpenAd:(double)requestId adUnitId:(NSString *)adUnitId
|
|
51
|
+
RCT_EXTERN_METHOD(showAppOpenAd:(double)requestId adUnitId:(NSString *)adUnitId customData:(nullable NSString *)customData resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
37
52
|
|
|
38
53
|
#pragma mark - Light Popup
|
|
39
54
|
|
|
55
|
+
RCT_EXTERN_METHOD(destroyLightPopup:(double)requestId adUnitId:(NSString *)adUnitId)
|
|
40
56
|
RCT_EXTERN_METHOD(isLightPopupReady:(double)requestId adUnitId:(NSString *)adUnitId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
41
57
|
RCT_EXTERN_METHOD(loadLightPopup:(double)requestId adUnitId:(NSString *)adUnitId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
42
58
|
RCT_EXTERN_METHOD(showLightPopup:(double)requestId adUnitId:(NSString *)adUnitId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
@@ -50,10 +66,10 @@ RCT_EXTERN_METHOD(setLightPopupAdConfiguration:(double)requestId adUnitId:(NSStr
|
|
|
50
66
|
|
|
51
67
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
52
68
|
|
|
53
|
-
@interface
|
|
69
|
+
@interface DaroRNModule (TurboModule) <RCTTurboModule>
|
|
54
70
|
@end
|
|
55
71
|
|
|
56
|
-
@implementation
|
|
72
|
+
@implementation DaroRNModule (TurboModule)
|
|
57
73
|
|
|
58
74
|
- (facebook::react::ModuleConstants<JS::NativeDaroModule::Constants>)getConstants
|
|
59
75
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React
|
|
2
2
|
import os.log
|
|
3
3
|
|
|
4
|
-
@objc(
|
|
5
|
-
class
|
|
4
|
+
@objc(DaroRNModule)
|
|
5
|
+
class DaroRNModule: RCTEventEmitter {
|
|
6
6
|
|
|
7
7
|
// 중앙집중식 로거 - 다른 파일에서도 사용 가능
|
|
8
|
-
static let logger = Logger(subsystem: "com.
|
|
8
|
+
static let logger = Logger(subsystem: "com.daro.reactnative", category: "DaroRNModule")
|
|
9
9
|
|
|
10
10
|
enum Event: String, CaseIterable {
|
|
11
11
|
|
|
@@ -86,6 +86,7 @@ class DaroMModule: RCTEventEmitter {
|
|
|
86
86
|
internal var rewardedAds: [Int: RewardedAd] = [:]
|
|
87
87
|
internal var appOpenAds: [Int: AppOpenAd] = [:]
|
|
88
88
|
internal var lightPopups: [Int: LightPopupAd] = [:]
|
|
89
|
+
internal var lightPopupInvalidated = false
|
|
89
90
|
internal var lightPopupConfigurations: [Int: [String: Any]] = [:]
|
|
90
91
|
|
|
91
92
|
// MARK: - SDK 초기화 및 설정
|
|
@@ -161,9 +162,20 @@ class DaroMModule: RCTEventEmitter {
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
override func invalidate() {
|
|
166
|
+
performLightPopupOnMain {
|
|
167
|
+
lightPopupInvalidated = true
|
|
168
|
+
let requests = Array(lightPopups.keys)
|
|
169
|
+
requests.forEach { releaseLightPopup(requestId: $0) }
|
|
170
|
+
}
|
|
171
|
+
super.invalidate()
|
|
172
|
+
}
|
|
173
|
+
|
|
164
174
|
class LightPopupAd {
|
|
165
175
|
let loader: DaroLightPopupAdLoader
|
|
166
176
|
var loadedAd: DaroLightPopupAd?
|
|
177
|
+
var presentedAd: DaroLightPopupAd?
|
|
178
|
+
weak var presentedController: UIViewController?
|
|
167
179
|
|
|
168
180
|
init(loader: DaroLightPopupAdLoader) {
|
|
169
181
|
self.loader = loader
|
|
@@ -172,7 +184,7 @@ class DaroMModule: RCTEventEmitter {
|
|
|
172
184
|
}
|
|
173
185
|
|
|
174
186
|
// MARK: - Constants
|
|
175
|
-
extension
|
|
187
|
+
extension DaroRNModule {
|
|
176
188
|
|
|
177
189
|
// https://reactnative.dev/docs/legacy/native-modules-ios#sending-events-to-javascript
|
|
178
190
|
// Sending Events to JavaScript
|
|
@@ -188,18 +200,32 @@ extension DaroMModule {
|
|
|
188
200
|
}
|
|
189
201
|
|
|
190
202
|
// MARK: - Helpers
|
|
191
|
-
extension
|
|
203
|
+
extension DaroRNModule {
|
|
192
204
|
func sendEvent(with event: Event, body: Any?) {
|
|
193
205
|
sendEvent(withName: event.rawValue, body: body)
|
|
194
206
|
}
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
extension DaroAdInfo {
|
|
210
|
+
// 모듈 경로와 뷰 경로(DaroRNBannerAdView·DaroRNNativeAdView)가 **둘 다 여기를 지난다.**
|
|
198
211
|
var toBody: [String: Any] {
|
|
199
|
-
|
|
212
|
+
var body: [String: Any] = [
|
|
200
213
|
"adUnitId": self.adUnitId,
|
|
201
214
|
"latencyMillis": self.latency as Any,
|
|
202
215
|
]
|
|
216
|
+
// 없을 때는 키를 넣지 않는다 — [String: Any] 에 nil 을 담으면 JS 에서 null 로
|
|
217
|
+
// 보이고, 타입은 옵셔널이라 undefined 여야 한다.
|
|
218
|
+
//
|
|
219
|
+
// SDK 가 정한 어휘를 **그대로** 넘긴다. 래퍼에서 매핑하지 않는다 — 발행 tarball 이
|
|
220
|
+
// android/ios 를 소스로 싣기 때문에 여기 매핑을 두면 그대로 읽힌다.
|
|
221
|
+
if let mediationPlatform = self.mediationPlatform {
|
|
222
|
+
body["mediationPlatform"] = mediationPlatform
|
|
223
|
+
}
|
|
224
|
+
// 벤더 어휘. 정규화하지 않는다 (AdMob responseInfo.adNetwork / AppLovin networkName).
|
|
225
|
+
if let adNetwork = self.adNetwork {
|
|
226
|
+
body["adNetwork"] = adNetwork
|
|
227
|
+
}
|
|
228
|
+
return body
|
|
203
229
|
}
|
|
204
230
|
|
|
205
231
|
func toBody(requestId: Int) -> [String: Any] {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
#import <React/RCTDefines.h>
|
|
2
|
+
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
|
|
5
|
+
#import <React/RCTComponent.h>
|
|
6
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
7
|
+
#import <React/RCTViewComponentView.h>
|
|
8
|
+
#import <react/renderer/components/DaroReactNativeSpec/ComponentDescriptors.h>
|
|
9
|
+
#import <react/renderer/components/DaroReactNativeSpec/EventEmitters.h>
|
|
10
|
+
#import <react/renderer/components/DaroReactNativeSpec/Props.h>
|
|
11
|
+
#import <react/renderer/components/DaroReactNativeSpec/RCTComponentViewHelpers.h>
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
|
|
17
|
+
extern UIView *DaroRNFabricCreateSwiftView(NSString *className);
|
|
18
|
+
extern void DaroRNFabricSetValue(UIView *view, NSString *key, id value);
|
|
19
|
+
extern void DaroRNFabricPerformSelector(UIView *view, SEL selector);
|
|
20
|
+
extern void DaroRNFabricPerformSelectorWithObject(UIView *view, SEL selector, id object);
|
|
21
|
+
extern NSString *DaroRNFabricNSStringFromStdString(const std::string &value);
|
|
22
|
+
extern NSDictionary *DaroRNFabricEventBody(NSDictionary *body);
|
|
23
|
+
extern std::string DaroRNFabricEventString(NSDictionary *body, NSString *key);
|
|
24
|
+
extern double DaroRNFabricEventDouble(NSDictionary *body, NSString *key);
|
|
25
|
+
extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
26
|
+
|
|
27
|
+
@interface DaroRNAdBannerViewComponentView : RCTViewComponentView <RCTDaroRNAdBannerViewViewProtocol>
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@implementation DaroRNAdBannerViewComponentView {
|
|
31
|
+
UIView *_bannerView;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (void)load
|
|
35
|
+
{
|
|
36
|
+
[super load];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
40
|
+
{
|
|
41
|
+
if (self = [super initWithFrame:frame]) {
|
|
42
|
+
static const auto defaultProps = std::make_shared<const DaroRNAdBannerViewProps>();
|
|
43
|
+
_props = defaultProps;
|
|
44
|
+
[self createBannerView];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return self;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)createBannerView
|
|
51
|
+
{
|
|
52
|
+
_bannerView = DaroRNFabricCreateSwiftView(@"DaroRNAdBannerView");
|
|
53
|
+
self.contentView = _bannerView;
|
|
54
|
+
[self installEventHandlers];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)installEventHandlers
|
|
58
|
+
{
|
|
59
|
+
__weak DaroRNAdBannerViewComponentView *weakSelf = self;
|
|
60
|
+
|
|
61
|
+
RCTDirectEventBlock onAdLoadedEvent = ^(NSDictionary *body) {
|
|
62
|
+
DaroRNAdBannerViewComponentView *strongSelf = weakSelf;
|
|
63
|
+
if (!strongSelf) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
68
|
+
if (!eventEmitter) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
73
|
+
eventEmitter->onAdLoadedEvent({
|
|
74
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
75
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
76
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
77
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
78
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
79
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
RCTDirectEventBlock onAdLoadFailedEvent = ^(NSDictionary *body) {
|
|
84
|
+
DaroRNAdBannerViewComponentView *strongSelf = weakSelf;
|
|
85
|
+
if (!strongSelf) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
90
|
+
if (!eventEmitter) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
95
|
+
eventEmitter->onAdLoadFailedEvent({
|
|
96
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
97
|
+
.code = DaroRNFabricEventInt(eventBody, @"code"),
|
|
98
|
+
.message = DaroRNFabricEventString(eventBody, @"message"),
|
|
99
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
RCTDirectEventBlock onAdClickedEvent = ^(NSDictionary *body) {
|
|
104
|
+
DaroRNAdBannerViewComponentView *strongSelf = weakSelf;
|
|
105
|
+
if (!strongSelf) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
110
|
+
if (!eventEmitter) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
115
|
+
eventEmitter->onAdClickedEvent({
|
|
116
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
117
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
118
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
119
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
120
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
121
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
RCTDirectEventBlock onAdImpressionRecordedEvent = ^(NSDictionary *body) {
|
|
126
|
+
DaroRNAdBannerViewComponentView *strongSelf = weakSelf;
|
|
127
|
+
if (!strongSelf) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNAdBannerViewEventEmitter>(strongSelf->_eventEmitter);
|
|
132
|
+
if (!eventEmitter) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
137
|
+
eventEmitter->onAdImpressionRecordedEvent({
|
|
138
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
139
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
140
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
141
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
142
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
143
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
DaroRNFabricSetValue(_bannerView, @"onAdLoadedEvent", onAdLoadedEvent);
|
|
148
|
+
DaroRNFabricSetValue(_bannerView, @"onAdLoadFailedEvent", onAdLoadFailedEvent);
|
|
149
|
+
DaroRNFabricSetValue(_bannerView, @"onAdClickedEvent", onAdClickedEvent);
|
|
150
|
+
DaroRNFabricSetValue(_bannerView, @"onAdImpressionRecordedEvent", onAdImpressionRecordedEvent);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
154
|
+
{
|
|
155
|
+
return concreteComponentDescriptorProvider<DaroRNAdBannerViewComponentDescriptor>();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
159
|
+
{
|
|
160
|
+
const auto &oldComponentProps = *std::static_pointer_cast<const DaroRNAdBannerViewProps>(_props);
|
|
161
|
+
const auto &newComponentProps = *std::static_pointer_cast<const DaroRNAdBannerViewProps>(props);
|
|
162
|
+
NSMutableArray<NSString *> *changedProps = [NSMutableArray new];
|
|
163
|
+
|
|
164
|
+
if (oldComponentProps.adUnitId != newComponentProps.adUnitId) {
|
|
165
|
+
DaroRNFabricSetValue(_bannerView, @"adUnitId", DaroRNFabricNSStringFromStdString(newComponentProps.adUnitId));
|
|
166
|
+
[changedProps addObject:@"adUnitId"];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (oldComponentProps.adFormat != newComponentProps.adFormat) {
|
|
170
|
+
DaroRNFabricSetValue(_bannerView, @"adFormat", DaroRNFabricNSStringFromStdString(newComponentProps.adFormat));
|
|
171
|
+
[changedProps addObject:@"adFormat"];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (oldComponentProps.loadOnMount != newComponentProps.loadOnMount) {
|
|
175
|
+
DaroRNFabricSetValue(_bannerView, @"loadOnMount", @(newComponentProps.loadOnMount));
|
|
176
|
+
[changedProps addObject:@"loadOnMount"];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (oldComponentProps.isVisible != newComponentProps.isVisible) {
|
|
180
|
+
DaroRNFabricSetValue(_bannerView, @"isVisible", @(newComponentProps.isVisible));
|
|
181
|
+
[changedProps addObject:@"isVisible"];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
[super updateProps:props oldProps:oldProps];
|
|
185
|
+
|
|
186
|
+
DaroRNFabricPerformSelectorWithObject(_bannerView, NSSelectorFromString(@"applyReactProps:"), changedProps);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
- (void)loadAd
|
|
190
|
+
{
|
|
191
|
+
DaroRNFabricPerformSelector(_bannerView, NSSelectorFromString(@"loadAd"));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
195
|
+
{
|
|
196
|
+
RCTDaroRNAdBannerViewHandleCommand(self, commandName, args);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
- (void)prepareForRecycle
|
|
200
|
+
{
|
|
201
|
+
[super prepareForRecycle];
|
|
202
|
+
DaroRNFabricSetValue(_bannerView, @"onAdLoadedEvent", nil);
|
|
203
|
+
DaroRNFabricSetValue(_bannerView, @"onAdLoadFailedEvent", nil);
|
|
204
|
+
DaroRNFabricSetValue(_bannerView, @"onAdClickedEvent", nil);
|
|
205
|
+
DaroRNFabricSetValue(_bannerView, @"onAdImpressionRecordedEvent", nil);
|
|
206
|
+
DaroRNFabricPerformSelector(_bannerView, NSSelectorFromString(@"prepareForReuse"));
|
|
207
|
+
[self installEventHandlers];
|
|
208
|
+
static const auto defaultProps = std::make_shared<const DaroRNAdBannerViewProps>();
|
|
209
|
+
_props = defaultProps;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@end
|
|
213
|
+
|
|
214
|
+
Class<RCTComponentViewProtocol> DaroRNAdBannerViewCls(void)
|
|
215
|
+
{
|
|
216
|
+
return DaroRNAdBannerViewComponentView.class;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
#endif
|
|
@@ -5,24 +5,24 @@
|
|
|
5
5
|
#import <Foundation/Foundation.h>
|
|
6
6
|
#include <string>
|
|
7
7
|
|
|
8
|
-
NSDictionary *
|
|
8
|
+
NSDictionary *DaroRNFabricEventBody(NSDictionary *body)
|
|
9
9
|
{
|
|
10
10
|
return [body isKindOfClass:NSDictionary.class] ? body : @{};
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
std::string
|
|
13
|
+
std::string DaroRNFabricEventString(NSDictionary *body, NSString *key)
|
|
14
14
|
{
|
|
15
15
|
id value = body[key];
|
|
16
16
|
return [value isKindOfClass:NSString.class] ? std::string([value UTF8String]) : "";
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
double
|
|
19
|
+
double DaroRNFabricEventDouble(NSDictionary *body, NSString *key)
|
|
20
20
|
{
|
|
21
21
|
id value = body[key];
|
|
22
22
|
return [value respondsToSelector:@selector(doubleValue)] ? [value doubleValue] : 0;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
int
|
|
25
|
+
int DaroRNFabricEventInt(NSDictionary *body, NSString *key)
|
|
26
26
|
{
|
|
27
27
|
id value = body[key];
|
|
28
28
|
return [value respondsToSelector:@selector(intValue)] ? [value intValue] : 0;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
#include <folly/dynamic.h>
|
|
8
8
|
#include <string>
|
|
9
9
|
|
|
10
|
-
static NSString *
|
|
10
|
+
static NSString *DaroRNFabricSetterNameForKey(NSString *key)
|
|
11
11
|
{
|
|
12
12
|
if (key.length == 0) {
|
|
13
13
|
return nil;
|
|
@@ -18,9 +18,9 @@ static NSString *DaroMFabricSetterNameForKey(NSString *key)
|
|
|
18
18
|
return [NSString stringWithFormat:@"set%@%@:", first, rest];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
void
|
|
21
|
+
void DaroRNFabricSetValue(UIView *view, NSString *key, id value)
|
|
22
22
|
{
|
|
23
|
-
SEL setter = NSSelectorFromString(
|
|
23
|
+
SEL setter = NSSelectorFromString(DaroRNFabricSetterNameForKey(key));
|
|
24
24
|
if (![view respondsToSelector:setter]) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -28,7 +28,7 @@ void DaroMFabricSetValue(UIView *view, NSString *key, id value)
|
|
|
28
28
|
[view setValue:value forKey:key];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
void
|
|
31
|
+
void DaroRNFabricPerformSelector(UIView *view, SEL selector)
|
|
32
32
|
{
|
|
33
33
|
if (![view respondsToSelector:selector]) {
|
|
34
34
|
return;
|
|
@@ -39,7 +39,7 @@ void DaroMFabricPerformSelector(UIView *view, SEL selector)
|
|
|
39
39
|
function(view, selector);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
void
|
|
42
|
+
void DaroRNFabricPerformSelectorWithObject(UIView *view, SEL selector, id object)
|
|
43
43
|
{
|
|
44
44
|
if (![view respondsToSelector:selector]) {
|
|
45
45
|
return;
|
|
@@ -50,7 +50,7 @@ void DaroMFabricPerformSelectorWithObject(UIView *view, SEL selector, id object)
|
|
|
50
50
|
function(view, selector, object);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
void
|
|
53
|
+
void DaroRNFabricPerformSelectorWithTwoObjects(UIView *view, SEL selector, id firstObject, id secondObject)
|
|
54
54
|
{
|
|
55
55
|
if (![view respondsToSelector:selector]) {
|
|
56
56
|
return;
|
|
@@ -61,7 +61,7 @@ void DaroMFabricPerformSelectorWithTwoObjects(UIView *view, SEL selector, id fir
|
|
|
61
61
|
function(view, selector, firstObject, secondObject);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
UIView *
|
|
64
|
+
UIView *DaroRNFabricCreateSwiftView(NSString *className)
|
|
65
65
|
{
|
|
66
66
|
Class viewClass = NSClassFromString(className);
|
|
67
67
|
if (![viewClass isSubclassOfClass:UIView.class]) {
|
|
@@ -72,12 +72,12 @@ UIView *DaroMFabricCreateSwiftView(NSString *className)
|
|
|
72
72
|
return [[viewClass alloc] init];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
NSString *
|
|
75
|
+
NSString *DaroRNFabricNSStringFromStdString(const std::string &value)
|
|
76
76
|
{
|
|
77
77
|
return [NSString stringWithUTF8String:value.c_str()];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
static id
|
|
80
|
+
static id DaroRNFabricNSObjectFromDynamic(const folly::dynamic &value)
|
|
81
81
|
{
|
|
82
82
|
switch (value.type()) {
|
|
83
83
|
case folly::dynamic::NULLT:
|
|
@@ -93,7 +93,7 @@ static id DaroMFabricNSObjectFromDynamic(const folly::dynamic &value)
|
|
|
93
93
|
case folly::dynamic::ARRAY: {
|
|
94
94
|
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:value.size()];
|
|
95
95
|
for (const auto &item : value) {
|
|
96
|
-
id converted =
|
|
96
|
+
id converted = DaroRNFabricNSObjectFromDynamic(item);
|
|
97
97
|
if (converted != nil) {
|
|
98
98
|
[array addObject:converted];
|
|
99
99
|
}
|
|
@@ -103,8 +103,8 @@ static id DaroMFabricNSObjectFromDynamic(const folly::dynamic &value)
|
|
|
103
103
|
case folly::dynamic::OBJECT: {
|
|
104
104
|
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:value.size()];
|
|
105
105
|
for (const auto &item : value.items()) {
|
|
106
|
-
id key =
|
|
107
|
-
id converted =
|
|
106
|
+
id key = DaroRNFabricNSObjectFromDynamic(item.first);
|
|
107
|
+
id converted = DaroRNFabricNSObjectFromDynamic(item.second);
|
|
108
108
|
if (key != nil && converted != nil && [key conformsToProtocol:@protocol(NSCopying)]) {
|
|
109
109
|
dictionary[key] = converted;
|
|
110
110
|
}
|
|
@@ -114,9 +114,9 @@ static id DaroMFabricNSObjectFromDynamic(const folly::dynamic &value)
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
id
|
|
117
|
+
id DaroRNFabricIdFromDynamic(const folly::dynamic &value)
|
|
118
118
|
{
|
|
119
|
-
id converted =
|
|
119
|
+
id converted = DaroRNFabricNSObjectFromDynamic(value);
|
|
120
120
|
return converted == (id)kCFNull ? nil : converted;
|
|
121
121
|
}
|
|
122
122
|
|