Created
May 7, 2019 16:50
-
-
Save skparticles/1c8cc450b37e6ce89fe465ebfef7afbb to your computer and use it in GitHub Desktop.
Revisions
-
skparticles created this gist
May 7, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,75 @@ #import "AdIntegrator.h" #import <HeyzapAds/HeyzapAds.h> /** 1. Include Interface to hold banner reference */ @interface AdIntegrator() @property(nonatomic,weak)HZBannerAd *banner; @end @implementation AdIntegrator + (id)shared{ static AdIntegrator* integrator = nil; @synchronized(self){ if(integrator == nil){ integrator = [[self alloc] init]; } } return integrator; } #pragma mark Core Methods - (void)initAds{ NSLog(@"[Ads] initialization"); //2. Enter Publisher Id [HeyzapAds startWithPublisherID: @"XXXXXXXX"]; } -(void)showBanner{ NSLog(@"[Ads] show banner"); //3. Show Banner if(!self.banner){ HZBannerAdOptions *options = [[HZBannerAdOptions alloc] init]; [HZBannerAd placeBannerInView:[UIApplication sharedApplication].keyWindow.rootViewController.view position:HZBannerPositionBottom options:options success:^(HZBannerAd *banner) { self.banner = banner; } failure:^(NSError *error) { NSLog(@"Error = %@",error); } ]; }else{ [self.banner setHidden: NO]; } } -(void)showInterstitial{ NSLog(@"[Ads] show interstitial"); //4. Add Interstital Ads Code // Interstitial Ads are automatically fetched from our server by default on SDK start and after an ad shows HZShowOptions *options = [[HZShowOptions alloc] init]; options.viewController = [UIApplication sharedApplication].keyWindow.rootViewController; [HZVideoAd showWithOptions:options]; } -(void)hideBanner{ NSLog(@"[Ads] hide banner"); // Hide the banner ad if(self.banner) [self.banner setHidden: YES]; } -(bool)isBannerVisible{ return true; } -(bool)isRewardedVideoAvialable{ return true; } -(void)showRewardedVideo{ NSLog(@"[Ads] show rewarded video"); } #pragma mark Integration @end