MAAdView.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // MAAdView.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/MAAdViewAdDelegate.h>
  10. #import <AppLovinSDK/MAAdRequestDelegate.h>
  11. #import <AppLovinSDK/MAAdRevenueDelegate.h>
  12. #import <AppLovinSDK/MAAdReviewDelegate.h>
  13. @class ALSdk;
  14. @class MAAdFormat;
  15. NS_ASSUME_NONNULL_BEGIN
  16. /**
  17. * This class represents a view-based ad — i.e. banner/leader or MREC.
  18. *
  19. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/banners">MAX Integration Guide ⇒ iOS ⇒ Banners</a>
  20. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/mrecs">MAX Integration Guide ⇒ iOS ⇒ MRECs</a>
  21. */
  22. @interface MAAdView : UIView
  23. /**
  24. * Creates a new ad view for a given ad unit ID.
  25. *
  26. * @param adUnitIdentifier Ad unit ID to load ads for.
  27. */
  28. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
  29. /**
  30. * Creates a new ad view for a given ad unit ID.
  31. *
  32. * @param adUnitIdentifier Ad unit ID to load ads for.
  33. * @param sdk SDK to use. You can obtain an instance of the SDK by calling @code +[ALSdk shared] @endcode.
  34. */
  35. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier sdk:(ALSdk *)sdk;
  36. /**
  37. * Creates a new ad view for a given ad unit ID and ad format.
  38. *
  39. * @param adUnitIdentifier Ad unit ID to load ads for.
  40. * @param adFormat Ad format to load ads for.
  41. */
  42. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat;
  43. /**
  44. * Create a new ad view for a given ad unit ID, ad format, and SDK.
  45. *
  46. * @param adUnitIdentifier Ad unit id to load ads for.
  47. * @param adFormat Ad format to load ads for.
  48. * @param sdk SDK to use. You can obtain an instance of the SDK by calling @code +[ALSdk shared] @endcode.
  49. */
  50. - (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat sdk:(ALSdk *)sdk;
  51. - (instancetype)init NS_UNAVAILABLE;
  52. - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
  53. - (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE;
  54. + (instancetype)new NS_UNAVAILABLE;
  55. /**
  56. * A delegate that will be notified about ad events.
  57. */
  58. @property (nonatomic, weak, nullable) IBOutlet id<MAAdViewAdDelegate> delegate;
  59. /**
  60. * A delegate that will be notified about ad revenue events.
  61. */
  62. @property (nonatomic, weak, nullable) IBOutlet id<MAAdRevenueDelegate> revenueDelegate;
  63. /**
  64. * A delegate that will be notified about ad request events.
  65. */
  66. @property (nonatomic, weak, nullable) IBOutlet id<MAAdRequestDelegate> requestDelegate;
  67. /**
  68. * A delegate that will be notified about Ad Review events.
  69. */
  70. @property (nonatomic, weak, nullable) IBOutlet id<MAAdReviewDelegate> adReviewDelegate;
  71. /**
  72. * Loads the ad for the current ad view. Set @code -[MAAdView delegate] @endcode to assign a delegate that should be notified about ad load state.
  73. *
  74. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/banners#loading-a-banner">MAX Integration Guide ⇒ iOS ⇒ Banners ⇒ Loading a Banner</a>
  75. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/mrecs#loading-an-mrec">MAX Integration Guide ⇒ iOS ⇒ MRECs ⇒ Loading an MREC</a>
  76. */
  77. - (void)loadAd;
  78. /**
  79. * Starts or resumes auto-refreshing of the banner.
  80. *
  81. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/banners#showing-a-banner">MAX Integration Guide ⇒ iOS ⇒ Banners ⇒ Showing a Banner</a>
  82. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/mrecs#hiding-and-showing-an-mrec">MAX Integration Guide ⇒ iOS ⇒ MRECs ⇒ Hiding and Showing an MREC</a>
  83. */
  84. - (void)startAutoRefresh;
  85. /**
  86. * Pauses auto-refreshing of the banner.
  87. *
  88. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/banners#hiding-a-banner">MAX Integration Guide ⇒ iOS ⇒ Banners ⇒ Hiding a Banner</a>
  89. * @see <a href="https://dash.applovin.com/documentation/mediation/ios/getting-started/mrecs#hiding-and-showing-an-mrec">MAX Integration Guide ⇒ iOS ⇒ MRECs ⇒ Hiding and Showing an MREC</a>
  90. */
  91. - (void)stopAutoRefresh;
  92. /**
  93. * The placement name that you assign when you integrate each ad format, for granular reporting in ad events (e.g. "Rewarded_Store", "Rewarded_LevelEnd").
  94. */
  95. @property (nonatomic, copy, nullable) NSString *placement;
  96. /**
  97. * The ad unit identifier this @c MAAdView was initialized with and is loading ads for.
  98. */
  99. @property (nonatomic, copy, readonly) NSString *adUnitIdentifier;
  100. /**
  101. * The format of the ad view.
  102. */
  103. @property (nonatomic, weak, readonly) MAAdFormat *adFormat;
  104. /**
  105. * Sets an extra parameter key/value pair for the ad.
  106. *
  107. * @param key Parameter key.
  108. * @param value Parameter value.
  109. */
  110. - (void)setExtraParameterForKey:(NSString *)key value:(nullable NSString *)value;
  111. /**
  112. * Set a local extra parameter to pass to the adapter instances. Will not be available in the @code -[MAAdapter initializeWithParameters:withCompletionHandler:] @endcode method.
  113. *
  114. * @param key Parameter key. Must not be null.
  115. * @param value Parameter value. May be null.
  116. */
  117. - (void)setLocalExtraParameterForKey:(NSString *)key value:(nullable id)value;
  118. /**
  119. * The custom data to tie the showing ad to, for ILRD and rewarded postbacks via the @c {CUSTOM_DATA} macro. Maximum size is 8KB.
  120. */
  121. @property (nonatomic, copy, nullable) NSString *customData;
  122. @end
  123. NS_ASSUME_NONNULL_END