MAInterstitialAd.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // MAInterstitial.h
  3. // AppLovinSDK
  4. //
  5. // Created by Thomas So on 8/9/18.
  6. // Copyright © 2020 AppLovin Corporation. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <AppLovinSDK/MAAdDelegate.h>
  10. #import <AppLovinSDK/MAAdExpirationDelegate.h>
  11. #import <AppLovinSDK/MAAdRequestDelegate.h>
  12. #import <AppLovinSDK/MAAdRevenueDelegate.h>
  13. #import <AppLovinSDK/MAAdReviewDelegate.h>
  14. @class ALSdk;
  15. NS_ASSUME_NONNULL_BEGIN
  16. /**
  17. * This class represents a full-screen interstitial ad.
  18. *
  19. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/interstitials">MAX Integration Guide ⇒ iOS ⇒ Interstitials</a>
  20. */
  21. @interface MAInterstitialAd : NSObject
  22. /**
  23. * Creates a new mediation interstitial.
  24. *
  25. * @param adUnitIdentifier Ad unit ID to load ads for.
  26. */
  27. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
  28. /**
  29. * Creates a new mediation interstitial.
  30. *
  31. * @param adUnitIdentifier Ad unit ID to load ads for.
  32. * @param sdk SDK to use. You can obtain an instance of the SDK by calling @code +[ALSdk shared] @endcode.
  33. */
  34. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier sdk:(ALSdk *)sdk;
  35. - (instancetype)init NS_UNAVAILABLE;
  36. + (instancetype)new NS_UNAVAILABLE;
  37. /**
  38. * A delegate that will be notified about ad events.
  39. */
  40. @property (nonatomic, weak, nullable) id<MAAdDelegate> delegate;
  41. /**
  42. * A delegate that will be notified about ad revenue events.
  43. */
  44. @property (nonatomic, weak, nullable) id<MAAdRevenueDelegate> revenueDelegate;
  45. /**
  46. * A delegate that will be notified about ad request events.
  47. */
  48. @property (nonatomic, weak, nullable) id<MAAdRequestDelegate> requestDelegate;
  49. /**
  50. * A delegate that will be notified about ad expiration events.
  51. */
  52. @property (nonatomic, weak, nullable) id<MAAdExpirationDelegate> expirationDelegate;
  53. /**
  54. * A delegate that will be notified about Ad Review events.
  55. */
  56. @property (nonatomic, weak, nullable) id<MAAdReviewDelegate> adReviewDelegate;
  57. /**
  58. * Load the ad for the current interstitial. Set @code -[MAInterstitialAd delegate] @endcode to assign a delegate that should be notified about ad load state.
  59. *
  60. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/interstitials#loading-an-interstitial-ad">MAX Integration Guide ⇒ iOs ⇒ Interstitials ⇒ Loading an Interstitial Ad</a>
  61. */
  62. - (void)loadAd;
  63. /**
  64. * Show the loaded interstitial ad.
  65. * <ul>
  66. * <li>Use @code -[MAInterstitialAd delegate] @endcode to assign a delegate that should be notified about display events.</li>
  67. * <li>Use @code -[MAInterstitialAd ready] @endcode to check if an ad was successfully loaded.</li>
  68. * </ul>
  69. *
  70. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/interstitials#showing-an-interstitial-ad">MAX Integration Guide ⇒ iOs ⇒ Interstitials ⇒ Showing an Interstitial Ad</a>
  71. */
  72. - (void)showAd;
  73. /**
  74. * Show the loaded interstitial ad for a given placement to tie ad events to.
  75. * <ul>
  76. * <li>Use @code -[MAInterstitialAd delegate] @endcode to assign a delegate that should be notified about display events.</li>
  77. * <li>Use @code -[MAInterstitialAd ready] @endcode to check if an ad was successfully loaded.</li>
  78. * </ul>
  79. *
  80. * @param placement The placement to tie the showing ad’s events to.
  81. */
  82. - (void)showAdForPlacement:(nullable NSString *)placement;
  83. /**
  84. * Show the loaded interstitial ad for a given placement and custom data to tie ad events to.
  85. * <ul>
  86. * <li>Use @code -[MAInterstitialAd delegate] @endcode to assign a delegate that should be notified about display events.</li>
  87. * <li>Use @code -[MAInterstitialAd ready] @endcode to check if an ad was successfully loaded.</li>
  88. * </ul>
  89. *
  90. * @param placement The placement to tie the showing ad’s events to.
  91. * @param customData The custom data to tie the showing ad’s events to. Maximum size is 8KB.
  92. */
  93. - (void)showAdForPlacement:(nullable NSString *)placement customData:(nullable NSString *)customData;
  94. /**
  95. * Show the loaded interstitial ad for a given placement and custom data to tie ad events to, and a view controller to present the ad from.
  96. * <ul>
  97. * <li>Use @code -[MAInterstitialAd delegate] @endcode to assign a delegate that should be notified about display events.</li>
  98. * <li>Use @code -[MAInterstitialAd ready] @endcode to check if an ad was successfully loaded.</li>
  99. * </ul>
  100. *
  101. * @param placement The placement to tie the showing ad’s events to.
  102. * @param customData The custom data to tie the showing ad’s events to. Maximum size is 8KB.
  103. * @param viewController The view controller to display the ad from. If @c nil, will be inferred from the key window's root view controller.
  104. */
  105. - (void)showAdForPlacement:(nullable NSString *)placement
  106. customData:(nullable NSString *)customData
  107. viewController:(nullable UIViewController *)viewController;
  108. /**
  109. * The ad unit identifier this @c MAInterstitialAd was initialized with and is loading ads for.
  110. */
  111. @property (nonatomic, copy, readonly) NSString *adUnitIdentifier;
  112. /**
  113. * Whether or not this ad is ready to be shown.
  114. */
  115. @property (nonatomic, assign, readonly, getter=isReady) BOOL ready;
  116. /**
  117. * Sets an extra key/value parameter for the ad.
  118. *
  119. * @param key Parameter key.
  120. * @param value Parameter value.
  121. */
  122. - (void)setExtraParameterForKey:(NSString *)key value:(nullable NSString *)value;
  123. /**
  124. * Set a local extra parameter to pass to the adapter instances. Will not be available in the @code -[MAAdapter initializeWithParameters:withCompletionHandler:] @endcode method.
  125. *
  126. * @param key Parameter key. Must not be null.
  127. * @param value Parameter value. May be null.
  128. */
  129. - (void)setLocalExtraParameterForKey:(NSString *)key value:(nullable id)value;
  130. @end
  131. NS_ASSUME_NONNULL_END