Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmso committed May 24, 2020
1 parent afcb6e2 commit 1ae82a3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@
1D0CB33823204EBD0076AAAA /* MAX */ = {
isa = PBXGroup;
children = (
37B6CED3246E04D30068A6A4 /* MRECs */,
1D629D5D240F4E6600FE6F5F /* Banners */,
1D629D5E240F4E7200FE6F5F /* Interstitials */,
37B6CED3246E04D30068A6A4 /* MRECs */,
1D629D5F240F4E7500FE6F5F /* Rewarded */,
);
path = MAX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,29 @@ @interface ALDemoRewardedVideosViewController()<ALAdLoadDelegate, ALAdRewardDele

@implementation ALDemoRewardedVideosViewController

#pragma mark - View Lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];

self.rewardedAd =[ALIncentivizedInterstitialAd shared];
}

#pragma mark - IB Action Methods

// You need to preload each rewarded video before it can be displayed
- (IBAction)preloadRewardedVideo:(id)sender
{
[self.rewardedAd preloadAndNotify: self];
}

- (IBAction)showRewardedVideo:(id)sender
{
// You need to preload each rewarded video before it can be displayed
if ( [[ALIncentivizedInterstitialAd shared] isReadyForDisplay] )
if ( [self.rewardedAd isReadyForDisplay] )
{
// Optional: Assign delegates
self.rewardedAd = [ALIncentivizedInterstitialAd shared];
self.rewardedAd.adDisplayDelegate = self;
self.rewardedAd.adVideoPlaybackDelegate = self;

Expand All @@ -35,14 +49,6 @@ - (IBAction)showRewardedVideo:(id)sender
}
}

// You need to preload each rewarded video before it can be displayed
- (IBAction)preloadRewardedVideo:(id)sender
{
[self logCallback: __PRETTY_FUNCTION__];

[self.rewardedAd preloadAndNotify: self];
}

#pragma mark - Ad Load Delegate

- (void)adService:(ALAdService *)adService didLoadAd:(ALAd *)ad
Expand Down Expand Up @@ -72,7 +78,7 @@ - (void)rewardValidationRequestForAd:(ALAd *)ad didSucceedWithResponse:(NSDictio
// Do something with this information.
// [MYCurrencyManagerClass updateUserCurrency: currencyName withChange: amountGiven];
[self logCallback: __PRETTY_FUNCTION__];

// By default we'll show a UIAlertView informing your user of the currency & amount earned.
// If you don't want this, you can turn it off in the Manage Apps UI.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <AppLovinSDK/AppLovinSDK.h>

@interface ALDemoRewardedVideosZoneViewController()<ALAdLoadDelegate, ALAdRewardDelegate, ALAdDisplayDelegate, ALAdVideoPlaybackDelegate>
@property (nonatomic, strong) ALIncentivizedInterstitialAd *incentivizedInterstitial;
@property (nonatomic, strong) ALIncentivizedInterstitialAd *rewardedAd;
@end

@implementation ALDemoRewardedVideosZoneViewController
Expand All @@ -21,15 +21,21 @@ - (void)viewDidLoad
{
[super viewDidLoad];

self.incentivizedInterstitial = [[ALIncentivizedInterstitialAd alloc] initWithZoneIdentifier: @"YOUR_ZONE_ID"];
self.rewardedAd = [[ALIncentivizedInterstitialAd alloc] initWithZoneIdentifier: @"YOUR_ZONE_ID"];
}

#pragma mark - IB Action Methods

// You need to preload each rewarded video before it can be displayed
- (IBAction)preloadRewardedVideo:(id)sender
{
[self.incentivizedInterstitial preloadAndNotify: self];
}

- (IBAction)showRewardedVideo:(id)sender
{
// You need to preload each rewarded video before it can be displayed
if ( self.incentivizedInterstitial.isReadyForDisplay )
if ( [self.incentivizedInterstitial isReadyForDisplay] )
{
// Optional: Assign delegates
self.incentivizedInterstitial.adDisplayDelegate = self;
Expand All @@ -43,14 +49,6 @@ - (IBAction)showRewardedVideo:(id)sender
}
}

// You need to preload each rewarded video before it can be displayed
- (IBAction)preloadRewardedVideo:(id)sender
{
[self logCallback: __PRETTY_FUNCTION__];

[self.incentivizedInterstitial preloadAndNotify: self];
}

#pragma mark - Ad Load Delegate

- (void)adService:(ALAdService *)adService didLoadAd:(ALAd *)ad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@
3763B23523357C4B00E49783 /* AppLovin MAX Demo App - Swift */ = {
isa = PBXGroup;
children = (
3763B23623357C4B00E49783 /* ALAppDelegate.swift */,
E5BDBDF22432C4E800F82D79 /* AppLovin */,
1DDCE5A2242AE5CE007EAC8D /* Base Classes */,
3763B24A23357CFB00E49783 /* MAX */,
3763B23623357C4B00E49783 /* ALAppDelegate.swift */,
3763B25323357D7900E49783 /* Supporting Files */,
);
path = "AppLovin MAX Demo App - Swift";
Expand All @@ -241,9 +241,9 @@
3763B24A23357CFB00E49783 /* MAX */ = {
isa = PBXGroup;
children = (
37B6CECC246DE9DE0068A6A4 /* MRECs */,
1DDCE595242AE564007EAC8D /* Banners */,
1DDCE59B242AE564007EAC8D /* Interstitials */,
37B6CECC246DE9DE0068A6A4 /* MRECs */,
1DDCE599242AE564007EAC8D /* Rewarded */,
);
path = MAX;
Expand All @@ -252,7 +252,7 @@
3763B25323357D7900E49783 /* Supporting Files */ = {
isa = PBXGroup;
children = (
E5BDBFEC243515C100F82D79 /* AppLovin MAX Demo App Swift-Bridging-Header.h */,
1D527D29247A4CB700958645 /* AppLovin MAX Demo App-Bridging-Header.h */,
E5EE50DB241C25B60032B659 /* MRECs.storyboard */,
E5EE50DA241C25B60032B659 /* Rewarded.storyboard */,
E5EE50D7241C25AA0032B659 /* Interstitials.storyboard */,
Expand Down Expand Up @@ -280,12 +280,12 @@
E5BDBDF22432C4E800F82D79 /* AppLovin */ = {
isa = PBXGroup;
children = (
E5BDBFF224354C5800F82D79 /* Event Tracking */,
E5BDBFE824350D0100F82D79 /* Native */,
E5BDBE902434141100F82D79 /* MRECs */,
E5BDBE8D243404DD00F82D79 /* Leaders */,
E5BDBE882433F50800F82D79 /* Banners */,
E5BDBFF224354C5800F82D79 /* Event Tracking */,
E5BDBDF32432C4E800F82D79 /* Interstitials */,
E5BDBE8D243404DD00F82D79 /* Leaders */,
E5BDBE902434141100F82D79 /* MRECs */,
E5BDBFE824350D0100F82D79 /* Native */,
E5BDBDF72432C4E800F82D79 /* Rewarded */,
);
name = AppLovin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import AppLovinSDK

class ALDemoInterstitialBasicIntegrationViewController : ALBaseAdViewController
{
// @IBOutlet weak var showButton: UIBarButtonItem!

@IBOutlet weak var showButton: UIButton!

private let interstitialAd = ALInterstitialAd.shared()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ import AppLovinSDK
class ALDemoRewardedVideosViewController : ALBaseAdViewController
{
private let rewardedAd = ALIncentivizedInterstitialAd.shared()


// You need to preload each rewarded video before it can be displayed
@IBAction func preloadRewardedVideo()
{
logCallback()
rewardedAd.preloadAndNotify(self)
}

@IBAction func showRewardedVideo()
{
// You need to preload each rewarded video before it can be displayed
if ALIncentivizedInterstitialAd.shared().isReadyForDisplay
if rewardedAd.isReadyForDisplay
{
// Optional: Assign delegates
rewardedAd.adDisplayDelegate = self
Expand All @@ -29,13 +36,6 @@ class ALDemoRewardedVideosViewController : ALBaseAdViewController
preloadRewardedVideo()
}
}

// You need to preload each rewarded video before it can be displayed
@IBAction func preloadRewardedVideo()
{
logCallback()
rewardedAd.preloadAndNotify(self)
}
}

extension ALDemoRewardedVideosViewController : ALAdLoadDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class ALDemoRewardedVideosZoneViewController : ALBaseAdViewController
incentivizedInterstitial = ALIncentivizedInterstitialAd(zoneIdentifier: "YOUR_ZONE_ID")
}

// You need to preload each rewarded video before it can be displayed
@IBAction func preloadRewardedVideo()
{
logCallback()
incentivizedInterstitial.preloadAndNotify(self)
}

@IBAction func showRewardedVideo()
{
// You need to preload each rewarded video before it can be displayed
Expand All @@ -32,13 +39,6 @@ class ALDemoRewardedVideosZoneViewController : ALBaseAdViewController
preloadRewardedVideo()
}
}

// You need to preload each rewarded video before it can be displayed
@IBAction func preloadRewardedVideo()
{
logCallback()
incentivizedInterstitial.preloadAndNotify(self)
}
}

extension ALDemoRewardedVideosZoneViewController : ALAdLoadDelegate
Expand Down

0 comments on commit 1ae82a3

Please sign in to comment.