react-native-daro 1.0.16 → 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 +6 -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 +376 -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} +6 -6
- 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 +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} +3 -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} +32 -3
- 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/{DaroMModule+LightPopup.swift → DaroRNModule+LightPopup.swift} +2 -2
- package/ios/DaroRNModule+Qa.swift +158 -0
- package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +10 -10
- package/ios/{DaroMModule.mm → DaroRNModule.mm} +19 -4
- package/ios/{DaroMModule.swift → DaroRNModule.swift} +20 -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 +306 -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} +1 -1
- package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
- package/ios/Shared/DaroMediationDebugger.swift +14 -0
- package/ios/Shared/{DaroMAdEventSink.swift → DaroRNAdEventSink.swift} +1 -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} +21 -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} +5 -2
- package/lib/commonjs/NativeDaroModule.js +1 -1
- package/lib/commonjs/NativeDaroModule.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 +3 -3
- package/lib/commonjs/nativeAd/NativeAdView.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} +5 -2
- package/lib/module/NativeDaroModule.js +1 -1
- package/lib/module/NativeDaroModule.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 +1 -1
- package/lib/module/nativeAd/NativeAdView.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} +3 -2
- package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +10 -1
- package/lib/typescript/commonjs/src/NativeDaroModule.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/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/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} +3 -2
- package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeDaroModule.d.ts +10 -1
- package/lib/typescript/module/src/NativeDaroModule.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/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/package.json +3 -3
- 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} +5 -2
- package/src/NativeDaroModule.ts +17 -2
- package/src/index.tsx +136 -0
- package/src/nativeAd/NativeAdView.tsx +1 -1
- package/src/types/AdInfo.ts +17 -0
- package/src/types/AdProps.ts +0 -2
- 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/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
|
@@ -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
|
|
|
@@ -0,0 +1,306 @@
|
|
|
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 void DaroRNFabricPerformSelectorWithTwoObjects(UIView *view, SEL selector, id firstObject, id secondObject);
|
|
22
|
+
extern NSString *DaroRNFabricNSStringFromStdString(const std::string &value);
|
|
23
|
+
extern id DaroRNFabricIdFromDynamic(const folly::dynamic &value);
|
|
24
|
+
extern NSDictionary *DaroRNFabricEventBody(NSDictionary *body);
|
|
25
|
+
extern std::string DaroRNFabricEventString(NSDictionary *body, NSString *key);
|
|
26
|
+
extern double DaroRNFabricEventDouble(NSDictionary *body, NSString *key);
|
|
27
|
+
extern int DaroRNFabricEventInt(NSDictionary *body, NSString *key);
|
|
28
|
+
|
|
29
|
+
static NSString *DaroRNFabricAdChoicesPositionString(DaroRNNativeAdViewAdChoicesPosition position)
|
|
30
|
+
{
|
|
31
|
+
switch (position) {
|
|
32
|
+
case DaroRNNativeAdViewAdChoicesPosition::TopLeft:
|
|
33
|
+
return @"topLeft";
|
|
34
|
+
case DaroRNNativeAdViewAdChoicesPosition::TopRight:
|
|
35
|
+
return @"topRight";
|
|
36
|
+
case DaroRNNativeAdViewAdChoicesPosition::BottomLeft:
|
|
37
|
+
return @"bottomLeft";
|
|
38
|
+
case DaroRNNativeAdViewAdChoicesPosition::BottomRight:
|
|
39
|
+
default:
|
|
40
|
+
return @"bottomRight";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@interface DaroRNNativeAdViewComponentView : RCTViewComponentView <RCTDaroRNNativeAdViewViewProtocol>
|
|
45
|
+
@end
|
|
46
|
+
|
|
47
|
+
@implementation DaroRNNativeAdViewComponentView {
|
|
48
|
+
UIView *_nativeAdView;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
+ (void)load
|
|
52
|
+
{
|
|
53
|
+
[super load];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
57
|
+
{
|
|
58
|
+
if (self = [super initWithFrame:frame]) {
|
|
59
|
+
static const auto defaultProps = std::make_shared<const DaroRNNativeAdViewProps>();
|
|
60
|
+
_props = defaultProps;
|
|
61
|
+
[self createNativeAdView];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return self;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)createNativeAdView
|
|
68
|
+
{
|
|
69
|
+
_nativeAdView = DaroRNFabricCreateSwiftView(@"RNDaroRNNativeAdView");
|
|
70
|
+
_nativeAdView.frame = self.bounds;
|
|
71
|
+
_nativeAdView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
72
|
+
DaroRNFabricPerformSelectorWithObject(_nativeAdView, NSSelectorFromString(@"setAssetSearchRootView:"), _nativeAdView);
|
|
73
|
+
[self addSubview:_nativeAdView];
|
|
74
|
+
[self installEventHandlers];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)installEventHandlers
|
|
78
|
+
{
|
|
79
|
+
__weak DaroRNNativeAdViewComponentView *weakSelf = self;
|
|
80
|
+
|
|
81
|
+
RCTDirectEventBlock onAdLoadedEvent = ^(NSDictionary *body) {
|
|
82
|
+
DaroRNNativeAdViewComponentView *strongSelf = weakSelf;
|
|
83
|
+
if (!strongSelf) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNNativeAdViewEventEmitter>(strongSelf->_eventEmitter);
|
|
88
|
+
if (!eventEmitter) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
93
|
+
eventEmitter->onAdLoadedEvent({
|
|
94
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
95
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
96
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
97
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
98
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
99
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
RCTDirectEventBlock onAdLoadFailedEvent = ^(NSDictionary *body) {
|
|
104
|
+
DaroRNNativeAdViewComponentView *strongSelf = weakSelf;
|
|
105
|
+
if (!strongSelf) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNNativeAdViewEventEmitter>(strongSelf->_eventEmitter);
|
|
110
|
+
if (!eventEmitter) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
115
|
+
eventEmitter->onAdLoadFailedEvent({
|
|
116
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
117
|
+
.code = DaroRNFabricEventInt(eventBody, @"code"),
|
|
118
|
+
.message = DaroRNFabricEventString(eventBody, @"message"),
|
|
119
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
RCTDirectEventBlock onAdClickedEvent = ^(NSDictionary *body) {
|
|
124
|
+
DaroRNNativeAdViewComponentView *strongSelf = weakSelf;
|
|
125
|
+
if (!strongSelf) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNNativeAdViewEventEmitter>(strongSelf->_eventEmitter);
|
|
130
|
+
if (!eventEmitter) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
135
|
+
eventEmitter->onAdClickedEvent({
|
|
136
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
137
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
138
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
139
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
140
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
141
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
RCTDirectEventBlock onAdImpressionRecordedEvent = ^(NSDictionary *body) {
|
|
146
|
+
DaroRNNativeAdViewComponentView *strongSelf = weakSelf;
|
|
147
|
+
if (!strongSelf) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
auto eventEmitter = std::static_pointer_cast<const DaroRNNativeAdViewEventEmitter>(strongSelf->_eventEmitter);
|
|
152
|
+
if (!eventEmitter) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
NSDictionary *eventBody = DaroRNFabricEventBody(body);
|
|
157
|
+
eventEmitter->onAdImpressionRecordedEvent({
|
|
158
|
+
.adUnitId = DaroRNFabricEventString(eventBody, @"adUnitId"),
|
|
159
|
+
.latencyMillis = DaroRNFabricEventDouble(eventBody, @"latencyMillis"),
|
|
160
|
+
// Fabric 이벤트는 타입 있는 구조체다 — **여기 안 적으면 네이티브가 보내도 JS 에 안 온다.**
|
|
161
|
+
// Android 는 맵을 통째로 넘겨서 안 걸린다. codegen 타입만 넓히면 부족하다.
|
|
162
|
+
.mediationPlatform = DaroRNFabricEventString(eventBody, @"mediationPlatform"),
|
|
163
|
+
.adNetwork = DaroRNFabricEventString(eventBody, @"adNetwork"),
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdLoadedEvent", onAdLoadedEvent);
|
|
168
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdLoadFailedEvent", onAdLoadFailedEvent);
|
|
169
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdClickedEvent", onAdClickedEvent);
|
|
170
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdImpressionRecordedEvent", onAdImpressionRecordedEvent);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
174
|
+
{
|
|
175
|
+
return concreteComponentDescriptorProvider<DaroRNNativeAdViewComponentDescriptor>();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
179
|
+
{
|
|
180
|
+
const auto &oldComponentProps = *std::static_pointer_cast<const DaroRNNativeAdViewProps>(_props);
|
|
181
|
+
const auto &newComponentProps = *std::static_pointer_cast<const DaroRNNativeAdViewProps>(props);
|
|
182
|
+
NSMutableArray<NSString *> *changedProps = [NSMutableArray new];
|
|
183
|
+
|
|
184
|
+
if (oldComponentProps.adUnitId != newComponentProps.adUnitId) {
|
|
185
|
+
DaroRNFabricSetValue(_nativeAdView, @"adUnitId", DaroRNFabricNSStringFromStdString(newComponentProps.adUnitId));
|
|
186
|
+
[changedProps addObject:@"adUnitId"];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (oldComponentProps.loadOnMount != newComponentProps.loadOnMount) {
|
|
190
|
+
DaroRNFabricSetValue(_nativeAdView, @"loadOnMount", @(newComponentProps.loadOnMount));
|
|
191
|
+
[changedProps addObject:@"loadOnMount"];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (oldComponentProps.adChoicesPosition != newComponentProps.adChoicesPosition) {
|
|
195
|
+
DaroRNFabricSetValue(
|
|
196
|
+
_nativeAdView, @"adChoicesPosition", DaroRNFabricAdChoicesPositionString(newComponentProps.adChoicesPosition));
|
|
197
|
+
[changedProps addObject:@"adChoicesPosition"];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (oldComponentProps.titleView != newComponentProps.titleView) {
|
|
201
|
+
DaroRNFabricSetValue(_nativeAdView, @"titleView", @(newComponentProps.titleView));
|
|
202
|
+
[changedProps addObject:@"titleView"];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (oldComponentProps.bodyView != newComponentProps.bodyView) {
|
|
206
|
+
DaroRNFabricSetValue(_nativeAdView, @"bodyView", @(newComponentProps.bodyView));
|
|
207
|
+
[changedProps addObject:@"bodyView"];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (oldComponentProps.callToActionView != newComponentProps.callToActionView) {
|
|
211
|
+
DaroRNFabricSetValue(_nativeAdView, @"callToActionView", @(newComponentProps.callToActionView));
|
|
212
|
+
[changedProps addObject:@"callToActionView"];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (oldComponentProps.iconView != newComponentProps.iconView) {
|
|
216
|
+
DaroRNFabricSetValue(_nativeAdView, @"iconView", @(newComponentProps.iconView));
|
|
217
|
+
[changedProps addObject:@"iconView"];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (oldComponentProps.mediaView != newComponentProps.mediaView) {
|
|
221
|
+
DaroRNFabricSetValue(_nativeAdView, @"mediaView", @(newComponentProps.mediaView));
|
|
222
|
+
[changedProps addObject:@"mediaView"];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (oldComponentProps.titleViewStyleProps != newComponentProps.titleViewStyleProps) {
|
|
226
|
+
DaroRNFabricSetValue(_nativeAdView, @"titleViewStyleProps", DaroRNFabricIdFromDynamic(newComponentProps.titleViewStyleProps));
|
|
227
|
+
[changedProps addObject:@"titleViewStyleProps"];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (oldComponentProps.bodyViewStyleProps != newComponentProps.bodyViewStyleProps) {
|
|
231
|
+
DaroRNFabricSetValue(_nativeAdView, @"bodyViewStyleProps", DaroRNFabricIdFromDynamic(newComponentProps.bodyViewStyleProps));
|
|
232
|
+
[changedProps addObject:@"bodyViewStyleProps"];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (oldComponentProps.callToActionViewStyleProps != newComponentProps.callToActionViewStyleProps) {
|
|
236
|
+
DaroRNFabricSetValue(
|
|
237
|
+
_nativeAdView, @"callToActionViewStyleProps", DaroRNFabricIdFromDynamic(newComponentProps.callToActionViewStyleProps));
|
|
238
|
+
[changedProps addObject:@"callToActionViewStyleProps"];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (oldComponentProps.iconViewStyleProps != newComponentProps.iconViewStyleProps) {
|
|
242
|
+
DaroRNFabricSetValue(_nativeAdView, @"iconViewStyleProps", DaroRNFabricIdFromDynamic(newComponentProps.iconViewStyleProps));
|
|
243
|
+
[changedProps addObject:@"iconViewStyleProps"];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (oldComponentProps.mediaViewStyleProps != newComponentProps.mediaViewStyleProps) {
|
|
247
|
+
DaroRNFabricSetValue(_nativeAdView, @"mediaViewStyleProps", DaroRNFabricIdFromDynamic(newComponentProps.mediaViewStyleProps));
|
|
248
|
+
[changedProps addObject:@"mediaViewStyleProps"];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
[super updateProps:props oldProps:oldProps];
|
|
252
|
+
|
|
253
|
+
DaroRNFabricPerformSelectorWithObject(_nativeAdView, NSSelectorFromString(@"applyReactProps:"), changedProps);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
257
|
+
{
|
|
258
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
259
|
+
_nativeAdView.frame = self.bounds;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
263
|
+
{
|
|
264
|
+
DaroRNFabricPerformSelectorWithTwoObjects(
|
|
265
|
+
_nativeAdView, NSSelectorFromString(@"insertMountedSubview:atIndex:"), childComponentView, @(index));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
269
|
+
{
|
|
270
|
+
[childComponentView removeFromSuperview];
|
|
271
|
+
DaroRNFabricPerformSelector(_nativeAdView, NSSelectorFromString(@"refreshMountedAssetViews"));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
- (void)loadAd
|
|
275
|
+
{
|
|
276
|
+
DaroRNFabricPerformSelector(_nativeAdView, NSSelectorFromString(@"loadAd"));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
280
|
+
{
|
|
281
|
+
RCTDaroRNNativeAdViewHandleCommand(self, commandName, args);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
- (void)prepareForRecycle
|
|
285
|
+
{
|
|
286
|
+
[super prepareForRecycle];
|
|
287
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdLoadedEvent", nil);
|
|
288
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdLoadFailedEvent", nil);
|
|
289
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdClickedEvent", nil);
|
|
290
|
+
DaroRNFabricSetValue(_nativeAdView, @"onAdImpressionRecordedEvent", nil);
|
|
291
|
+
DaroRNFabricPerformSelectorWithObject(_nativeAdView, NSSelectorFromString(@"setAssetSearchRootView:"), nil);
|
|
292
|
+
DaroRNFabricPerformSelector(_nativeAdView, NSSelectorFromString(@"prepareForReuse"));
|
|
293
|
+
DaroRNFabricPerformSelectorWithObject(_nativeAdView, NSSelectorFromString(@"setAssetSearchRootView:"), _nativeAdView);
|
|
294
|
+
[self installEventHandlers];
|
|
295
|
+
static const auto defaultProps = std::make_shared<const DaroRNNativeAdViewProps>();
|
|
296
|
+
_props = defaultProps;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@end
|
|
300
|
+
|
|
301
|
+
Class<RCTComponentViewProtocol> DaroRNNativeAdViewCls(void)
|
|
302
|
+
{
|
|
303
|
+
return DaroRNNativeAdViewComponentView.class;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <React/RCTViewManager.h>
|
|
2
2
|
|
|
3
|
-
@interface RCT_EXTERN_MODULE(
|
|
3
|
+
@interface RCT_EXTERN_MODULE(DaroRNAdBannerViewManager, RCTViewManager)
|
|
4
4
|
|
|
5
5
|
RCT_EXPORT_VIEW_PROPERTY(adUnitId, NSString)
|
|
6
6
|
RCT_EXPORT_VIEW_PROPERTY(adFormat, NSString)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React
|
|
2
2
|
|
|
3
|
-
@objc(
|
|
4
|
-
class
|
|
5
|
-
override func view() ->
|
|
6
|
-
|
|
3
|
+
@objc(DaroRNAdBannerViewManager)
|
|
4
|
+
class DaroRNAdBannerViewManager: RCTViewManager {
|
|
5
|
+
override func view() -> DaroRNAdBannerView {
|
|
6
|
+
DaroRNAdBannerView()
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
@@ -13,7 +13,7 @@ class DaroMAdBannerViewManager: RCTViewManager {
|
|
|
13
13
|
@objc(loadAd:)
|
|
14
14
|
func loadAd(viewTag: NSNumber) {
|
|
15
15
|
bridge?.uiManager.addUIBlock({ _, viewRegistry in
|
|
16
|
-
if let view = viewRegistry?[viewTag] as?
|
|
16
|
+
if let view = viewRegistry?[viewTag] as? DaroRNAdBannerView {
|
|
17
17
|
view.loadAd()
|
|
18
18
|
}
|
|
19
19
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <React/RCTViewManager.h>
|
|
2
2
|
|
|
3
|
-
@interface RCT_EXTERN_MODULE (
|
|
3
|
+
@interface RCT_EXTERN_MODULE (DaroRNNativeAdViewManager, RCTViewManager)
|
|
4
4
|
|
|
5
5
|
RCT_EXPORT_VIEW_PROPERTY(adUnitId, NSString)
|
|
6
6
|
RCT_EXPORT_VIEW_PROPERTY(loadOnMount, BOOL)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
@objc(DaroRNNativeAdViewManager)
|
|
5
|
+
class DaroRNNativeAdViewManager: RCTViewManager {
|
|
6
|
+
override func view() -> RNDaroRNNativeAdView {
|
|
7
|
+
RNDaroRNNativeAdView(assetResolver: DaroRNBridgeNativeAssetResolver(bridge: bridge))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
11
|
+
false
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@objc(loadAd:)
|
|
15
|
+
func loadAd(viewTag: NSNumber) {
|
|
16
|
+
bridge?.uiManager.addUIBlock({ _, viewRegistry in
|
|
17
|
+
if let view = viewRegistry?[viewTag] as? RNDaroRNNativeAdView {
|
|
18
|
+
view.loadAd()
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Dispatch
|
|
2
|
+
import GoogleMobileAds
|
|
3
|
+
|
|
4
|
+
// 통합 Daro 바이너리에는 미디에이션 디버거 API 가 없다 — Android 의
|
|
5
|
+
// droom.daro.sdk.Daro.openDebugger 에 대응하는 심볼이 iOS 에는 아직 없다(DARO-1390).
|
|
6
|
+
// 그때까지 AdMob Ad Inspector 를 직접 연다. SDK 에 대응이 생기면 이 파일을 교체한다.
|
|
7
|
+
enum DaroMediationDebugger {
|
|
8
|
+
static func show(resolve: @escaping () -> Void) {
|
|
9
|
+
DispatchQueue.main.async {
|
|
10
|
+
MobileAds.shared.presentAdInspector(from: nil) { _ in }
|
|
11
|
+
resolve()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React
|
|
2
2
|
import UIKit
|
|
3
3
|
|
|
4
|
-
private enum
|
|
4
|
+
private enum DaroRNBannerLoadRequest: Equatable {
|
|
5
5
|
case automatic
|
|
6
6
|
case explicit
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
@objc(
|
|
10
|
-
final class
|
|
9
|
+
@objc(DaroRNAdBannerView)
|
|
10
|
+
final class DaroRNAdBannerView: UIView {
|
|
11
11
|
|
|
12
12
|
var adBannerView: DaroAdBannerView?
|
|
13
|
-
private let eventSink =
|
|
13
|
+
private let eventSink = DaroRNAdEventSink()
|
|
14
14
|
private var hasRequestedInitialLoad = false
|
|
15
|
-
private var pendingLoadRequest:
|
|
15
|
+
private var pendingLoadRequest: DaroRNBannerLoadRequest?
|
|
16
16
|
|
|
17
17
|
@objc var adUnitId: String?
|
|
18
|
-
@objc var adFormat: String =
|
|
18
|
+
@objc var adFormat: String = DaroRNModule.Constants.bannerAdFormatLabel.value
|
|
19
19
|
@objc var loadOnMount: Bool = true
|
|
20
20
|
@objc var isVisible: Bool = true {
|
|
21
21
|
didSet {
|
|
@@ -57,7 +57,7 @@ final class DaroMAdBannerView: UIView {
|
|
|
57
57
|
guard let changedProps, changedProps.isEmpty == false else { return }
|
|
58
58
|
guard let adUnitId, adUnitId.isEmpty == false else {
|
|
59
59
|
if changedProps.contains("adUnitId") {
|
|
60
|
-
|
|
60
|
+
DaroRNModule.logger.warning("AdUnitId is required")
|
|
61
61
|
}
|
|
62
62
|
return
|
|
63
63
|
}
|
|
@@ -75,13 +75,13 @@ final class DaroMAdBannerView: UIView {
|
|
|
75
75
|
func prepareForReuse() {
|
|
76
76
|
resetAdState()
|
|
77
77
|
adUnitId = nil
|
|
78
|
-
adFormat =
|
|
78
|
+
adFormat = DaroRNModule.Constants.bannerAdFormatLabel.value
|
|
79
79
|
loadOnMount = true
|
|
80
80
|
isVisible = true
|
|
81
81
|
isHidden = false
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
private func requestLoad(_ request:
|
|
84
|
+
private func requestLoad(_ request: DaroRNBannerLoadRequest) {
|
|
85
85
|
initialize()
|
|
86
86
|
|
|
87
87
|
guard let adBannerView else { return }
|
|
@@ -101,11 +101,11 @@ final class DaroMAdBannerView: UIView {
|
|
|
101
101
|
return
|
|
102
102
|
}
|
|
103
103
|
guard let adUnitId, adUnitId.isEmpty == false else {
|
|
104
|
-
|
|
104
|
+
DaroRNModule.logger.warning("AdUnitId is required")
|
|
105
105
|
return
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
let bannerSize = adFormat ==
|
|
108
|
+
let bannerSize = adFormat == DaroRNModule.Constants.bannerAdFormatLabel.value ? DaroAdBannerSize.banner : DaroAdBannerSize.MREC
|
|
109
109
|
let adUnit = DaroAdUnit(unitId: adUnitId)
|
|
110
110
|
let adBannerView = DaroAdBannerView(unit: adUnit, bannerSize: bannerSize, autoLoad: false)
|
|
111
111
|
setupBannerListener(for: adBannerView)
|
package/ios/Shared/{DaroMNativeAdLoadCoordinator.swift → DaroRNNativeAdLoadCoordinator.swift}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
enum
|
|
3
|
+
enum DaroRNNativeAdLoadRequest: Equatable {
|
|
4
4
|
case automatic
|
|
5
5
|
case explicit
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
final class
|
|
9
|
-
private var pendingRequest:
|
|
8
|
+
final class DaroRNNativeAdLoadCoordinator {
|
|
9
|
+
private var pendingRequest: DaroRNNativeAdLoadRequest?
|
|
10
10
|
private var hasConsumedInitialLoad = false
|
|
11
11
|
|
|
12
12
|
var hasPendingLoad: Bool {
|
|
@@ -27,7 +27,7 @@ final class DaroMNativeAdLoadCoordinator {
|
|
|
27
27
|
pendingRequest = nil
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
func consumePendingLoad(loadOnMount: Bool) ->
|
|
30
|
+
func consumePendingLoad(loadOnMount: Bool) -> DaroRNNativeAdLoadRequest? {
|
|
31
31
|
guard let pendingRequest else { return nil }
|
|
32
32
|
|
|
33
33
|
if pendingRequest == .automatic {
|