Skip to content

Commit

Permalink
new ad revenue setter
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarshahanji committed Jun 22, 2021
1 parent ac94d20 commit 76f755d
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXAutoLayoutBannerAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXAutoLayoutBannerAdViewController()<MAAdViewAdDelegate>
@interface ALMAXAutoLayoutBannerAdViewController()<MAAdRevenueDelegate>
@property (nonatomic, strong) MAAdView *adView;
@end

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXFrameLayoutBannerAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXFrameLayoutBannerAdViewController()<MAAdViewAdDelegate>
@interface ALMAXFrameLayoutBannerAdViewController()<MAAdViewAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) MAAdView *adView;
@end

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXInterfaceBuilderBannerAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXInterfaceBuilderBannerAdViewController()<MAAdViewAdDelegate>
@interface ALMAXInterfaceBuilderBannerAdViewController()<MAAdViewAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) IBOutlet MAAdView *adView;
@end

Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import "ALBaseAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXInterstitialAdViewController()<MAAdDelegate>
@interface ALMAXInterstitialAdViewController()<MAAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) MAInterstitialAd *interstitialAd;
@property (nonatomic, assign) NSInteger retryAttempt;
@end
Expand All @@ -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];
Expand Down Expand Up @@ -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__];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXAutoLayoutMRecAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXAutoLayoutMRecAdViewController()<MAAdViewAdDelegate>
@interface ALMAXAutoLayoutMRecAdViewController()<MAAdViewAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) MAAdView *adView;
@end

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXFrameLayoutMRecAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXFrameLayoutMRecAdViewController()<MAAdViewAdDelegate>
@interface ALMAXFrameLayoutMRecAdViewController()<MAAdViewAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) MAAdView *adView;
@end

Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXInterfaceBuilderMRecAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXInterfaceBuilderMRecAdViewController()<MAAdViewAdDelegate>
@interface ALMAXInterfaceBuilderMRecAdViewController()<MAAdViewAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) IBOutlet MAAdView *adView;
@end

Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALMAXRewardedAdViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALMAXRewardedAdViewController()<MARewardedAdDelegate>
@interface ALMAXRewardedAdViewController()<MARewardedAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) MARewardedAd *rewardedAd;
@property (nonatomic, assign) NSInteger retryAttempt;
@end
Expand All @@ -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];
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand Down Expand Up @@ -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() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAd

func didCollapse(_ ad: MAAd) { logCallback() }
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import AppLovinSDK

class ALMAXInterfaceBuilderBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate
class ALMAXInterfaceBuilderBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate
{
@IBOutlet weak var adView: MAAdView!

Expand Down Expand Up @@ -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() }
}
Loading

0 comments on commit 76f755d

Please sign in to comment.