MARewardedInterstitialAd.h 5.0 KB

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