MARewardedAd.h 6.3 KB

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