//
//  InterstitialViewController.m
//  AdViewSDKDemo
//
//  Created by unakayou on 11/1/19.
//  Copyright © 2019 AdView. All rights reserved.
//

#import "InterstitialViewController.h"

@interface InterstitialViewController () <AdViewViewDelegate>
@property (nonatomic, strong) AdViewView * interstitial;
@end

@implementation InterstitialViewController

- (void)requestButtonClick:(UIButton *)sender {
    self.interstitial = [AdViewView requestAdInterstitialWithPositionId:ADVIEW_POSID_INTERSTITIAL
                                                               delegate:self];
}

- (NSString *)appId {
    return ADVIEW_APPID;
}

- (UIViewController *)viewControllerForShowModal {
    return self;
}

- (void)didReceivedAd:(AdViewView *)adView {
    [adView showInterstitialWithRootViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (void)adViewDidDisplayAd:(AdViewView *)adView {
    
    NSLog(@"%s",__FUNCTION__);
    NSLog(@"Already Displayed");
}
- (void)didFailToReceiveAd:(AdViewView *)adView Error:(NSError *)error {
    NSLog(@"%s - %@",__FUNCTION__, error.domain);
}

- (void)adViewWillPresentScreen:(AdViewView *)adView {
    NSLog(@"%s", __FUNCTION__);
}
- (void)adViewDidDismissScreen:(AdViewView *)adView {
    NSLog(@"%s", __FUNCTION__);
}
- (void)adViewDidFinishShow:(AdViewView *)adview {
    NSLog(@"%s", __FUNCTION__);
}
- (void)adViewdidFailToDisplayAd:(AdViewView *)adView Error:(NSError*)error {
    NSLog(@"%s",__FUNCTION__);
    NSLog(@"%@", error);
    
}
@end
