cloudx-react-native 3.4.7 → 3.6.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/android/build.gradle +1 -1
- package/android/src/main/java/com/cloudxreactnative/CloudXAdEvents.kt +11 -5
- package/android/src/main/java/com/cloudxreactnative/CloudXAdInfo.kt +14 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdView.kt +9 -15
- package/android/src/main/java/com/cloudxreactnative/CloudXAdViewEvent.kt +1 -1
- package/android/src/main/java/com/cloudxreactnative/CloudXModuleImpl.kt +166 -0
- package/android/src/newarch/com/cloudxreactnative/CloudXModule.kt +7 -0
- package/android/src/oldarch/com/cloudxreactnative/CloudXModule.kt +7 -0
- package/cloudx-react-native.podspec +3 -3
- package/ios/CloudX.h +2 -2
- package/ios/CloudX.mm +255 -5
- package/ios/CloudXAdView.h +10 -12
- package/ios/CloudXAdView.mm +10 -15
- package/ios/CloudXAdViewManager.h +6 -6
- package/ios/CloudXAdViewManager.mm +4 -4
- package/lib/commonjs/CloudX.js +5 -1
- package/lib/commonjs/CloudX.js.map +1 -1
- package/lib/commonjs/CloudXAdViewBase.js +11 -9
- package/lib/commonjs/CloudXAdViewBase.js.map +1 -1
- package/lib/commonjs/CloudXAppOpenAd.js +98 -0
- package/lib/commonjs/CloudXAppOpenAd.js.map +1 -0
- package/lib/commonjs/CloudXBannerView.js +2 -2
- package/lib/commonjs/CloudXMRECView.js +2 -2
- package/lib/commonjs/hooks.js +81 -0
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +37 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/CloudXAdViewNativeComponent.js +1 -1
- package/lib/commonjs/specs/NativeCloudX.js.map +1 -1
- package/lib/commonjs/types/AppOpenAd.js +6 -0
- package/lib/commonjs/types/AppOpenAd.js.map +1 -0
- package/lib/commonjs/types/RevenueData.js +21 -0
- package/lib/commonjs/types/RevenueData.js.map +1 -0
- package/lib/commonjs/types/index.js +17 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/CloudX.js +5 -1
- package/lib/module/CloudX.js.map +1 -1
- package/lib/module/CloudXAdViewBase.js +11 -9
- package/lib/module/CloudXAdViewBase.js.map +1 -1
- package/lib/module/CloudXAppOpenAd.js +91 -0
- package/lib/module/CloudXAppOpenAd.js.map +1 -0
- package/lib/module/CloudXBannerView.js +2 -2
- package/lib/module/CloudXMRECView.js +2 -2
- package/lib/module/hooks.js +80 -0
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +7 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/CloudXAdViewNativeComponent.js +1 -1
- package/lib/module/specs/NativeCloudX.js.map +1 -1
- package/lib/module/types/AppOpenAd.js +2 -0
- package/lib/module/types/AppOpenAd.js.map +1 -0
- package/lib/module/types/RevenueData.js +15 -0
- package/lib/module/types/RevenueData.js.map +1 -0
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/CloudX.d.ts.map +1 -1
- package/lib/typescript/src/CloudXAdViewBase.d.ts +1 -1
- package/lib/typescript/src/CloudXAdViewBase.d.ts.map +1 -1
- package/lib/typescript/src/CloudXAppOpenAd.d.ts +4 -0
- package/lib/typescript/src/CloudXAppOpenAd.d.ts.map +1 -0
- package/lib/typescript/src/CloudXBannerView.d.ts +2 -2
- package/lib/typescript/src/CloudXMRECView.d.ts +2 -2
- package/lib/typescript/src/hooks.d.ts +14 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/specs/NativeCloudX.d.ts +13 -0
- package/lib/typescript/src/specs/NativeCloudX.d.ts.map +1 -1
- package/lib/typescript/src/types/AppOpenAd.d.ts +8 -0
- package/lib/typescript/src/types/AppOpenAd.d.ts.map +1 -0
- package/lib/typescript/src/types/CloudX.d.ts +6 -0
- package/lib/typescript/src/types/CloudX.d.ts.map +1 -1
- package/lib/typescript/src/types/RevenueData.d.ts +32 -0
- package/lib/typescript/src/types/RevenueData.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +3 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -2
- package/src/CloudX.ts +6 -0
- package/src/CloudXAdViewBase.tsx +12 -11
- package/src/CloudXAppOpenAd.ts +109 -0
- package/src/CloudXBannerView.tsx +2 -2
- package/src/CloudXMRECView.tsx +2 -2
- package/src/hooks.ts +103 -0
- package/src/index.ts +17 -2
- package/src/specs/CloudXAdViewNativeComponent.ts +1 -1
- package/src/specs/NativeCloudX.ts +22 -0
- package/src/types/AppOpenAd.ts +8 -0
- package/src/types/CloudX.ts +7 -0
- package/src/types/RevenueData.ts +39 -0
- package/src/types/index.ts +3 -0
- package/src/version.ts +1 -1
package/ios/CloudX.mm
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#import "CloudX.h"
|
|
7
7
|
#import "CloudXExtraParameters.h"
|
|
8
8
|
#import <React/RCTUtils.h>
|
|
9
|
+
#import <math.h>
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@interface UIColor (CLXUtils)
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
|
|
59
60
|
// Fullscreen ad storage — lazily created on first load/show, keyed by ad unit ID.
|
|
60
61
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, CLXInterstitial *> *interstitials;
|
|
62
|
+
@property (nonatomic, strong) NSMutableDictionary<NSString *, CLXAppOpen *> *appOpenAds;
|
|
61
63
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, CLXRewarded *> *rewardedAds;
|
|
62
64
|
|
|
63
65
|
// Overlay banner/MREC state — each ad unit ID owns exactly one CLXBannerAdView,
|
|
@@ -108,6 +110,14 @@ static NSString *const ON_INTERSTITIAL_DISPLAY_FAILED_EVENT = @"OnInterstitialD
|
|
|
108
110
|
static NSString *const ON_INTERSTITIAL_HIDDEN_EVENT = @"OnInterstitialHiddenEvent";
|
|
109
111
|
static NSString *const ON_INTERSTITIAL_AD_REVENUE_PAID = @"OnInterstitialAdRevenuePaid";
|
|
110
112
|
|
|
113
|
+
static NSString *const ON_APPOPEN_LOADED_EVENT = @"OnAppOpenLoadedEvent";
|
|
114
|
+
static NSString *const ON_APPOPEN_LOAD_FAILED_EVENT = @"OnAppOpenLoadFailedEvent";
|
|
115
|
+
static NSString *const ON_APPOPEN_CLICKED_EVENT = @"OnAppOpenClickedEvent";
|
|
116
|
+
static NSString *const ON_APPOPEN_DISPLAYED_EVENT = @"OnAppOpenDisplayedEvent";
|
|
117
|
+
static NSString *const ON_APPOPEN_DISPLAY_FAILED_EVENT = @"OnAppOpenDisplayFailedEvent";
|
|
118
|
+
static NSString *const ON_APPOPEN_HIDDEN_EVENT = @"OnAppOpenHiddenEvent";
|
|
119
|
+
static NSString *const ON_APPOPEN_AD_REVENUE_PAID = @"OnAppOpenAdRevenuePaid";
|
|
120
|
+
|
|
111
121
|
static NSString *const ON_REWARDED_AD_LOADED_EVENT = @"OnRewardedAdLoadedEvent";
|
|
112
122
|
static NSString *const ON_REWARDED_AD_LOAD_FAILED_EVENT = @"OnRewardedAdLoadFailedEvent";
|
|
113
123
|
static NSString *const ON_REWARDED_AD_CLICKED_EVENT = @"OnRewardedAdClickedEvent";
|
|
@@ -158,6 +168,7 @@ RCT_EXPORT_MODULE(CloudX)
|
|
|
158
168
|
CloudXShared = self;
|
|
159
169
|
|
|
160
170
|
self.interstitials = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
171
|
+
self.appOpenAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
161
172
|
self.rewardedAds = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
162
173
|
|
|
163
174
|
self.adViews = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
@@ -284,6 +295,20 @@ RCT_EXPORT_METHOD(arbiter:(NSDictionary<NSString *, id> *)configuration resolve:
|
|
|
284
295
|
}];
|
|
285
296
|
}
|
|
286
297
|
|
|
298
|
+
#pragma mark - Publisher-reported Revenue
|
|
299
|
+
|
|
300
|
+
RCT_EXPORT_METHOD(reportRevenueData:(NSDictionary<NSString *, id> *)data resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
301
|
+
{
|
|
302
|
+
CLXRevenueData *revenueData = [self revenueDataFromDictionary: data];
|
|
303
|
+
if ( !revenueData )
|
|
304
|
+
{
|
|
305
|
+
resolve(@(NO));
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
resolve(@([[CloudXCore shared] reportRevenueData: revenueData]));
|
|
310
|
+
}
|
|
311
|
+
|
|
287
312
|
#pragma mark - Banners
|
|
288
313
|
|
|
289
314
|
RCT_EXPORT_METHOD(createBanner:(NSString *)adUnitIdentifier position:(NSString *)bannerPosition)
|
|
@@ -474,6 +499,60 @@ RCT_EXPORT_METHOD(destroyInterstitial:(NSString *)adUnitIdentifier)
|
|
|
474
499
|
}
|
|
475
500
|
}
|
|
476
501
|
|
|
502
|
+
#pragma mark - App Open
|
|
503
|
+
|
|
504
|
+
RCT_EXPORT_METHOD(loadAppOpen:(NSString *)adUnitIdentifier)
|
|
505
|
+
{
|
|
506
|
+
[self log: @"loadAppOpen called from JS — adUnitId: %@", adUnitIdentifier];
|
|
507
|
+
CLXAppOpen *appOpen = [self retrieveAppOpenForAdUnitIdentifier: adUnitIdentifier];
|
|
508
|
+
[appOpen load];
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
RCT_EXPORT_METHOD(setAppOpenExtraParameters:(NSString *)adUnitIdentifier extraParameters:(NSDictionary<NSString *, id> *)extraParameters)
|
|
512
|
+
{
|
|
513
|
+
CLXAppOpen *appOpen = [self retrieveAppOpenForAdUnitIdentifier: adUnitIdentifier];
|
|
514
|
+
[CloudXExtraParameters applyExtraParameters: extraParameters toFullscreenAd: appOpen logBlock:^(NSString *message) {
|
|
515
|
+
[self log: @"%@", message];
|
|
516
|
+
}];
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
RCT_EXPORT_METHOD(isAppOpenReady:(NSString *)adUnitIdentifier resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
520
|
+
{
|
|
521
|
+
CLXAppOpen *appOpen = [self retrieveAppOpenForAdUnitIdentifier: adUnitIdentifier];
|
|
522
|
+
resolve(@([appOpen isReady]));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
RCT_EXPORT_METHOD(showAppOpen:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData)
|
|
526
|
+
{
|
|
527
|
+
UIViewController *vc = [self topViewController];
|
|
528
|
+
if ( !vc )
|
|
529
|
+
{
|
|
530
|
+
[self log: @"showAppOpen: no visible view controller — emitting display failure"];
|
|
531
|
+
NSDictionary *body = @{@"adUnitId": adUnitIdentifier ?: @"",
|
|
532
|
+
@"code": @(-1),
|
|
533
|
+
@"message": @"No visible view controller to present app open ad from"};
|
|
534
|
+
[self sendReactNativeEventWithName: ON_APPOPEN_DISPLAY_FAILED_EVENT body: body];
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
CLXAppOpen *appOpen = [self retrieveAppOpenForAdUnitIdentifier: adUnitIdentifier];
|
|
539
|
+
[appOpen showFromViewController: vc placement: placement customData: customData];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
RCT_EXPORT_METHOD(destroyAppOpen:(NSString *)adUnitIdentifier)
|
|
543
|
+
{
|
|
544
|
+
[self log: @"Destroying app open ad with ad unit identifier \"%@\"", adUnitIdentifier];
|
|
545
|
+
|
|
546
|
+
CLXAppOpen *appOpen = self.appOpenAds[adUnitIdentifier];
|
|
547
|
+
if ( appOpen )
|
|
548
|
+
{
|
|
549
|
+
appOpen.delegate = nil;
|
|
550
|
+
appOpen.revenueDelegate = nil;
|
|
551
|
+
[appOpen destroy];
|
|
552
|
+
[self.appOpenAds removeObjectForKey: adUnitIdentifier];
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
477
556
|
#pragma mark - Rewarded
|
|
478
557
|
|
|
479
558
|
RCT_EXPORT_METHOD(loadRewarded:(NSString *)adUnitIdentifier)
|
|
@@ -553,6 +632,10 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
553
632
|
{
|
|
554
633
|
name = ON_INTERSTITIAL_LOADED_EVENT;
|
|
555
634
|
}
|
|
635
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
636
|
+
{
|
|
637
|
+
name = ON_APPOPEN_LOADED_EVENT;
|
|
638
|
+
}
|
|
556
639
|
else if ( adFormat == CLXAdFormatRewarded )
|
|
557
640
|
{
|
|
558
641
|
name = ON_REWARDED_AD_LOADED_EVENT;
|
|
@@ -580,6 +663,11 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
580
663
|
[self sendReactNativeEventWithName: ON_INTERSTITIAL_LOAD_FAILED_EVENT
|
|
581
664
|
body: [self adLoadFailedInfoForAd: key withError: error]];
|
|
582
665
|
}
|
|
666
|
+
for ( NSString *key in self.appOpenAds )
|
|
667
|
+
{
|
|
668
|
+
[self sendReactNativeEventWithName: ON_APPOPEN_LOAD_FAILED_EVENT
|
|
669
|
+
body: [self adLoadFailedInfoForAd: key withError: error]];
|
|
670
|
+
}
|
|
583
671
|
for ( NSString *key in self.rewardedAds )
|
|
584
672
|
{
|
|
585
673
|
[self sendReactNativeEventWithName: ON_REWARDED_AD_LOAD_FAILED_EVENT
|
|
@@ -598,14 +686,18 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
598
686
|
{
|
|
599
687
|
name = ON_INTERSTITIAL_LOAD_FAILED_EVENT;
|
|
600
688
|
}
|
|
689
|
+
else if ( self.appOpenAds[adUnitId] )
|
|
690
|
+
{
|
|
691
|
+
name = ON_APPOPEN_LOAD_FAILED_EVENT;
|
|
692
|
+
}
|
|
601
693
|
else if ( self.rewardedAds[adUnitId] )
|
|
602
694
|
{
|
|
603
695
|
name = ON_REWARDED_AD_LOAD_FAILED_EVENT;
|
|
604
696
|
}
|
|
605
697
|
else
|
|
606
698
|
{
|
|
607
|
-
[self log: @"didFailToLoadAd — adUnitId '%@' not found in any dictionary (keys: adViews=%@, interstitials=%@, rewardedAds=%@)",
|
|
608
|
-
adUnitId, self.adViews.allKeys, self.interstitials.allKeys, self.rewardedAds.allKeys];
|
|
699
|
+
[self log: @"didFailToLoadAd — adUnitId '%@' not found in any dictionary (keys: adViews=%@, interstitials=%@, appOpenAds=%@, rewardedAds=%@)",
|
|
700
|
+
adUnitId, self.adViews.allKeys, self.interstitials.allKeys, self.appOpenAds.allKeys, self.rewardedAds.allKeys];
|
|
609
701
|
return;
|
|
610
702
|
}
|
|
611
703
|
|
|
@@ -630,6 +722,10 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
630
722
|
{
|
|
631
723
|
name = ON_INTERSTITIAL_CLICKED_EVENT;
|
|
632
724
|
}
|
|
725
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
726
|
+
{
|
|
727
|
+
name = ON_APPOPEN_CLICKED_EVENT;
|
|
728
|
+
}
|
|
633
729
|
else if ( adFormat == CLXAdFormatRewarded )
|
|
634
730
|
{
|
|
635
731
|
name = ON_REWARDED_AD_CLICKED_EVENT;
|
|
@@ -648,13 +744,17 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
648
744
|
{
|
|
649
745
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
650
746
|
CLXAdFormat adFormat = ad.adFormat;
|
|
651
|
-
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatRewarded ) return;
|
|
747
|
+
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatAppOpen && adFormat != CLXAdFormatRewarded ) return;
|
|
652
748
|
|
|
653
749
|
NSString *name;
|
|
654
750
|
if ( adFormat == CLXAdFormatInterstitial )
|
|
655
751
|
{
|
|
656
752
|
name = ON_INTERSTITIAL_DISPLAYED_EVENT;
|
|
657
753
|
}
|
|
754
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
755
|
+
{
|
|
756
|
+
name = ON_APPOPEN_DISPLAYED_EVENT;
|
|
757
|
+
}
|
|
658
758
|
else
|
|
659
759
|
{
|
|
660
760
|
name = ON_REWARDED_AD_DISPLAYED_EVENT;
|
|
@@ -668,13 +768,17 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
668
768
|
{
|
|
669
769
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
670
770
|
CLXAdFormat adFormat = ad.adFormat;
|
|
671
|
-
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatRewarded ) return;
|
|
771
|
+
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatAppOpen && adFormat != CLXAdFormatRewarded ) return;
|
|
672
772
|
|
|
673
773
|
NSString *name;
|
|
674
774
|
if ( adFormat == CLXAdFormatInterstitial )
|
|
675
775
|
{
|
|
676
776
|
name = ON_INTERSTITIAL_DISPLAY_FAILED_EVENT;
|
|
677
777
|
}
|
|
778
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
779
|
+
{
|
|
780
|
+
name = ON_APPOPEN_DISPLAY_FAILED_EVENT;
|
|
781
|
+
}
|
|
678
782
|
else
|
|
679
783
|
{
|
|
680
784
|
name = ON_REWARDED_AD_DISPLAY_FAILED_EVENT;
|
|
@@ -688,13 +792,17 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
688
792
|
{
|
|
689
793
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
690
794
|
CLXAdFormat adFormat = ad.adFormat;
|
|
691
|
-
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatRewarded ) return;
|
|
795
|
+
if ( adFormat != CLXAdFormatInterstitial && adFormat != CLXAdFormatAppOpen && adFormat != CLXAdFormatRewarded ) return;
|
|
692
796
|
|
|
693
797
|
NSString *name;
|
|
694
798
|
if ( adFormat == CLXAdFormatInterstitial )
|
|
695
799
|
{
|
|
696
800
|
name = ON_INTERSTITIAL_HIDDEN_EVENT;
|
|
697
801
|
}
|
|
802
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
803
|
+
{
|
|
804
|
+
name = ON_APPOPEN_HIDDEN_EVENT;
|
|
805
|
+
}
|
|
698
806
|
else
|
|
699
807
|
{
|
|
700
808
|
name = ON_REWARDED_AD_HIDDEN_EVENT;
|
|
@@ -751,6 +859,10 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
751
859
|
{
|
|
752
860
|
name = ON_INTERSTITIAL_AD_REVENUE_PAID;
|
|
753
861
|
}
|
|
862
|
+
else if ( adFormat == CLXAdFormatAppOpen )
|
|
863
|
+
{
|
|
864
|
+
name = ON_APPOPEN_AD_REVENUE_PAID;
|
|
865
|
+
}
|
|
754
866
|
else if ( adFormat == CLXAdFormatRewarded )
|
|
755
867
|
{
|
|
756
868
|
name = ON_REWARDED_AD_REVENUE_PAID;
|
|
@@ -1108,6 +1220,21 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1108
1220
|
return result;
|
|
1109
1221
|
}
|
|
1110
1222
|
|
|
1223
|
+
- (CLXAppOpen *)retrieveAppOpenForAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
1224
|
+
{
|
|
1225
|
+
CLXAppOpen *result = self.appOpenAds[adUnitIdentifier];
|
|
1226
|
+
if ( !result )
|
|
1227
|
+
{
|
|
1228
|
+
result = [[CloudXCore shared] createAppOpenWithAdUnitId: adUnitIdentifier];
|
|
1229
|
+
result.delegate = self;
|
|
1230
|
+
result.revenueDelegate = self;
|
|
1231
|
+
|
|
1232
|
+
self.appOpenAds[adUnitIdentifier] = result;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return result;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1111
1238
|
- (CLXRewarded *)retrieveRewardedAdForAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
1112
1239
|
{
|
|
1113
1240
|
CLXRewarded *result = self.rewardedAds[adUnitIdentifier];
|
|
@@ -1457,6 +1584,107 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1457
1584
|
return vc;
|
|
1458
1585
|
}
|
|
1459
1586
|
|
|
1587
|
+
- (nullable CLXRevenueData *)revenueDataFromDictionary:(NSDictionary<NSString *, id> *)dictionary
|
|
1588
|
+
{
|
|
1589
|
+
if ( ![dictionary isKindOfClass: [NSDictionary class]] )
|
|
1590
|
+
{
|
|
1591
|
+
[self log: @"reportRevenueData: ignoring data with missing or invalid required fields"];
|
|
1592
|
+
return nil;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
NSString *platform = [self stringValueFromDictionary: dictionary key: @"platform"];
|
|
1596
|
+
NSNumber *revenueNumber = [self revenueNumberValueFromDictionary: dictionary key: @"revenue"];
|
|
1597
|
+
NSString *adFormat = [self stringValueFromDictionary: dictionary key: @"adFormat"];
|
|
1598
|
+
CLXRevenuePlatform revenuePlatform = [self revenuePlatformFromString: platform];
|
|
1599
|
+
if ( !revenuePlatform || !revenueNumber || [self isBlankString: adFormat] )
|
|
1600
|
+
{
|
|
1601
|
+
[self log: @"reportRevenueData: ignoring data with missing or invalid required fields"];
|
|
1602
|
+
return nil;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
double revenue = revenueNumber.doubleValue;
|
|
1606
|
+
if ( !isfinite(revenue) )
|
|
1607
|
+
{
|
|
1608
|
+
[self log: @"reportRevenueData: ignoring data with non-finite revenue=%@", revenueNumber];
|
|
1609
|
+
return nil;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
return [CLXRevenueData revenueDataWithPlatform: revenuePlatform
|
|
1613
|
+
revenue: revenue
|
|
1614
|
+
adFormat: adFormat
|
|
1615
|
+
builderBlock:^(CLXRevenueDataBuilder *builder) {
|
|
1616
|
+
builder.currencyCode = [self nonBlankStringValueFromDictionary: dictionary key: @"currencyCode"];
|
|
1617
|
+
builder.precision = [self revenuePrecisionFromString: [self stringValueFromDictionary: dictionary key: @"precision"]];
|
|
1618
|
+
builder.networkName = [self nonBlankStringValueFromDictionary: dictionary key: @"networkName"];
|
|
1619
|
+
builder.adUnitId = [self nonBlankStringValueFromDictionary: dictionary key: @"adUnitId"];
|
|
1620
|
+
builder.thirdPartyAdPlacementId = [self nonBlankStringValueFromDictionary: dictionary key: @"thirdPartyAdPlacementId"];
|
|
1621
|
+
builder.creativeId = [self nonBlankStringValueFromDictionary: dictionary key: @"creativeId"];
|
|
1622
|
+
builder.networkPlacement = [self nonBlankStringValueFromDictionary: dictionary key: @"networkPlacement"];
|
|
1623
|
+
builder.countryCode = [self nonBlankStringValueFromDictionary: dictionary key: @"countryCode"];
|
|
1624
|
+
builder.userSegment = [self nonBlankStringValueFromDictionary: dictionary key: @"userSegment"];
|
|
1625
|
+
}];
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
- (nullable CLXRevenuePlatform)revenuePlatformFromString:(nullable NSString *)platform
|
|
1629
|
+
{
|
|
1630
|
+
if ( !platform )
|
|
1631
|
+
{
|
|
1632
|
+
return nil;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
NSString *trimmedPlatform = [platform stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
1636
|
+
if ( trimmedPlatform.length == 0 )
|
|
1637
|
+
{
|
|
1638
|
+
return nil;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
if ( [trimmedPlatform caseInsensitiveCompare: CLXRevenuePlatformAdMob] == NSOrderedSame )
|
|
1642
|
+
{
|
|
1643
|
+
return CLXRevenuePlatformAdMob;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
if ( [trimmedPlatform caseInsensitiveCompare: CLXRevenuePlatformInMobi] == NSOrderedSame )
|
|
1647
|
+
{
|
|
1648
|
+
return CLXRevenuePlatformInMobi;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
return CLXRevenuePlatformCustom(trimmedPlatform);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
- (nullable NSString *)nonBlankStringValueFromDictionary:(NSDictionary<NSString *, id> *)dictionary key:(NSString *)key
|
|
1655
|
+
{
|
|
1656
|
+
NSString *value = [self stringValueFromDictionary: dictionary key: key];
|
|
1657
|
+
return [self isBlankString: value] ? nil : value;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
- (nullable NSNumber *)revenueNumberValueFromDictionary:(NSDictionary<NSString *, id> *)dictionary key:(NSString *)key
|
|
1661
|
+
{
|
|
1662
|
+
id value = dictionary[key];
|
|
1663
|
+
if ( ![value isKindOfClass: [NSNumber class]] ) return nil;
|
|
1664
|
+
if ( CFGetTypeID((__bridge CFTypeRef)value) == CFBooleanGetTypeID() ) return nil;
|
|
1665
|
+
return value;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
- (BOOL)isBlankString:(nullable NSString *)value
|
|
1669
|
+
{
|
|
1670
|
+
if ( ![value isKindOfClass: [NSString class]] ) return YES;
|
|
1671
|
+
return [value stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
- (nullable CLXRevenuePrecision *)revenuePrecisionFromString:(nullable NSString *)value
|
|
1675
|
+
{
|
|
1676
|
+
if ( !value ) return nil;
|
|
1677
|
+
|
|
1678
|
+
NSString *lower = [value lowercaseString];
|
|
1679
|
+
if ( [lower isEqualToString: @"exact"] ) return CLXRevenuePrecision.exact;
|
|
1680
|
+
if ( [lower isEqualToString: @"estimated"] ) return CLXRevenuePrecision.estimated;
|
|
1681
|
+
if ( [lower isEqualToString: @"publisher_defined"] ) return CLXRevenuePrecision.publisherDefined;
|
|
1682
|
+
if ( [lower isEqualToString: @"undefined"] ) return CLXRevenuePrecision.undefined;
|
|
1683
|
+
|
|
1684
|
+
[self log: @"reportRevenueData: ignoring unknown precision=%@", value];
|
|
1685
|
+
return nil;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1460
1688
|
- (CLXLogLevel)logLevelFromString:(NSString *)level
|
|
1461
1689
|
{
|
|
1462
1690
|
NSString *lower = [level lowercaseString];
|
|
@@ -1691,6 +1919,11 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1691
1919
|
*result = CLXAdFormatInterstitial;
|
|
1692
1920
|
return YES;
|
|
1693
1921
|
}
|
|
1922
|
+
if ( [upper isEqualToString: @"APP_OPEN"] )
|
|
1923
|
+
{
|
|
1924
|
+
*result = CLXAdFormatAppOpen;
|
|
1925
|
+
return YES;
|
|
1926
|
+
}
|
|
1694
1927
|
if ( [upper isEqualToString: @"REWARDED"] )
|
|
1695
1928
|
{
|
|
1696
1929
|
*result = CLXAdFormatRewarded;
|
|
@@ -1711,6 +1944,7 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1711
1944
|
case CLXAdFormatBanner: return @"BANNER";
|
|
1712
1945
|
case CLXAdFormatMREC: return @"MREC";
|
|
1713
1946
|
case CLXAdFormatInterstitial: return @"INTERSTITIAL";
|
|
1947
|
+
case CLXAdFormatAppOpen: return @"APP_OPEN";
|
|
1714
1948
|
case CLXAdFormatRewarded: return @"REWARDED";
|
|
1715
1949
|
default: return @"";
|
|
1716
1950
|
}
|
|
@@ -1747,6 +1981,14 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1747
1981
|
ON_INTERSTITIAL_HIDDEN_EVENT,
|
|
1748
1982
|
ON_INTERSTITIAL_AD_REVENUE_PAID,
|
|
1749
1983
|
|
|
1984
|
+
ON_APPOPEN_LOADED_EVENT,
|
|
1985
|
+
ON_APPOPEN_LOAD_FAILED_EVENT,
|
|
1986
|
+
ON_APPOPEN_CLICKED_EVENT,
|
|
1987
|
+
ON_APPOPEN_DISPLAYED_EVENT,
|
|
1988
|
+
ON_APPOPEN_DISPLAY_FAILED_EVENT,
|
|
1989
|
+
ON_APPOPEN_HIDDEN_EVENT,
|
|
1990
|
+
ON_APPOPEN_AD_REVENUE_PAID,
|
|
1991
|
+
|
|
1750
1992
|
ON_REWARDED_AD_LOADED_EVENT,
|
|
1751
1993
|
ON_REWARDED_AD_LOAD_FAILED_EVENT,
|
|
1752
1994
|
ON_REWARDED_AD_CLICKED_EVENT,
|
|
@@ -1781,6 +2023,14 @@ RCT_EXPORT_METHOD(destroyRewarded:(NSString *)adUnitIdentifier)
|
|
|
1781
2023
|
@"ON_INTERSTITIAL_HIDDEN_EVENT": ON_INTERSTITIAL_HIDDEN_EVENT,
|
|
1782
2024
|
@"ON_INTERSTITIAL_AD_REVENUE_PAID": ON_INTERSTITIAL_AD_REVENUE_PAID,
|
|
1783
2025
|
|
|
2026
|
+
@"ON_APPOPEN_LOADED_EVENT": ON_APPOPEN_LOADED_EVENT,
|
|
2027
|
+
@"ON_APPOPEN_LOAD_FAILED_EVENT": ON_APPOPEN_LOAD_FAILED_EVENT,
|
|
2028
|
+
@"ON_APPOPEN_CLICKED_EVENT": ON_APPOPEN_CLICKED_EVENT,
|
|
2029
|
+
@"ON_APPOPEN_DISPLAYED_EVENT": ON_APPOPEN_DISPLAYED_EVENT,
|
|
2030
|
+
@"ON_APPOPEN_DISPLAY_FAILED_EVENT": ON_APPOPEN_DISPLAY_FAILED_EVENT,
|
|
2031
|
+
@"ON_APPOPEN_HIDDEN_EVENT": ON_APPOPEN_HIDDEN_EVENT,
|
|
2032
|
+
@"ON_APPOPEN_AD_REVENUE_PAID": ON_APPOPEN_AD_REVENUE_PAID,
|
|
2033
|
+
|
|
1784
2034
|
@"ON_REWARDED_AD_LOADED_EVENT": ON_REWARDED_AD_LOADED_EVENT,
|
|
1785
2035
|
@"ON_REWARDED_AD_LOAD_FAILED_EVENT": ON_REWARDED_AD_LOAD_FAILED_EVENT,
|
|
1786
2036
|
@"ON_REWARDED_AD_CLICKED_EVENT": ON_REWARDED_AD_CLICKED_EVENT,
|
package/ios/CloudXAdView.h
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//
|
|
2
|
+
// CloudXAdView.h
|
|
3
|
+
// cloudx-react-native
|
|
4
|
+
//
|
|
5
|
+
// In-tree banner/MREC view component. Unlike the imperative overlay banner in
|
|
6
|
+
// CloudX.mm (attached above the whole RN view tree), this hosts a
|
|
7
|
+
// CLXBannerAdView as an ordinary RN view so app overlays layer above it.
|
|
8
|
+
//
|
|
9
9
|
|
|
10
10
|
#import <React/RCTUIManager.h>
|
|
11
11
|
#import <CloudXCore/CloudXCore.h>
|
|
@@ -19,10 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
NS_ASSUME_NONNULL_BEGIN
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* the corresponding callback); delegate call sites guard with `if (self.onX)`.
|
|
25
|
-
*/
|
|
22
|
+
// Nil by default on the Old Architecture (only set when the publisher passes
|
|
23
|
+
// the corresponding callback); delegate call sites guard with `if (self.onX)`.
|
|
26
24
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAdLoadedEvent;
|
|
27
25
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAdLoadFailedEvent;
|
|
28
26
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onAdClickedEvent;
|
package/ios/CloudXAdView.mm
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//
|
|
2
|
+
// CloudXAdView.mm
|
|
3
|
+
// cloudx-react-native
|
|
4
|
+
//
|
|
5
5
|
|
|
6
6
|
#import "CloudXAdView.h"
|
|
7
7
|
#import "CloudXExtraParameters.h"
|
|
@@ -174,7 +174,6 @@ static id CLXIdFromFollyDynamic(const folly::dynamic &dynamicValue)
|
|
|
174
174
|
if ( oldViewProps.adFormat != newViewProps.adFormat )
|
|
175
175
|
{
|
|
176
176
|
[self setAdFormat: RCTNSStringFromString(newViewProps.adFormat)];
|
|
177
|
-
shouldAttach = YES;
|
|
178
177
|
}
|
|
179
178
|
if ( oldViewProps.placement != newViewProps.placement )
|
|
180
179
|
{
|
|
@@ -248,10 +247,8 @@ static id CLXIdFromFollyDynamic(const folly::dynamic &dynamicValue)
|
|
|
248
247
|
{
|
|
249
248
|
if ( self.adView )
|
|
250
249
|
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* actual change; unchanged re-sets on re-render stay quiet.
|
|
254
|
-
*/
|
|
250
|
+
// Ad unit ID is immutable once the ad view is created. Warn only on an
|
|
251
|
+
// actual change; unchanged re-sets on re-render stay quiet.
|
|
255
252
|
if ( ![adUnitId isEqualToString: _adUnitId] )
|
|
256
253
|
{
|
|
257
254
|
RCTLogWarn(@"CloudXAdView: adUnitId cannot change after the ad view is created; remount the component (e.g. via a React key).");
|
|
@@ -326,7 +323,7 @@ static id CLXIdFromFollyDynamic(const folly::dynamic &dynamicValue)
|
|
|
326
323
|
/*
|
|
327
324
|
* createBanner/createMRECWithAdUnitId: returned nil. The JS layer
|
|
328
325
|
* gates mounting on SDK initialization, so a nil here post-init is
|
|
329
|
-
* an invalid/expired ad unit
|
|
326
|
+
* an invalid/expired ad unit — surface it as a load failure instead
|
|
330
327
|
* of leaving a permanently-dead, silent view (self.adView stays nil
|
|
331
328
|
* and props don't re-land, so there is no retry).
|
|
332
329
|
*/
|
|
@@ -390,11 +387,9 @@ static id CLXIdFromFollyDynamic(const folly::dynamic &dynamicValue)
|
|
|
390
387
|
return;
|
|
391
388
|
}
|
|
392
389
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
* ad is always torn down on a genuine unmount.
|
|
397
|
-
*/
|
|
390
|
+
// Superview nil could be a real unmount or brief reparenting (react-native-screens).
|
|
391
|
+
// Defer one main-queue turn; destroy only if it is still detached. Strong ref so the
|
|
392
|
+
// ad is always torn down on a genuine unmount.
|
|
398
393
|
CloudXAdView *viewRef = self;
|
|
399
394
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
400
395
|
if ( viewRef.superview != nil )
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//
|
|
2
|
+
// CloudXAdViewManager.h
|
|
3
|
+
// cloudx-react-native
|
|
4
|
+
//
|
|
5
|
+
// Old-Architecture (Paper) view manager for the in-tree CloudXAdView.
|
|
6
|
+
//
|
|
7
7
|
|
|
8
8
|
#import <React/RCTViewManager.h>
|
|
9
9
|
|
package/lib/commonjs/CloudX.js
CHANGED
|
@@ -46,6 +46,9 @@ const setDoNotSell = isDoNotSell => {
|
|
|
46
46
|
const arbiter = configuration => {
|
|
47
47
|
return _NativeCloudX.default.arbiter(configuration);
|
|
48
48
|
};
|
|
49
|
+
const reportRevenueData = data => {
|
|
50
|
+
return _NativeCloudX.default.reportRevenueData(data);
|
|
51
|
+
};
|
|
49
52
|
const CloudX = exports.CloudX = {
|
|
50
53
|
isInitialized,
|
|
51
54
|
initialize,
|
|
@@ -59,7 +62,8 @@ const CloudX = exports.CloudX = {
|
|
|
59
62
|
setVisualDebuggingEnabled,
|
|
60
63
|
setHasUserConsent,
|
|
61
64
|
setDoNotSell,
|
|
62
|
-
arbiter
|
|
65
|
+
arbiter,
|
|
66
|
+
reportRevenueData
|
|
63
67
|
};
|
|
64
68
|
var _default = exports.default = CloudX;
|
|
65
69
|
//# sourceMappingURL=CloudX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeCloudX","_interopRequireDefault","require","_version","e","__esModule","default","isInitialized","NativeCloudX","initialize","appKey","PLUGIN_VERSION","isTablet","getVersion","setMinLogLevel","level","setHashedUserID","hashedUserID","setUserKeyValue","key","value","setAppKeyValue","clearAllKeyValues","setVisualDebuggingEnabled","enabled","setHasUserConsent","hasUserConsent","setDoNotSell","isDoNotSell","arbiter","configuration","CloudX","exports","_default"],"sourceRoot":"../../src","sources":["CloudX.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["_NativeCloudX","_interopRequireDefault","require","_version","e","__esModule","default","isInitialized","NativeCloudX","initialize","appKey","PLUGIN_VERSION","isTablet","getVersion","setMinLogLevel","level","setHashedUserID","hashedUserID","setUserKeyValue","key","value","setAppKeyValue","clearAllKeyValues","setVisualDebuggingEnabled","enabled","setHasUserConsent","hasUserConsent","setDoNotSell","isDoNotSell","arbiter","configuration","reportRevenueData","data","CloudX","exports","_default"],"sourceRoot":"../../src","sources":["CloudX.ts"],"mappings":";;;;;;AAIA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA2C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3C,MAAMG,aAAa,GAAGA,CAAA,KAAwB;EAC1C,OAAOC,qBAAY,CAACD,aAAa,CAAC,CAAC;AACvC,CAAC;AAED,MAAME,UAAU,GAAIC,MAAc,IAA0C;EACxE,OAAOF,qBAAY,CAACC,UAAU,CAACE,uBAAc,EAAED,MAAM,CAAC;AAC1D,CAAC;AAED,MAAME,QAAQ,GAAGA,CAAA,KAAwB;EACrC,OAAOJ,qBAAY,CAACI,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,MAAMC,UAAU,GAAGA,CAAA,KAAuB;EACtC,OAAOL,qBAAY,CAACK,UAAU,CAAC,CAAC;AACpC,CAAC;AAED,MAAMC,cAAc,GAAIC,KAA0B,IAAW;EACzDP,qBAAY,CAACM,cAAc,CAACC,KAAK,CAAC;AACtC,CAAC;AAED,MAAMC,eAAe,GAAIC,YAAoB,IAAW;EACpDT,qBAAY,CAACQ,eAAe,CAACC,YAAY,CAAC;AAC9C,CAAC;AAED,MAAMC,eAAe,GAAGA,CAACC,GAAW,EAAEC,KAAa,KAAW;EAC1DZ,qBAAY,CAACU,eAAe,CAACC,GAAG,EAAEC,KAAK,CAAC;AAC5C,CAAC;AAED,MAAMC,cAAc,GAAGA,CAACF,GAAW,EAAEC,KAAa,KAAW;EACzDZ,qBAAY,CAACa,cAAc,CAACF,GAAG,EAAEC,KAAK,CAAC;AAC3C,CAAC;AAED,MAAME,iBAAiB,GAAGA,CAAA,KAAY;EAClCd,qBAAY,CAACc,iBAAiB,CAAC,CAAC;AACpC,CAAC;AAED,MAAMC,yBAAyB,GAAIC,OAAgB,IAAW;EAC1DhB,qBAAY,CAACe,yBAAyB,CAACC,OAAO,CAAC;AACnD,CAAC;AAED,MAAMC,iBAAiB,GAAIC,cAA8B,IAAW;EAChElB,qBAAY,CAACiB,iBAAiB,CAACC,cAAc,CAAC;AAClD,CAAC;AAED,MAAMC,YAAY,GAAIC,WAA2B,IAAW;EACxDpB,qBAAY,CAACmB,YAAY,CAACC,WAAW,CAAC;AAC1C,CAAC;AAED,MAAMC,OAAO,GAAIC,aAAyC,IAAmC;EACzF,OAAOtB,qBAAY,CAACqB,OAAO,CAACC,aAAa,CAAC;AAC9C,CAAC;AAED,MAAMC,iBAAiB,GAAIC,IAAuB,IAAuB;EACrE,OAAOxB,qBAAY,CAACuB,iBAAiB,CAACC,IAAI,CAAC;AAC/C,CAAC;AAEM,MAAMC,MAAkB,GAAAC,OAAA,CAAAD,MAAA,GAAG;EAC9B1B,aAAa;EACbE,UAAU;EACVG,QAAQ;EACRC,UAAU;EACVC,cAAc;EACdE,eAAe;EACfE,eAAe;EACfG,cAAc;EACdC,iBAAiB;EACjBC,yBAAyB;EACzBE,iBAAiB;EACjBE,YAAY;EACZE,OAAO;EACPE;AACJ,CAAC;AAAC,IAAAI,QAAA,GAAAD,OAAA,CAAA5B,OAAA,GAEa2B,MAAM","ignoreList":[]}
|
|
@@ -56,7 +56,7 @@ const parseAdValues = json => {
|
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
58
|
const parsed = JSON.parse(json);
|
|
59
|
-
return parsed && typeof parsed === 'object'
|
|
59
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
60
60
|
} catch {
|
|
61
61
|
return {};
|
|
62
62
|
}
|
|
@@ -126,7 +126,7 @@ const toNativeExtraParameterEntries = extraParameters => {
|
|
|
126
126
|
* events to the public CloudXAdProps callbacks, and hosts the native ad view.
|
|
127
127
|
*
|
|
128
128
|
* Note: overriding `style` with a non-IAB size resizes the host frame, not the
|
|
129
|
-
* creative
|
|
129
|
+
* creative — iOS pins the ad view to the host bounds and Android measures the
|
|
130
130
|
* creative from the host, so the served creative keeps its own standard
|
|
131
131
|
* dimensions inside the resized frame.
|
|
132
132
|
*/
|
|
@@ -144,12 +144,16 @@ const CloudXAdViewBase = ({
|
|
|
144
144
|
...viewProps
|
|
145
145
|
}) => {
|
|
146
146
|
const [isTablet, setIsTablet] = (0, _react.useState)(cachedIsTablet ?? false);
|
|
147
|
-
const nativeViewProps =
|
|
147
|
+
const nativeViewProps = {
|
|
148
|
+
...viewProps
|
|
149
|
+
};
|
|
150
|
+
delete nativeViewProps.onAdExpanded;
|
|
151
|
+
delete nativeViewProps.onAdCollapsed;
|
|
148
152
|
|
|
149
153
|
/*
|
|
150
154
|
* Gate native ad-view creation on SDK initialization. A view mounted before
|
|
151
155
|
* CloudX.initialize() completes would create the ad against an uninitialized
|
|
152
|
-
* SDK
|
|
156
|
+
* SDK — on iOS createBannerWithAdUnitId: returns nil and the view is
|
|
153
157
|
* permanently dead (no retry, no load-failed event). There is no init event
|
|
154
158
|
* to subscribe to, so poll isInitialized() until ready, then mount the
|
|
155
159
|
* native view (which is what delivers adUnitId/adFormat and triggers create).
|
|
@@ -221,11 +225,9 @@ const CloudXAdViewBase = ({
|
|
|
221
225
|
const resolvedStyle = (0, _react.useMemo)(() => [defaultSize, style], [defaultSize, style]);
|
|
222
226
|
const nativeExtraParameters = (0, _react.useMemo)(() => toNativeExtraParameterEntries(extraParameters), [extraParameters]);
|
|
223
227
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* create). Swaps to the real ad view once isInitialized flips true.
|
|
228
|
-
*/
|
|
228
|
+
// Until the SDK is initialized, render a sized placeholder that reserves the
|
|
229
|
+
// ad slot's layout but does NOT mount the native view (so no pre-init
|
|
230
|
+
// create). Swaps to the real ad view once isInitialized flips true.
|
|
229
231
|
if (!isInitialized) {
|
|
230
232
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
231
233
|
style: resolvedStyle
|