Skip to content

Commit

Permalink
feat/new_ad_revenue_setter (#36)
Browse files Browse the repository at this point in the history
* new ad revenue setter

* Revert "new ad revenue setter"

This reverts commit 76f755d.

* correction to previous commit

* new setter in ALMAXFrameLayoutBannerAdViewController

* correcting setting delegate
  • Loading branch information
alvarshahanji committed Jun 22, 2021
1 parent ac94d20 commit ea9e56d
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 71 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()<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"];

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 @@ -9,7 +9,7 @@
import UIKit
import AppLovinSDK

class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate
class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAdDelegate, MAAdRevenueDelegate
{
private let adView = MAAdView(adUnitIdentifier: "YOUR_AD_UNIT_ID")

Expand All @@ -20,6 +20,7 @@ class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAd
super.viewDidLoad()

adView.delegate = self
adView.revenueDelegate = self

// Calculate dimensions
let width = view.bounds.width // Stretch to the width of the screen for banners to be fully functional
Expand Down Expand Up @@ -51,12 +52,14 @@ class ALMAXFrameLayoutBannerAdViewController: ALBaseAdViewController, MAAdViewAd
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 ea9e56d

Please sign in to comment.