AATBannerCache

@objc
public protocol AATBannerCache: AnyObject {
    /// Sets the placement statistics delegate
    var statisticsDelegate: AATStatisticsDelegate? { get set }

    /// Sets the placement impression delegate
    var impressionDelegate: AATImpressionDelegate? { get set }

    /// The delegate that represents the cache status
    var cacheStatusDelegate: AATBannerCacheStatusDelegate? { get set }

    var collapsableBannerOptions: AATCollapsibleBannerOptions? { get set }
    /// Updates the configuration that will be used when requesting new banners.
    ///
    /// - Parameters:
    ///   - requestConfiguration: AATBannerRequest instance
    ///   - shouldRefresh: True if the whole cache should be re-loaded with new banner request configuration, false if new configuration should only be used for new requests.
    func updateRequestConfiguration(_ requestConfiguration: AATBannerRequest, shouldRefresh: Bool)

    /// Returns an instance of ``AATBannerPlacementWrapperView`` to be used within the app. Also automatically counts an ad space.
    ///
    /// BannerCache will no longer hold any references to returned banners, and they need to be destroyed manually by the app.
    ///
    /// - Parameter force: true if cache should try to return banner ignoring the frequency capping set by ``AATBannerCacheConfiguration/minDelay``.
    ///
    /// - Returns: Ad View to be displayed.
    func consume(force: Bool) -> AATBannerPlacementWrapperView?

    /// Returns an instance of ``AATBannerPlacementWrapperView`` to be used within the app. Also automatically counts an ad space. It will respect the frequency capping set by ``AATBannerCacheConfiguration/minDelay``.
    ///
    /// BannerCache will no longer hold any references to returned banners, and they need to be destroyed manually by the app.
    ///
    /// - Returns: Ad View to be displayed.
    func consume() -> AATBannerPlacementWrapperView?

    /// Destroys the BannerCache, clearing all preloaded banner ads and canceling pending reload requests.
    ///
    /// - For proper memory management, it needs to be called when the BannerCache is no longer needed.
    /// - Destroyed BannerCache can no longer be used
    func destroy()
    
    /// Enable saving creative history
    /// - Parameter size: The max size of the history to be saved
    func enableCreativeHistory(size: Int)

    /// Get the saved creative history
    /// - Parameter completion: Completion block with the creative history
    func getCreativeHistory(completion: @escaping ([AATPlacementHistoryInfo]) -> Void)
}

Last updated