-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMCustomEventBanner.m
51 lines (39 loc) · 1.43 KB
/
AMCustomEventBanner.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// AMCustomEventBanner.m
// Flame
//
// Created by Jose Portocarrero on 9/9/20.
// Copyright © 2020 Monet. All rights reserved.
//
#import "AMCustomEventBanner.h"
#import "DFP_Standalone-Swift.h"
@interface AMCustomEventBanner () <GADCustomEventBanner, AMBannerAdDelegate>
@end
@implementation AMCustomEventBanner
@synthesize delegate;
// MARK: GADCustomEventBanner
- (void)requestBannerAd:(GADAdSize)adSize parameter:(nullable NSString *)serverParameter
label:(nullable NSString *)serverLabel request:(nonnull GADCustomEventRequest *)request {
AMMonetBid *bid = [[AMMonetBid alloc] init];
bid.cpm = request.additionalParameters[AppMonetManager.bidCpmKey];
bid.id = request.additionalParameters[AppMonetManager.bidIdKey];
[[AppMonetManager sharedInstance] adView].delegate = self;
[[[AppMonetManager sharedInstance] adView] render:bid];
}
// MARK: AMBannerAdDelegate
- (void)wasClicked:(AMAppMonetAdView *)adView {
[delegate customEventBannerWasClicked:self];
}
- (void)adLoaded:(AMAppMonetAdView *)adView {
[delegate customEventBanner:self didReceiveAd:[[AppMonetManager sharedInstance] adView]];
}
- (void)adError:(NSError *)error withAdView:(AMAppMonetAdView *)adView {
[delegate customEventBanner:self didFailAd:nil];
}
// MARK: Cleanup
- (void)dealloc {
if(self == [[AppMonetManager sharedInstance] adView].delegate){
[[AppMonetManager sharedInstance] cleanBanner];
}
}
@end