Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // AdManager.swift
- // 1. FC Nürnberg
- //
- // Created by Galin Yonchev on 16.01.18.
- // Copyright © 2018 Elasticbrains GmbH. All rights reserved.
- //
- import UIKit
- import EBCore
- class AdManager {
- public static let sharedInstance = AdManager()
- // Setup SmartAdServer framework
- public func setUp() {
- SASAdView.setSiteID(101742, baseURL: "https://mobile.smartadserver.com")
- #if DEBUG
- SASAdView.setTestModeEnabled(true)
- SASAdView.setLoggingEnabled(true)
- #endif
- }
- // Show SASBannerView
- public func showBannerAd(withPageID pageID: String, andFormatID formatID: Int, inView bannerView: SASBannerView) {
- let rootViewController = UIApplication.shared.keyWindow?.rootViewController
- guard let _ = rootViewController as? EBTabBarController else {
- L_w("NOT showing banner bar: Root view controller is not a EBTabViewController")
- return
- }
- L_i("Showing banner ad with ID: \(pageID)")
- bannerView.loadFormatId(formatID, pageId: pageID, master: true, target: nil)
- }
- // Show SASInterstitialView
- public func showInterstitial(withPageID pageID: String, andFormatID formatID: Int, inView interstitialView: SASInterstitialView) {
- let rootViewController = UIApplication.shared.keyWindow?.rootViewController
- guard let _ = rootViewController as? EBTabBarController else {
- L_w("NOT showing banner bar: Root view controller is not a EBTabViewController")
- return
- }
- L_i("Showing interstitial ad with ID: \(pageID)")
- interstitialView.loadFormatId(formatID, pageId: pageID, master: true, target: nil)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement