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.
Files changed (146) hide show
  1. package/README.md +2 -5
  2. package/android/build.gradle +6 -13
  3. package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
  4. package/android/src/main/java/com/daro/reactnative/{DaroMAdNativeViewManager.kt → DaroRNAdNativeViewManager.kt} +34 -38
  5. package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +376 -0
  6. package/android/src/main/java/com/daro/reactnative/{DaroMPackage.kt → DaroRNPackage.kt} +7 -7
  7. package/android/src/main/java/com/daro/reactnative/DaroSdkBridge.kt +52 -0
  8. package/android/src/main/java/com/daro/reactnative/constants/{InternalDaroMBannerSize.kt → InternalDaroRNBannerSize.kt} +2 -2
  9. package/android/src/main/java/com/daro/reactnative/event/{DaroMEvent.kt → DaroRNEvent.kt} +6 -6
  10. package/android/src/main/java/com/daro/reactnative/impl/{DaroMBannerViewModuleImpl.kt → DaroRNBannerViewModuleImpl.kt} +3 -3
  11. package/android/src/main/java/com/daro/reactnative/impl/{DaroMInterstitialModuleImpl.kt → DaroRNInterstitialModuleImpl.kt} +4 -4
  12. package/android/src/main/java/com/daro/reactnative/impl/{DaroMLightPopupModuleImpl.kt → DaroRNLightPopupModuleImpl.kt} +4 -4
  13. package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
  14. package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +12 -0
  15. package/android/src/main/java/com/daro/reactnative/util/DaroQaProbe.kt +147 -0
  16. package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +2 -2
  17. package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
  18. package/android/src/main/java/com/daro/reactnative/view/{DaroMAdNativeViewContainer.kt → DaroRNAdNativeViewContainer.kt} +3 -4
  19. package/android/src/newarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +1 -1
  20. package/android/src/oldarch/java/com/daro/reactnative/{DaroMModuleSpec.kt → DaroRNModuleSpec.kt} +32 -3
  21. package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +10 -11
  22. package/ios/DaroRNModule+Consent.swift +88 -0
  23. package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +9 -9
  24. package/ios/{DaroMModule+LightPopup.swift → DaroRNModule+LightPopup.swift} +2 -2
  25. package/ios/DaroRNModule+Qa.swift +158 -0
  26. package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +10 -10
  27. package/ios/{DaroMModule.mm → DaroRNModule.mm} +19 -4
  28. package/ios/{DaroMModule.swift → DaroRNModule.swift} +20 -6
  29. package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
  30. package/ios/Fabric/{DaroMFabricEventSink.mm → DaroRNFabricEventSink.mm} +4 -4
  31. package/ios/Fabric/{DaroMFabricPropApplier.mm → DaroRNFabricPropApplier.mm} +14 -14
  32. package/ios/Fabric/DaroRNNativeAdComponentView.mm +306 -0
  33. package/ios/Paper/{DaroMAdBannerViewManager.m → DaroRNAdBannerViewManager.m} +1 -1
  34. package/ios/Paper/{DaroMAdBannerViewManager.swift → DaroRNAdBannerViewManager.swift} +5 -5
  35. package/ios/Paper/{DaroMNativeAdViewManager.m → DaroRNNativeAdViewManager.m} +1 -1
  36. package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
  37. package/ios/Shared/DaroMediationDebugger.swift +14 -0
  38. package/ios/Shared/{DaroMAdEventSink.swift → DaroRNAdEventSink.swift} +1 -1
  39. package/ios/Shared/{DaroMBannerAdView.swift → DaroRNBannerAdView.swift} +11 -11
  40. package/ios/Shared/{DaroMNativeAdLoadCoordinator.swift → DaroRNNativeAdLoadCoordinator.swift} +4 -4
  41. package/ios/Shared/{DaroMNativeAdView.swift → DaroRNNativeAdView.swift} +21 -21
  42. package/ios/Shared/{DaroMNativeAssetResolver.swift → DaroRNNativeAssetResolver.swift} +6 -6
  43. package/lib/commonjs/AdBannerView.js +3 -5
  44. package/lib/commonjs/AdBannerView.js.map +1 -1
  45. package/lib/commonjs/AppOpenAd.js +4 -4
  46. package/lib/commonjs/AppOpenAd.js.map +1 -1
  47. package/lib/commonjs/{DaroMAdBannerViewNativeComponent.ts → DaroRNAdBannerViewNativeComponent.ts} +5 -2
  48. package/{src/DaroMNativeAdViewNativeComponent.ts → lib/commonjs/DaroRNNativeAdViewNativeComponent.ts} +5 -2
  49. package/lib/commonjs/NativeDaroModule.js +1 -1
  50. package/lib/commonjs/NativeDaroModule.js.map +1 -1
  51. package/lib/commonjs/index.js +121 -0
  52. package/lib/commonjs/index.js.map +1 -1
  53. package/lib/commonjs/nativeAd/NativeAdView.js +3 -3
  54. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  55. package/lib/module/AdBannerView.js +1 -3
  56. package/lib/module/AdBannerView.js.map +1 -1
  57. package/lib/module/AppOpenAd.js +4 -4
  58. package/lib/module/AppOpenAd.js.map +1 -1
  59. package/{src/DaroMAdBannerViewNativeComponent.ts → lib/module/DaroRNAdBannerViewNativeComponent.ts} +5 -2
  60. package/lib/{commonjs/DaroMNativeAdViewNativeComponent.ts → module/DaroRNNativeAdViewNativeComponent.ts} +5 -2
  61. package/lib/module/NativeDaroModule.js +1 -1
  62. package/lib/module/NativeDaroModule.js.map +1 -1
  63. package/lib/module/index.js +101 -0
  64. package/lib/module/index.js.map +1 -1
  65. package/lib/module/nativeAd/NativeAdView.js +1 -1
  66. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  67. package/lib/typescript/commonjs/plugin/src/index.d.ts +2 -6
  68. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +2 -6
  70. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/plugin/src/withIos.d.ts +2 -6
  72. package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +2 -2
  75. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
  77. package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +3 -2
  79. package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +10 -1
  81. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/src/index.d.ts +79 -0
  83. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/types/AdInfo.d.ts +15 -0
  85. package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/src/types/AdProps.d.ts +0 -1
  87. package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
  88. package/lib/typescript/module/plugin/src/index.d.ts +2 -6
  89. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
  90. package/lib/typescript/module/plugin/src/withAndroid.d.ts +2 -6
  91. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
  92. package/lib/typescript/module/plugin/src/withIos.d.ts +2 -6
  93. package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
  94. package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
  95. package/lib/typescript/module/src/AppOpenAd.d.ts +2 -2
  96. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  97. package/lib/typescript/module/src/{DaroMAdBannerViewNativeComponent.d.ts → DaroRNAdBannerViewNativeComponent.d.ts} +3 -2
  98. package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  99. package/lib/typescript/module/src/{DaroMNativeAdViewNativeComponent.d.ts → DaroRNNativeAdViewNativeComponent.d.ts} +3 -2
  100. package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  101. package/lib/typescript/module/src/NativeDaroModule.d.ts +10 -1
  102. package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -1
  103. package/lib/typescript/module/src/index.d.ts +79 -0
  104. package/lib/typescript/module/src/index.d.ts.map +1 -1
  105. package/lib/typescript/module/src/types/AdInfo.d.ts +15 -0
  106. package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
  107. package/lib/typescript/module/src/types/AdProps.d.ts +0 -1
  108. package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
  109. package/package.json +3 -3
  110. package/plugin/build/index.d.ts +2 -6
  111. package/plugin/build/index.js +21 -56
  112. package/plugin/build/withAndroid.d.ts +2 -6
  113. package/plugin/build/withAndroid.js +48 -90
  114. package/plugin/build/withIos.d.ts +2 -6
  115. package/plugin/build/withIos.js +37 -33
  116. package/react-native-daro.podspec +2 -3
  117. package/src/AdBannerView.tsx +1 -3
  118. package/src/AppOpenAd.ts +2 -8
  119. package/{lib/module/DaroMAdBannerViewNativeComponent.ts → src/DaroRNAdBannerViewNativeComponent.ts} +5 -2
  120. package/{lib/module/DaroMNativeAdViewNativeComponent.ts → src/DaroRNNativeAdViewNativeComponent.ts} +5 -2
  121. package/src/NativeDaroModule.ts +17 -2
  122. package/src/index.tsx +136 -0
  123. package/src/nativeAd/NativeAdView.tsx +1 -1
  124. package/src/types/AdInfo.ts +17 -0
  125. package/src/types/AdProps.ts +0 -2
  126. package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
  127. package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -155
  128. package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -257
  129. package/ios/Fabric/DaroMAdBannerComponentView.mm +0 -207
  130. package/ios/Fabric/DaroMNativeAdComponentView.mm +0 -294
  131. package/ios/Paper/DaroMNativeAdViewManager.swift +0 -22
  132. package/ios/mediation/admob/DaroMediationDebugger.swift +0 -11
  133. package/lib/commonjs/types/DaroMMobileAds.js +0 -2
  134. package/lib/commonjs/types/DaroMMobileAds.js.map +0 -1
  135. package/lib/module/types/DaroMMobileAds.js +0 -2
  136. package/lib/module/types/DaroMMobileAds.js.map +0 -1
  137. package/lib/typescript/commonjs/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
  138. package/lib/typescript/commonjs/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
  139. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts +0 -6
  140. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +0 -1
  141. package/lib/typescript/module/src/DaroMAdBannerViewNativeComponent.d.ts.map +0 -1
  142. package/lib/typescript/module/src/DaroMNativeAdViewNativeComponent.d.ts.map +0 -1
  143. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts +0 -6
  144. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +0 -1
  145. package/src/types/DaroMMobileAds.ts +0 -5
  146. /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 *DaroMFabricSetterNameForKey(NSString *key)
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 DaroMFabricSetValue(UIView *view, NSString *key, id value)
21
+ void DaroRNFabricSetValue(UIView *view, NSString *key, id value)
22
22
  {
23
- SEL setter = NSSelectorFromString(DaroMFabricSetterNameForKey(key));
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 DaroMFabricPerformSelector(UIView *view, SEL selector)
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 DaroMFabricPerformSelectorWithObject(UIView *view, SEL selector, id object)
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 DaroMFabricPerformSelectorWithTwoObjects(UIView *view, SEL selector, id firstObject, id secondObject)
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 *DaroMFabricCreateSwiftView(NSString *className)
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 *DaroMFabricNSStringFromStdString(const std::string &value)
75
+ NSString *DaroRNFabricNSStringFromStdString(const std::string &value)
76
76
  {
77
77
  return [NSString stringWithUTF8String:value.c_str()];
78
78
  }
79
79
 
80
- static id DaroMFabricNSObjectFromDynamic(const folly::dynamic &value)
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 = DaroMFabricNSObjectFromDynamic(item);
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 = DaroMFabricNSObjectFromDynamic(item.first);
107
- id converted = DaroMFabricNSObjectFromDynamic(item.second);
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 DaroMFabricIdFromDynamic(const folly::dynamic &value)
117
+ id DaroRNFabricIdFromDynamic(const folly::dynamic &value)
118
118
  {
119
- id converted = DaroMFabricNSObjectFromDynamic(value);
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(DaroMAdBannerViewManager, RCTViewManager)
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(DaroMAdBannerViewManager)
4
- class DaroMAdBannerViewManager: RCTViewManager {
5
- override func view() -> DaroMAdBannerView {
6
- DaroMAdBannerView()
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? DaroMAdBannerView {
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 (DaroMNativeAdViewManager, RCTViewManager)
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,6 +1,6 @@
1
1
  import React
2
2
 
3
- final class DaroMAdEventSink {
3
+ final class DaroRNAdEventSink {
4
4
  var onAdLoadedEvent: RCTDirectEventBlock?
5
5
  var onAdLoadFailedEvent: RCTDirectEventBlock?
6
6
  var onAdClickedEvent: RCTDirectEventBlock?
@@ -1,21 +1,21 @@
1
1
  import React
2
2
  import UIKit
3
3
 
4
- private enum DaroMBannerLoadRequest: Equatable {
4
+ private enum DaroRNBannerLoadRequest: Equatable {
5
5
  case automatic
6
6
  case explicit
7
7
  }
8
8
 
9
- @objc(DaroMAdBannerView)
10
- final class DaroMAdBannerView: UIView {
9
+ @objc(DaroRNAdBannerView)
10
+ final class DaroRNAdBannerView: UIView {
11
11
 
12
12
  var adBannerView: DaroAdBannerView?
13
- private let eventSink = DaroMAdEventSink()
13
+ private let eventSink = DaroRNAdEventSink()
14
14
  private var hasRequestedInitialLoad = false
15
- private var pendingLoadRequest: DaroMBannerLoadRequest?
15
+ private var pendingLoadRequest: DaroRNBannerLoadRequest?
16
16
 
17
17
  @objc var adUnitId: String?
18
- @objc var adFormat: String = DaroMModule.Constants.bannerAdFormatLabel.value
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
- DaroMModule.logger.warning("AdUnitId is required")
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 = DaroMModule.Constants.bannerAdFormatLabel.value
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: DaroMBannerLoadRequest) {
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
- DaroMModule.logger.warning("AdUnitId is required")
104
+ DaroRNModule.logger.warning("AdUnitId is required")
105
105
  return
106
106
  }
107
107
 
108
- let bannerSize = adFormat == DaroMModule.Constants.bannerAdFormatLabel.value ? DaroAdBannerSize.banner : DaroAdBannerSize.MREC
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)
@@ -1,12 +1,12 @@
1
1
  import Foundation
2
2
 
3
- enum DaroMNativeAdLoadRequest: Equatable {
3
+ enum DaroRNNativeAdLoadRequest: Equatable {
4
4
  case automatic
5
5
  case explicit
6
6
  }
7
7
 
8
- final class DaroMNativeAdLoadCoordinator {
9
- private var pendingRequest: DaroMNativeAdLoadRequest?
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) -> DaroMNativeAdLoadRequest? {
30
+ func consumePendingLoad(loadOnMount: Bool) -> DaroRNNativeAdLoadRequest? {
31
31
  guard let pendingRequest else { return nil }
32
32
 
33
33
  if pendingRequest == .automatic {