From 76f755da96797e3a04cafed199fa1b40d40797ec Mon Sep 17 00:00:00 2001 From: alvarshahanji Date: Mon, 21 Jun 2021 22:53:58 -0700 Subject: [PATCH] new ad revenue setter --- .../ALMAXAutoLayoutBannerAdViewController.m | 19 +- .../ALMAXFrameLayoutBannerAdViewController.m | 16 +- ...AXInterfaceBuilderBannerAdViewController.m | 14 +- .../ALMAXInterstitialAdViewController.m | 6 +- .../ALMAXAutoLayoutMRecAdViewController.m | 17 +- .../ALMAXFrameLayoutMRecAdViewController.m | 16 +- ...LMAXInterfaceBuilderMRecAdViewController.m | 14 +- .../Rewarded/ALMAXRewardedAdViewController.m | 16 +- ...LMAXAutoLayoutBannerAdViewController.swift | 12 +- ...MAXFrameLayoutBannerAdViewController.swift | 1 + ...terfaceBuilderBannerAdViewController.swift | 10 +- .../ALMAXInterstitialAdViewController.swift | 5 +- .../ALMAXAutoLayoutMRecAdViewController.swift | 12 +- ...ALMAXFrameLayoutMRecAdViewController.swift | 11 +- ...InterfaceBuilderMRecAdViewController.swift | 10 +- .../ALMAXRewardedAdViewController.swift | 9 +- .../Base.lproj/Main.storyboard | 179 +++++++++--------- 17 files changed, 211 insertions(+), 156 deletions(-) diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.m index 17c01c8b62..548f91d716 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXAutoLayoutBannerAdViewController.h" #import -@interface ALMAXAutoLayoutBannerAdViewController() +@interface ALMAXAutoLayoutBannerAdViewController() @property (nonatomic, strong) MAAdView *adView; @end @@ -22,7 +22,10 @@ - (void)viewDidLoad [super viewDidLoad]; self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"]; - self.adView.delegate = self; + +// self.adView.delegate = self; + self.adView.revenueDelegate = self; + self.adView.translatesAutoresizingMaskIntoConstraints = NO; // Set background or background color for banners to be fully functional @@ -74,11 +77,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -91,4 +89,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.m index 9d669b73cb..60d586ad14 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXFrameLayoutBannerAdViewController.h" #import -@interface ALMAXFrameLayoutBannerAdViewController() +@interface ALMAXFrameLayoutBannerAdViewController() @property (nonatomic, strong) MAAdView *adView; @end @@ -22,7 +22,9 @@ - (void)viewDidLoad [super viewDidLoad]; self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"]; + self.adView.delegate = self; + self.adView.revenueDelegate = self; // Calculate dimensions CGFloat width = CGRectGetWidth(self.view.bounds); // Stretch to the width of the screen for banners to be fully functional @@ -73,11 +75,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -90,4 +87,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.m index 94c9aacc09..c650113062 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXInterfaceBuilderBannerAdViewController.h" #import -@interface ALMAXInterfaceBuilderBannerAdViewController() +@interface ALMAXInterfaceBuilderBannerAdViewController() @property (nonatomic, strong) IBOutlet MAAdView *adView; @end @@ -62,11 +62,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -79,4 +74,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Interstitials/ALMAXInterstitialAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Interstitials/ALMAXInterstitialAdViewController.m index 73c5c47f25..f79652ae74 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Interstitials/ALMAXInterstitialAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Interstitials/ALMAXInterstitialAdViewController.m @@ -10,7 +10,7 @@ #import "ALBaseAdViewController.h" #import -@interface ALMAXInterstitialAdViewController() +@interface ALMAXInterstitialAdViewController() @property (nonatomic, strong) MAInterstitialAd *interstitialAd; @property (nonatomic, assign) NSInteger retryAttempt; @end @@ -24,7 +24,9 @@ - (void)viewDidLoad [super viewDidLoad]; self.interstitialAd = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"]; + self.interstitialAd.delegate = self; + self.interstitialAd.revenueDelegate = self; // Load the first ad [self.interstitialAd loadAd]; @@ -91,6 +93,8 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self.interstitialAd loadAd]; } +#pragma mark - MAAdRevenueDelegate Protocol + - (void)didPayRevenueForAd:(MAAd *)ad { [self logCallback: __PRETTY_FUNCTION__]; diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.m index 178736f360..207ea659f4 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXAutoLayoutMRecAdViewController.h" #import -@interface ALMAXAutoLayoutMRecAdViewController() +@interface ALMAXAutoLayoutMRecAdViewController() @property (nonatomic, strong) MAAdView *adView; @end @@ -22,7 +22,10 @@ - (void)viewDidLoad [super viewDidLoad]; self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID" adFormat: MAAdFormat.mrec]; + self.adView.delegate = self; + self.adView.revenueDelegate = self; + self.adView.translatesAutoresizingMaskIntoConstraints = NO; // Set background or background color for MRECs to be fully functional @@ -73,11 +76,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -90,4 +88,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.m index 2d68fc1768..bf17979e9e 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXFrameLayoutMRecAdViewController.h" #import -@interface ALMAXFrameLayoutMRecAdViewController() +@interface ALMAXFrameLayoutMRecAdViewController() @property (nonatomic, strong) MAAdView *adView; @end @@ -22,7 +22,9 @@ - (void)viewDidLoad [super viewDidLoad]; self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID" adFormat: MAAdFormat.mrec]; + self.adView.delegate = self; + self.adView.revenueDelegate = self; // Dimensions CGFloat width = 300; @@ -73,11 +75,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -90,4 +87,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.m index 18a847b8d5..6e2454e196 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXInterfaceBuilderMRecAdViewController.h" #import -@interface ALMAXInterfaceBuilderMRecAdViewController() +@interface ALMAXInterfaceBuilderMRecAdViewController() @property (nonatomic, strong) IBOutlet MAAdView *adView; @end @@ -62,11 +62,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self logCallback: __PRETTY_FUNCTION__]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MAAdViewAdDelegate Protocol - (void)didExpandAd:(MAAd *)ad @@ -79,4 +74,11 @@ - (void)didCollapseAd:(MAAd *)ad [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Rewarded/ALMAXRewardedAdViewController.m b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Rewarded/ALMAXRewardedAdViewController.m index 3f218a0434..de8ae45b99 100644 --- a/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Rewarded/ALMAXRewardedAdViewController.m +++ b/AppLovin MAX Demo App - ObjC/AppLovin MAX Demo App - ObjC/MAX/Rewarded/ALMAXRewardedAdViewController.m @@ -9,7 +9,7 @@ #import "ALMAXRewardedAdViewController.h" #import -@interface ALMAXRewardedAdViewController() +@interface ALMAXRewardedAdViewController() @property (nonatomic, strong) MARewardedAd *rewardedAd; @property (nonatomic, assign) NSInteger retryAttempt; @end @@ -23,7 +23,9 @@ - (void)viewDidLoad [super viewDidLoad]; self.rewardedAd = [MARewardedAd sharedWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"]; + self.rewardedAd.delegate = self; + self.rewardedAd.revenueDelegate = self; // Load the first ad [self.rewardedAd loadAd]; @@ -90,11 +92,6 @@ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error [self.rewardedAd loadAd]; } -- (void)didPayRevenueForAd:(MAAd *)ad -{ - [self logCallback: __PRETTY_FUNCTION__]; -} - #pragma mark - MARewardedAdDelegate Protocol - (void)didStartRewardedVideoForAd:(MAAd *)ad @@ -113,4 +110,11 @@ - (void)didRewardUserForAd:(MAAd *)ad withReward:(MAReward *)reward [self logCallback: __PRETTY_FUNCTION__]; } +#pragma mark - MAAdRevenueDelegate Protocol + +- (void)didPayRevenueForAd:(MAAd *)ad +{ + [self logCallback: __PRETTY_FUNCTION__]; +} + @end diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.swift index 9ee1d9b797..d1d7a716dc 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXAutoLayoutBannerAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXAutoLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXAutoLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { private let adView = MAAdView(adUnitIdentifier: "YOUR_AD_UNIT_ID") @@ -20,6 +20,8 @@ class ALMAXAutoLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdD super.viewDidLoad() adView.delegate = self + adView.revenueDelegate = self + adView.translatesAutoresizingMaskIntoConstraints = false // Set background or background color for banners to be fully functional @@ -52,12 +54,14 @@ class ALMAXAutoLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdD func didClick(_ ad: MAAd) { logCallback() } func didFail(toDisplay ad: MAAd, withError error: MAError) { logCallback() } - - func didPayRevenue(for ad: MAAd) { logCallback() } - + // MARK: MAAdViewAdDelegate Protocol func didExpand(_ ad: MAAd) { logCallback() } func didCollapse(_ ad: MAAd) { logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.swift index 4964e6e5b4..f95df41d17 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXFrameLayoutBannerAdViewController.swift @@ -60,3 +60,4 @@ class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAd func didCollapse(_ ad: MAAd) { logCallback() } } + diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.swift index 332fa8cb86..db9ab6a985 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Banners/ALMAXInterfaceBuilderBannerAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXInterfaceBuilderBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXInterfaceBuilderBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { @IBOutlet weak var adView: MAAdView! @@ -41,12 +41,14 @@ class ALMAXInterfaceBuilderBannerAdViewController: ALBaseAdViewController, MAAdV func didClick(_ ad: MAAd) { logCallback() } func didFail(toDisplay ad: MAAd, withError error: MAError) { logCallback() } - - func didPayRevenue(for ad: MAAd) { logCallback() } - + // MARK: MAAdViewAdDelegate Protocol func didExpand(_ ad: MAAd) { logCallback() } func didCollapse(_ ad: MAAd) { logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Interstitials/ALMAXInterstitialAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Interstitials/ALMAXInterstitialAdViewController.swift index a87b45013b..02f0afe30f 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Interstitials/ALMAXInterstitialAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Interstitials/ALMAXInterstitialAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXInterstitialAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXInterstitialAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { private let interstitialAd = MAInterstitialAd(adUnitIdentifier: "YOUR_AD_UNIT_ID") private var retryAttempt = 0.0 @@ -21,6 +21,7 @@ class ALMAXInterstitialAdViewController: ALBaseAdViewController, MAAdViewAdDeleg super.viewDidLoad() interstitialAd.delegate = self + interstitialAd.revenueDelegate = self // Load the first ad interstitialAd.load() @@ -82,5 +83,7 @@ class ALMAXInterstitialAdViewController: ALBaseAdViewController, MAAdViewAdDeleg interstitialAd.load() } + // MARK: MAAdRevenueDelegate Protocol + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.swift index 045d4f2859..92ec7a49bb 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXAutoLayoutMRecAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXAutoLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXAutoLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { private let adView = MAAdView(adUnitIdentifier: "YOUR_AD_UNIT_ID", adFormat: MAAdFormat.mrec) @@ -20,6 +20,8 @@ class ALMAXAutoLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDel super.viewDidLoad() adView.delegate = self + adView.revenueDelegate = self + adView.translatesAutoresizingMaskIntoConstraints = false // Set background or background color for MRECs to be fully functional @@ -51,12 +53,14 @@ class ALMAXAutoLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDel func didClick(_ ad: MAAd) { logCallback() } func didFail(toDisplay ad: MAAd, withError error: MAError) { logCallback() } - - func didPayRevenue(for ad: MAAd) { logCallback() } - + // MARK: MAAdViewAdDelegate Protocol func didExpand(_ ad: MAAd) { logCallback() } func didCollapse(_ ad: MAAd) { logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.swift index b82dd7681d..1e9bba0bd7 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXFrameLayoutMRecAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXFrameLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXFrameLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { private let adView = MAAdView(adUnitIdentifier: "YOUR_AD_UNIT_ID") @@ -19,6 +19,7 @@ class ALMAXFrameLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDe { super.viewDidLoad() + adView.delegate = self adView.delegate = self // Dimensions @@ -52,12 +53,14 @@ class ALMAXFrameLayoutMRecAdViewController: ALBaseAdViewController, MAAdViewAdDe func didClick(_ ad: MAAd) { logCallback() } func didFail(toDisplay ad: MAAd, withError error: MAError) { logCallback() } - - func didPayRevenue(for ad: MAAd) { logCallback() } - + // MARK: MAAdViewAdDelegate Protocol func didExpand(_ ad: MAAd) { logCallback() } func didCollapse(_ ad: MAAd) { logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.swift index 93dcccc46a..5ce9728cd6 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/MRECs/ALMAXInterfaceBuilderMRecAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXInterfaceBuilderMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate +class ALMAXInterfaceBuilderMRecAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate { @IBOutlet weak var adView: MAAdView! @@ -41,12 +41,14 @@ class ALMAXInterfaceBuilderMRecAdViewController: ALBaseAdViewController, MAAdVie func didClick(_ ad: MAAd) { logCallback() } func didFail(toDisplay ad: MAAd, withError error: MAError) { logCallback() } - - func didPayRevenue(for ad: MAAd) { logCallback() } - + // MARK: MAAdViewAdDelegate Protocol func didExpand(_ ad: MAAd) { logCallback() } func didCollapse(_ ad: MAAd) { logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Rewarded/ALMAXRewardedAdViewController.swift b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Rewarded/ALMAXRewardedAdViewController.swift index 97c77859a0..ee50f9ffb3 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Rewarded/ALMAXRewardedAdViewController.swift +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/MAX/Rewarded/ALMAXRewardedAdViewController.swift @@ -9,7 +9,7 @@ import UIKit import AppLovinSDK -class ALMAXRewardedAdViewController: ALBaseAdViewController, MARewardedAdDelegate +class ALMAXRewardedAdViewController: ALBaseAdViewController, MARewardedAdDelegate, MAAdRevenueDelegate { private let rewardedAd = MARewardedAd.shared(withAdUnitIdentifier: "YOUR_AD_UNIT_ID") private var retryAttempt = 0.0 @@ -21,6 +21,7 @@ class ALMAXRewardedAdViewController: ALBaseAdViewController, MARewardedAdDelegat super.viewDidLoad() rewardedAd.delegate = self + rewardedAd.revenueDelegate = self // Load the first ad rewardedAd.load() @@ -78,8 +79,6 @@ class ALMAXRewardedAdViewController: ALBaseAdViewController, MARewardedAdDelegat rewardedAd.load() } - func didPayRevenue(for ad: MAAd) { logCallback() } - // MARK: MARewardedAdDelegate Protocol func didStartRewardedVideo(for ad: MAAd) { logCallback() } @@ -91,4 +90,8 @@ class ALMAXRewardedAdViewController: ALBaseAdViewController, MARewardedAdDelegat // Rewarded ad was displayed and user should receive the reward logCallback() } + + // MARK: MAAdRevenueDelegate Protocol + + func didPayRevenue(for ad: MAAd) { logCallback() } } diff --git a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/Supporting Files/Base.lproj/Main.storyboard b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/Supporting Files/Base.lproj/Main.storyboard index b0f020975a..c1b6f13784 100644 --- a/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/Supporting Files/Base.lproj/Main.storyboard +++ b/AppLovin MAX Demo App - Swift/AppLovin MAX Demo App - Swift/Supporting Files/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -15,20 +15,20 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -488,7 +488,7 @@ - + @@ -516,8 +516,8 @@ - + @@ -554,7 +554,7 @@ - + @@ -582,6 +582,7 @@ + @@ -592,7 +593,6 @@ - @@ -617,7 +617,7 @@ - + @@ -639,6 +639,7 @@ + @@ -648,7 +649,6 @@ - @@ -672,7 +672,7 @@ - + @@ -694,6 +694,7 @@ + @@ -703,7 +704,6 @@ - @@ -742,7 +742,7 @@ - + @@ -764,6 +764,7 @@ + @@ -773,7 +774,6 @@ - @@ -843,9 +843,9 @@ - + - + @@ -853,14 +853,14 @@ - + - + - + - +