AATKit iOS Integration
Release Notes
  • Start
    • Setup
      • Minimum iOS Version
      • Cocoapods
      • Swift Package Manager
      • AATKit Reporting
      • App Transport Security (ATS)
      • SKAdNetwork
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Asynchronous Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Asynchronous Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: Applovin
  • Ad Networks
    • Customize Ad Networks
    • Privacy Requirements
    • Google Mobile Ads SDK
    • AppNexus Custom Interstitial Auto Dismiss Delay
    • FeedAd Banner Options
    • AmazonHB
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Delegates
      • Reports Delegate
      • Impression Delegate (ILRD)
      • Statistics Delegate
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Publisher Provided ID
    • Child-directed Support
    • Disabling Ad Networks
    • Geo Tracking
    • Ad Quality
    • Creatives History
  • Other
    • AdMob Custom Events
    • Datonomy
    • Reference
      • Classes
        • AATConfiguration
        • AATRuntimeConfiguration
        • AATManagedConsent
        • AATVendorConsent
        • AATSimpleConsent
        • AATAdInfo
        • AATBannerConfiguration
        • AATBannerRequest
        • AATBannerCacheConfiguration
        • AATBannerAlign
        • AATPlacementHistoryInfo
        • AATReward
        • AATRewardedAdSSVInfo
        • AATNativeAdRating
        • AATImpression
        • AATPriceInfo
        • AATAdNetworksOptions
          • AATAppNexusOptions
          • AATFeedAdOptions
          • AATAdMobOptions
          • AATDFPOptions
          • AATDatonomyOptions
        • AATDebugInfo
        • AATDebugScreenConfiguration
        • AATUserTargeting
        • AATCollapsibleBannerOptions
      • Protocols
        • AATDelegate
        • AATManagedConsentDelegate
        • AATVendorConsentDelegate
        • AATPlacement
        • AATStickyBannerPlacement
        • AATStickyBannerPlacementDelegate
        • AATMultiSizeBannerPlacement
        • AATMultiSizeBannerPlacementDelegate
        • AATInfeedBannerPlacement
        • AATInfeedBannerPlacementDelegate
        • AATAsyncInfeedBannerPlacement
        • AATBannerRequestDelegate
        • AATBannerCache
        • AATBannerCacheDelegate
        • AATBannerCacheStatusDelegate
        • AATAutoLoadBannerPlacement
        • AATAutoLoadBannerPlacementDelegate
        • AATAutoLoadMultiSizeBannerPlacement
        • AATAutoLoadMultiSizeBannerPlacementDelegate
        • AATFullscreenPlacement
        • AATFullscreenPlacementDelegate
        • AATAppOpenAdPlacement
        • AATAppOpenPlacementDelegate
        • AATRewardedVideoPlacement
        • AATRewardedVideoPlacementDelegate
        • AATNativeAdPlacement
        • AATNativePlacementDelegate
        • AATAsyncNativeAdPlacement
        • AATNativeAdData
        • AATReportsDelegate
        • AATImpressionDelegate
        • AATStatisticsDelegate
      • Enumerations
        • AATAdNetwork
        • AATGender
        • AATLogLevel
        • AATManagedConsentState
        • NonIABConsent
        • AATBannerPlacementSize
        • AATBannerSize
        • HorizontalAlign
        • VerticalAlign
        • AATMediationType
        • AATImpressionPricePrecisionType
  • Samples
Powered by GitBook
On this page
  1. Other
  2. Reference
  3. Protocols

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)
}

@protocol AATBannerCacheStatusDelegate;

/// A cache of automatically preloaded banner ads.
/// The cache will always try to have a defined amount of banners available for immediate handout to the app whenever they are needed. <em>Note:</em> The BannerCache needs to be destroyed when no longer needed.
SWIFT_PROTOCOL("_TtP6AATKit14AATBannerCache_")
@protocol AATBannerCache
/// Sets the placement statistics delegate
@property (nonatomic, strong) id <AATStatisticsDelegate> _Nullable statisticsDelegate;
/// Sets the placement impression delegate
@property (nonatomic, strong) id <AATImpressionDelegate> _Nullable impressionDelegate;
/// The delegate that represents the cache status
@property (nonatomic, strong) id <AATBannerCacheStatusDelegate> _Nullable cacheStatusDelegate;
@property (nonatomic, strong) AATCollapsibleBannerOptions * _Nullable collapsableBannerOptions;
/// Updates the configuration that will be used when requesting new banners.
/// \param requestConfiguration AATBannerRequest instance
///
/// \param 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.
///
- (void)updateRequestConfiguration:(AATBannerRequest * _Nonnull)requestConfiguration shouldRefresh:(BOOL)shouldRefresh;
/// Returns an instance of <code>AATBannerPlacementWrapperView</code> 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.
/// \param force true if cache should try to return banner ignoring the frequency capping set by <code>AATBannerCacheConfiguration/minDelay</code>.
///
///
/// returns:
/// Ad View to be displayed.
- (AATBannerPlacementWrapperView * _Nullable)consumeWithForce:(BOOL)force SWIFT_WARN_UNUSED_RESULT;
/// Returns an instance of <code>AATBannerPlacementWrapperView</code> to be used within the app. Also automatically counts an ad space. It will respect the frequency capping set by <code>AATBannerCacheConfiguration/minDelay</code>.
/// 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.
- (AATBannerPlacementWrapperView * _Nullable)consume SWIFT_WARN_UNUSED_RESULT;
/// Destroys the BannerCache, clearing all preloaded banner ads and canceling pending reload requests.
/// <ul>
///   <li>
///     For proper memory management, it needs to be called when the BannerCache is no longer needed.
///   </li>
///   <li>
///     Destroyed BannerCache can no longer be used
///   </li>
/// </ul>
- (void)destroy;
/// Enable saving creative history
/// \param size The max size of the history to be saved
///
- (void)enableCreativeHistoryWithSize:(NSInteger)size;
/// Get the saved creative history
/// \param completion Completion block with the creative history
///
- (void)getCreativeHistoryWithCompletion:(void (^ _Nonnull)(NSArray<AATPlacementHistoryInfo *> * _Nonnull))completion;
@end

Last updated 4 months ago