Skip to content

Commit

Permalink
Facebook/6.16.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AppLovin-Mobile-Engineering committed Nov 15, 2024
1 parent 2502bf5 commit 4ed361c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Facebook/AppLovinMediationFacebookAdapter.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 = 'AppLovinMediationFacebookAdapter'
s.version = '6.15.2.1'
s.version = '6.16.0.0'
s.platform = :ios, '12.0'
s.summary = 'Facebook 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 All @@ -26,7 +26,7 @@ s.source =

s.vendored_frameworks = "#{s.name}-#{s.version}/#{s.name}.xcframework"

s.dependency 'FBAudienceNetwork', '= 6.15.2'
s.dependency 'FBAudienceNetwork', '= {ADAPTER_SDK_VERSION}'
s.dependency 'AppLovinSDK', '>= 13.0.0'
s.swift_version = '5.0'

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

## 6.16.0.0
* Certified with Facebook SDK 6.16.0. (Unity adapter to be released after Unity Cloud Build has support for Xcode 16.0)
* Updated minimum Xcode requirement to 16.0 to match Facebook SDK.
* Simplified API calls by removing selector checks; direct API calls are now safe with the updated min SDK version.
* Removed redundant log output when initialization was already completed.

## 6.15.2.1
* Requires minimum AppLovin MAX SDK version be 13.0.0.
* Removed COPPA support.
Expand Down
45 changes: 7 additions & 38 deletions Facebook/FacebookAdapter/ALFacebookMediationAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALFacebookMediationAdapter.h"
#import <FBAudienceNetwork/FBAudienceNetwork.h>

#define ADAPTER_VERSION @"6.15.2.1"
#define ADAPTER_VERSION @"6.16.0.0"
#define MEDIATION_IDENTIFIER [NSString stringWithFormat: @"APPLOVIN_%@:%@", [ALSdk version], self.adapterVersion]
#define ICON_VIEW_TAG 3

Expand Down Expand Up @@ -148,7 +148,6 @@ - (void)initializeWithParameters:(id<MAAdapterInitializationParameters>)paramete
}
else
{
[self log: @"Facebook attempted initialization already - marking initialization as %ld", ALFacebookSDKInitializationStatus];
completionHandler(ALFacebookSDKInitializationStatus, nil);
}
}
Expand Down Expand Up @@ -565,6 +564,7 @@ - (void)renderTrueNativeAd:(FBNativeAdBase *)nativeAd

MANativeAd *maxNativeAd = [[MAFacebookNativeAd alloc] initWithParentAdapter: self builderBlock:^(MANativeAdBuilder *builder) {
builder.title = nativeAd.headline;
builder.advertiser = nativeAd.advertiserName;
builder.body = nativeAd.bodyText;
builder.callToAction = nativeAd.callToAction;
builder.icon = [[MANativeAdImage alloc] initWithImage: nativeAd.iconImage];
Expand All @@ -574,37 +574,21 @@ - (void)renderTrueNativeAd:(FBNativeAdBase *)nativeAd
adOptionsView.backgroundColor = UIColor.clearColor;
builder.optionsView = adOptionsView;

CGFloat mediaContentAspectRatio = 0.0f;
if ( self.nativeBannerAd )
{
// Facebook true native banners do not provide media views so use icon asset in place of it
UIImageView *mediaImageView = [[UIImageView alloc] initWithImage: nativeAd.iconImage];
builder.mediaView = mediaImageView;

mediaContentAspectRatio = nativeAd.iconImage.size.width / nativeAd.iconImage.size.height;
builder.mediaContentAspectRatio = nativeAd.iconImage.size.width / nativeAd.iconImage.size.height;
}
else
{
FBMediaView *mediaView = [[FBMediaView alloc] init];
builder.mediaView = mediaView;

mediaContentAspectRatio = mediaView.aspectRatio;
builder.mediaContentAspectRatio = mediaView.aspectRatio;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
// Introduced in 10.4.0
if ( [builder respondsToSelector: @selector(setAdvertiser:)] )
{
builder.advertiser = nativeAd.advertiserName;
}

// Introduced in 11.4.0
if ( [builder respondsToSelector: @selector(setMediaContentAspectRatio:)] )
{
[builder performSelector: @selector(setMediaContentAspectRatio:) withObject: @(mediaContentAspectRatio)];
}
#pragma clang diagnostic pop
}];

[delegate didLoadAdForNativeAd: maxNativeAd withExtraInfo: nil];
Expand Down Expand Up @@ -926,6 +910,7 @@ - (void)renderNativeAdView

MANativeAd *maxNativeAd = [[MANativeAd alloc] initWithFormat: self.format builderBlock:^(MANativeAdBuilder *builder) {
builder.title = self.parentAdapter.nativeAd.headline;
builder.advertiser = self.parentAdapter.nativeAd.advertiserName;
builder.body = self.parentAdapter.nativeAd.bodyText;
builder.callToAction = self.parentAdapter.nativeAd.callToAction;
builder.iconView = iconView;
Expand All @@ -935,15 +920,6 @@ - (void)renderNativeAdView
adOptionsView.nativeAd = self.parentAdapter.nativeAd;
adOptionsView.backgroundColor = UIColor.clearColor;
builder.optionsView = adOptionsView;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
// Introduced in 10.4.0
if ( [builder respondsToSelector: @selector(setAdvertiser:)] )
{
builder.advertiser = self.parentAdapter.nativeAd.advertiserName;
}
#pragma clang diagnostic pop
}];

// Backend will pass down `vertical` as the template to indicate using a vertical native template
Expand Down Expand Up @@ -988,16 +964,9 @@ - (void)renderNativeAdView
{
[clickableViews addObject: maxNativeAdView.mediaContentView];
}

// Introduced in 10.4.0
if ( [maxNativeAdView respondsToSelector: @selector(advertiserLabel)] && [self respondsToSelector: @selector(advertiser)] )
if ( [maxNativeAd.advertiser al_isValidString] && maxNativeAdView.advertiserLabel )
{
id advertiserLabel = [maxNativeAdView performSelector: @selector(advertiserLabel)];
id advertiser = [maxNativeAd performSelector: @selector(advertiser)];
if ( [advertiser al_isValidString] && advertiserLabel )
{
[clickableViews addObject: advertiserLabel];
}
[clickableViews addObject: maxNativeAdView.advertiserLabel];
}

[self.parentAdapter.nativeAd registerViewForInteraction: maxNativeAdView
Expand Down

0 comments on commit 4ed361c

Please sign in to comment.