MAAppOpenAd.h 4.1 KB

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