63 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Swift
		
	
	
		
		
			
		
	
	
			63 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Swift
		
	
	
|  | // GuruInterstitialAd.swift | ||
|  | // Base class for interstitial ad implementations | ||
|  | // Corresponds to GuruInterstitialAd.kt in Android implementation | ||
|  | 
 | ||
|  | import Foundation | ||
|  | import UIKit | ||
|  | 
 | ||
|  | public struct InterstitialShowRequest { | ||
|  |     public let placement: String? | ||
|  |      | ||
|  |     public init(placement: String?) { | ||
|  |         self.placement = placement | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | open class GuruInterstitialAd: RelayAd { | ||
|  |     public let adUnitId: String | ||
|  |     public let adPlatform: AdPlatform | ||
|  |      | ||
|  |     public let adType = AdType.Interstitial | ||
|  |      | ||
|  |     private let name: String | ||
|  |      | ||
|  |     public init(engineId: Int, adUnitId: String, adPlatform: AdPlatform) { | ||
|  |         self.adUnitId = adUnitId | ||
|  |         self.adPlatform = adPlatform | ||
|  |         self.name = "[INTER-\(adPlatform)]" | ||
|  |         super.init(engineId: engineId) | ||
|  |     } | ||
|  |      | ||
|  |     // MARK: - Logging Methods | ||
|  |      | ||
|  |     public func logInfo(_ message: String) { | ||
|  |         Logger.i(tag: "INTER-\(adPlatform.name)[\(adUnitId)]", message: message) | ||
|  |     } | ||
|  |      | ||
|  |     public func logWarn(_ message: String) { | ||
|  |         Logger.w(tag: "INTER-\(adPlatform.name)[\(adUnitId)]", message: message) | ||
|  |     } | ||
|  |      | ||
|  |     public func logDebug(_ message: String) { | ||
|  |         Logger.d(tag: "INTER-\(adPlatform.name)[\(adUnitId)]", message: message) | ||
|  |     } | ||
|  |      | ||
|  |     public func logError(_ message: String) { | ||
|  |         Logger.e(tag: "INTER-\(adPlatform.name)[\(adUnitId)]", message: message) | ||
|  |     } | ||
|  |      | ||
|  |     // MARK: - Methods to override | ||
|  |      | ||
|  |     open func load() -> Bool { | ||
|  |         fatalError("Subclass must implement") | ||
|  |     } | ||
|  |      | ||
|  |     open func show(_ request: InterstitialShowRequest? = nil) -> Bool { | ||
|  |         fatalError("Subclass must implement") | ||
|  |     } | ||
|  |      | ||
|  |     open func destroy() -> Bool { | ||
|  |         fatalError("Subclass must implement") | ||
|  |     } | ||
|  | } |