ALAdView.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // ALAdView.h
  3. // AppLovinSDK
  4. //
  5. // Created by Basil on 3/1/12.
  6. // Copyright © 2020 AppLovin Corporation. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <AppLovinSDK/ALAdDisplayDelegate.h>
  10. #import <AppLovinSDK/ALAdLoadDelegate.h>
  11. #import <AppLovinSDK/ALAdViewEventDelegate.h>
  12. @class ALAd;
  13. @class ALSdk;
  14. @class ALAdSize;
  15. @class ALAdType;
  16. @class ALSFSafariViewControllerDelegate;
  17. @class SFSafariViewControllerPrewarmingToken;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * This interface represents a view-based ad — i.e. banner, MREC, or leader.
  21. */
  22. @interface ALAdView : UIView
  23. /**
  24. * @name Ad Delegates
  25. */
  26. /**
  27. * An object that conforms to the @c ALAdLoadDelegate protocol. If you provide a value for @c adLoadDelegate in your instance, the SDK will notify
  28. * this delegate of ad load events.
  29. *
  30. * @warning This delegate is retained strongly and might lead to retain cycles if delegate holds strong reference to this @c ALAdView.
  31. */
  32. @property (nonatomic, strong, nullable) IBOutlet id<ALAdLoadDelegate> adLoadDelegate;
  33. /**
  34. * An object that conforms to the @c ALAdDisplayDelegate protocol. If you provide a value for @c adDisplayDelegate in your instance, the SDK will
  35. * notify this delegate of ad show/hide events.
  36. *
  37. * @warning This delegate is retained strongly and might lead to retain cycles if delegate holds strong reference to this @c ALAdView.
  38. */
  39. @property (nonatomic, strong, nullable) IBOutlet id<ALAdDisplayDelegate> adDisplayDelegate;
  40. /**
  41. * An object that conforms to the @c ALAdViewEventDelegate protocol. If you provide a value for @c adEventDelegate in your instance, the SDK will
  42. * notify this delegate of @c ALAdView -specific events.
  43. *
  44. * @warning This delegate is retained strongly and might lead to retain cycles if delegate holds strong reference to this @c ALAdView.
  45. */
  46. @property (nonatomic, strong, nullable) IBOutlet id<ALAdViewEventDelegate> adEventDelegate;
  47. /**
  48. * @name Ad View Configuration
  49. */
  50. /**
  51. * The size of ads to load within this @c ALAdView.
  52. */
  53. @property (nonatomic, strong) ALAdSize *adSize;
  54. /**
  55. * The zone identifier this @c ALAdView was initialized with and is loading ads for, if any.
  56. */
  57. @property (nonatomic, copy, readonly, nullable) NSString *zoneIdentifier;
  58. /**
  59. * Whether or not this ad view should automatically load the ad when iOS inflates it from a StoryBoard or from a nib file (when
  60. * @code -[UIView awakeFromNib] @endcode is called). The default value is @c NO which means you are responsible for loading the ad by invoking
  61. * @code -[ALAdView loadNextAd] @endcode.
  62. */
  63. @property (nonatomic, assign, getter=isAutoloadEnabled, setter=setAutoloadEnabled:) BOOL autoload;
  64. /**
  65. * @c SFSafariViewControllerPrewarmingToken object that corresponds to prewarmed URLs. Must keep a strong reference to this token as long as we expect the prewarmed connections to remain open.
  66. */
  67. @property (nonatomic, strong, nullable) SFSafariViewControllerPrewarmingToken *prewarmingToken API_AVAILABLE(ios(15.0));
  68. /**
  69. * @c ALSFSafariViewControllerDelegate object for @c SFSafariViewController callbacks.
  70. */
  71. @property (nonatomic, strong, nullable) ALSFSafariViewControllerDelegate *safariViewControllerDelegate;
  72. /**
  73. * Sets extra info to pass to the SDK.
  74. *
  75. * @param key Parameter key.
  76. * @param value Parameter value.
  77. */
  78. - (void)setExtraInfoForKey:(NSString *)key value:(nullable id)value;
  79. /**
  80. * @name Loading and Rendering Ads
  81. */
  82. /**
  83. * Loads <em>and</em> displays an ad into the view. This method returns immediately.
  84. *
  85. * <b>Note:</b> To load the ad but not display it, use @code +[ALSdk shared] @endcode ⇒ @code -[ALSDK adService] @endcode
  86. * ⇒ @code -[ALAdService loadNextAd:andNotify:] @endcode, then @code -[ALAdView render:] @endcode to render it.
  87. */
  88. - (void)loadNextAd;
  89. /**
  90. * Renders a specific ad that was loaded via @c ALAdService.
  91. *
  92. * @param ad Ad to render.
  93. */
  94. - (void)render:(ALAd *)ad;
  95. /**
  96. * @name Initialization
  97. */
  98. /**
  99. * Initializes the ad view with a given size.
  100. *
  101. * @param size @c ALAdSize that represents the size of this ad. For example, @code +[ALAdSize banner] @endcode.
  102. *
  103. * @return A new instance of @c ALAdView.
  104. */
  105. - (instancetype)initWithSize:(ALAdSize *)size;
  106. /**
  107. * Initializes the ad view for a given size and zone.
  108. *
  109. * @param size @c ALAdSize that represents the size of this ad. For example, @code +[ALAdSize banner] @endcode.
  110. * @param zoneIdentifier Identifier for the zone this @c ALAdView should load ads for.
  111. *
  112. * @return A new instance of @c ALAdView.
  113. */
  114. - (instancetype)initWithSize:(ALAdSize *)size zoneIdentifier:(nullable NSString *)zoneIdentifier;
  115. /**
  116. * Initializes the ad view with a given SDK and size.
  117. *
  118. * @param sdk Instance of @c ALSdk to use.
  119. * @param size @c ALAdSize that represents the size of this ad. For example, @code +[ALAdSize banner] @endcode.
  120. *
  121. * @return A new instance of @c ALAdView.
  122. */
  123. - (instancetype)initWithSdk:(ALSdk *)sdk size:(ALAdSize *)size;
  124. /**
  125. * Initializes the ad view with a given SDK, size, and zone.
  126. *
  127. * @param sdk Instance of @c ALSdk to use.
  128. * @param size @c ALAdSize that represents the size of this ad. For example, @code +[ALAdSize banner] @endcode.
  129. * @param zoneIdentifier Identifier for the zone that this @c ALAdView should load ads for.
  130. *
  131. * @return A new instance of @c ALAdView.
  132. */
  133. - (instancetype)initWithSdk:(ALSdk *)sdk size:(ALAdSize *)size zoneIdentifier:(nullable NSString *)zoneIdentifier;
  134. /**
  135. * Initializes the ad view with a given frame, ad size, and SDK instance.
  136. *
  137. * @param frame Describes the position and dimensions of the ad.
  138. * @param size @c ALAdSize that represents the size of this ad. For example, @code +[ALAdSize banner] @endcode.
  139. * @param sdk Instance of @c ALSdk to use.
  140. *
  141. * @return A new instance of @c ALAdView.
  142. */
  143. - (instancetype)initWithFrame:(CGRect)frame size:(ALAdSize *)size sdk:(ALSdk *)sdk;
  144. - (instancetype)init NS_UNAVAILABLE;
  145. + (instancetype)new NS_UNAVAILABLE;
  146. @end
  147. NS_ASSUME_NONNULL_END