Skip to content

Commit

Permalink
BigoAds/4.5.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AppLovin-Mobile-Engineering committed Oct 23, 2024
1 parent e67ef09 commit 9325530
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 26 deletions.
2 changes: 1 addition & 1 deletion BigoAds/AppLovinMediationBigoAdsAdapter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pod::Spec.new do |s|

s.authors = 'AppLovin Corporation'
s.name = 'AppLovinMediationBigoAdsAdapter'
s.version = '4.5.1.0'
s.version = '4.5.1.1'
s.platform = :ios, '12.0'
s.summary = 'Bigo Ads adapter used for mediation with the AppLovin MAX SDK'
s.homepage = "https://github.com/CocoaPods/Specs/search?o=desc&q=#{s.name}&s=indexed"
Expand Down
114 changes: 89 additions & 25 deletions BigoAds/BigoAdsAdapter/ALBigoAdsMediationAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
#import <BigoADS/BigoNativeAdLoader.h>
#import <BigoADS/BigoAdInteractionDelegate.h>

#define ADAPTER_VERSION @"4.5.1.0"
#define ADAPTER_VERSION @"4.5.1.1"

#define TITLE_LABEL_TAG 1
#define MEDIA_VIEW_CONTAINER_TAG 2
#define ICON_VIEW_TAG 3
#define BODY_VIEW_TAG 4
#define CALL_TO_ACTION_VIEW_TAG 5
#define ADVERTISER_VIEW_TAG 8

@interface ALBigoAdsMediationAdapterInterstitialAdDelegate : NSObject <BigoInterstitialAdLoaderDelegate, BigoAdInteractionDelegate>
@property (nonatomic, weak) ALBigoAdsMediationAdapter *parentAdapter;
Expand Down Expand Up @@ -423,6 +430,16 @@ - (void)loadAdViewAdForParameters:(id<MAAdapterResponseParameters>)parameters
self.adLoader.ext = ALMediationInfo;

BigoAdSize *adSize = [self adSizeFromAdFormat: adFormat];
if ( !adSize )
{
MAAdapterError *adapterError = [MAAdapterError errorWithCode: MAAdapterError.errorCodeInvalidConfiguration
errorString: [NSString stringWithFormat: @"Unsupported ad format: %@", adFormat]];
[self log: @"%@ ad failed to load with error: %@", adFormat, adapterError];
[delegate didFailToLoadAdViewAdWithError: adapterError];

return;
}

BigoBannerAdRequest *request = [[BigoBannerAdRequest alloc] initWithSlotId: slotId adSizes: @[adSize]];
[request setServerBidPayload: parameters.bidResponse];
[self.adLoader loadAd: request];
Expand Down Expand Up @@ -475,9 +492,7 @@ - (BigoAdSize *)adSizeFromAdFormat:(MAAdFormat *)adFormat
}
else
{
[NSException raise: NSInvalidArgumentException format: @"Unsupported ad format: %@", adFormat];

return BigoAdSize.BANNER;
return nil;
}
}

Expand Down Expand Up @@ -1025,32 +1040,81 @@ - (BOOL)prepareForInteractionClickableViews:(NSArray<UIView *> *)clickableViews
return NO;
}

MANativeAdView *maxNativeAdView = (MANativeAdView *) container;

BigoAdMediaView *mediaView;
if ( maxNativeAdView.mediaContentView )
// Native integrations
if ( [container isKindOfClass: [MANativeAdView class]] )
{
mediaView = (BigoAdMediaView *) self.mediaView;
}
MANativeAdView *maxNativeAdView = (MANativeAdView *) container;

UIImageView *iconView;
if ( maxNativeAdView.iconImageView )
{
iconView = maxNativeAdView.iconImageView;
}
BigoAdMediaView *mediaView;
if ( maxNativeAdView.mediaContentView )
{
mediaView = (BigoAdMediaView *) self.mediaView;
}

BigoAdOptionsView *optionsView;
if ( maxNativeAdView.optionsContentView )
{
optionsView = (BigoAdOptionsView *) self.optionsView;
}
UIImageView *iconView;
if ( maxNativeAdView.iconImageView )
{
iconView = maxNativeAdView.iconImageView;
}

[nativeAd registerViewForInteraction: container
mediaView: mediaView
adIconView: iconView
adOptionsView: optionsView
clickableViews: clickableViews];
BigoAdOptionsView *optionsView;
if ( maxNativeAdView.optionsContentView )
{
optionsView = (BigoAdOptionsView *) self.optionsView;
}

[nativeAd registerViewForInteraction: container
mediaView: mediaView
adIconView: iconView
adOptionsView: optionsView
clickableViews: clickableViews];
}
// Plugins
else
{
UIImageView *iconView;
BigoAdMediaView *mediaView;

for ( UIView *view in clickableViews )
{
if ( view.tag == TITLE_LABEL_TAG )
{
view.bigoNativeAdViewTag = BigoNativeAdViewTagTitle;
}
else if ( view.tag == ICON_VIEW_TAG )
{
iconView = (UIImageView *) view;
// The native ad icon image view will be added to the asset icon view.
if ( iconView.subviews.count > 0 )
{
iconView = (UIImageView *) iconView.subviews[0];
}
}
else if ( view.tag == MEDIA_VIEW_CONTAINER_TAG )
{
mediaView = (BigoAdMediaView *) self.mediaView;
}
else if ( view.tag == BODY_VIEW_TAG )
{
view.bigoNativeAdViewTag = BigoNativeAdViewTagDescription;
}
else if ( view.tag == CALL_TO_ACTION_VIEW_TAG )
{
view.bigoNativeAdViewTag = BigoNativeAdViewTagCallToAction;
}
else if ( view.tag == ADVERTISER_VIEW_TAG )
{
view.bigoNativeAdViewTag = BigoNativeAdViewTagSponsored;
}
}

[nativeAd registerViewForInteraction: container
mediaView: mediaView
adIconView: iconView
adOptionsView: nil
clickableViews: clickableViews];
}

return YES;
}

Expand Down
4 changes: 4 additions & 0 deletions BigoAds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.5.1.1
* Add support for native ads in external plugins. Requires minimum React Native Plugin 8.0.4 or Flutter Plugin 4.0.2.
* Explicitly fail ad load with code `-5202` if unable to map ad view ad format to that of the network's.

## 4.5.1.0
* Certified with BigoAds SDK 4.5.1.
* Updated the minimum required iOS version to 12.0 in Pod Spec to match BigoAds SDK.
Expand Down

0 comments on commit 9325530

Please sign in to comment.