Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.95 KB | None | 0 0
  1. //
  2. //  BuyTokensViewController.swift
  3. //  PrankDial
  4. //
  5. //  Created by Hasan Rafi on 5/30/16.
  6. //  Copyright © 2016 KickBackApps. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import AccountKit
  11. import PopupKit
  12. import JTProgressHUD
  13.  
  14. class GetTokensViewController: UIViewController {
  15.    
  16.     var loginRequirer: LoginRequirer!
  17.     var hasShownVideoThroughAvailabilityFlag = false
  18.    
  19.     @IBOutlet weak var whyBuyTokensView: UIView!
  20.     @IBOutlet var gestureRecognizers: [UILongPressGestureRecognizer]!
  21.    
  22.     override func viewDidLoad() {
  23.         super.viewDidLoad()
  24.        
  25.         accountKitInitialization()
  26.         Supersonic.sharedInstance().setOWDelegate(self)
  27.         Supersonic.sharedInstance().setRVDelegate(self)
  28.        
  29.         ALIncentivizedInterstitialAd.shared().adDisplayDelegate = self
  30.         ALIncentivizedInterstitialAd.preloadAndNotify(self)
  31.     }
  32.    
  33.     @IBAction func watchVideosTapped(sender: AnyObject) {
  34.         if DeviceState.sharedInstance.isUserLoggedIn {
  35.             ALIncentivizedInterstitialAd.show()
  36.         } else {
  37.             loginRequirer = LoginRequirer.RVAd
  38.             launchLoginRequiredPopup()
  39.         }
  40.     }
  41.    
  42.     internal enum LoginRequirer : Int {
  43.         case BuyTokens = 0
  44.         case EarnTokens = 1
  45.         case RVAd = 2
  46.     }
  47. }
  48.  
  49. extension GetTokensViewController: ALAdLoadDelegate {
  50.     func adService(adService: ALAdService, didLoadAd ad: ALAd) {
  51.         log.info("ad loaded")
  52.     }
  53.    
  54.     func adService(adService: ALAdService, didFailToLoadAdWithError code: Int32) {
  55.         log.error("ad loading failed with code : \(code)")
  56.     }
  57. }
  58.  
  59. extension GetTokensViewController: ALAdDisplayDelegate {
  60.     func ad(ad: ALAd, wasDisplayedIn view: UIView) {
  61.         log.info("wasDisplayedIn")
  62.     }
  63.    
  64.     func ad(ad: ALAd, wasClickedIn view: UIView) {
  65.         log.info("wasClickedIn")
  66.     }
  67.    
  68.     func ad(ad: ALAd, wasHiddenIn view: UIView) {
  69.         log.info("wasHiddenIn")
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement