Guest User

GADNativeAd.h

a guest
Oct 1st, 2021
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  GADNativeAd.h
  3. //  Google Mobile Ads SDK
  4. //
  5. //  Copyright 2017 Google LLC. All rights reserved.
  6. //
  7.  
  8. #ifndef GADNativeAd_h
  9. #define GADNativeAd_h
  10.  
  11.  
  12. #endif /* GADNativeAd_h */
  13.  
  14. #import <Foundation/Foundation.h>
  15. #import <GoogleMobileAds/GADAdChoicesView.h>
  16. #import <GoogleMobileAds/GADAdLoaderDelegate.h>
  17. #import <GoogleMobileAds/GADAdValue.h>
  18. #import <GoogleMobileAds/GADMediaContent.h>
  19. #import <GoogleMobileAds/GADMediaView.h>
  20. #import <GoogleMobileAds/GADMuteThisAdReason.h>
  21. #import <GoogleMobileAds/GADNativeAdAssetIdentifiers.h>
  22. #import <GoogleMobileAds/GADNativeAdDelegate.h>
  23. #import <GoogleMobileAds/GADNativeAdImage.h>
  24. #import <GoogleMobileAds/GADResponseInfo.h>
  25. #import <GoogleMobileAds/GADVideoController.h>
  26. #import <UIKit/UIKit.h>
  27.  
  28. /// Native ad. To request this ad type, pass kGADAdLoaderAdTypeNative
  29. /// (see GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader's initializer method. If
  30. /// you request this ad type, your delegate must conform to the GADNativeAdLoaderDelegate
  31. /// protocol.
  32. @interface GADNativeAd : NSObject
  33.  
  34. #pragma mark - Must be displayed if available
  35.  
  36. /// Headline.
  37. @property(nonatomic, readonly, copy, nullable) NSString *headline;
  38.  
  39. #pragma mark - Recommended to display
  40.  
  41. /// Text that encourages user to take some action with the ad. For example "Install".
  42. @property(nonatomic, readonly, copy, nullable) NSString *callToAction;
  43. /// Icon image.
  44. @property(nonatomic, readonly, strong, nullable) GADNativeAdImage *icon;
  45. /// Description.
  46. @property(nonatomic, readonly, copy, nullable) NSString *body;
  47. /// Array of GADNativeAdImage objects.
  48. @property(nonatomic, readonly, strong, nullable) NSArray<GADNativeAdImage *> *images;
  49. /// App store rating (0 to 5).
  50. @property(nonatomic, readonly, copy, nullable) NSDecimalNumber *starRating;
  51. /// The app store name. For example, "App Store".
  52. @property(nonatomic, readonly, copy, nullable) NSString *store;
  53. /// String representation of the app's price.
  54. @property(nonatomic, readonly, copy, nullable) NSString *price;
  55. /// Identifies the advertiser. For example, the advertiser’s name or visible URL.
  56. @property(nonatomic, readonly, copy, nullable) NSString *advertiser;
  57. /// Media content. Set the associated media view's mediaContent property to this object to display
  58. /// this content.
  59. @property(nonatomic, readonly, nonnull) GADMediaContent *mediaContent;
  60.  
  61. #pragma mark - Other properties
  62.  
  63. /// Optional delegate to receive state change notifications.
  64. @property(nonatomic, weak, nullable) id<GADNativeAdDelegate> delegate;
  65.  
  66. /// Reference to a root view controller that is used by the ad to present full screen content after
  67. /// the user interacts with the ad. The root view controller is most commonly the view controller
  68. /// displaying the ad.
  69. @property(nonatomic, weak, nullable) UIViewController *rootViewController;
  70.  
  71. /// Dictionary of assets which aren't processed by the receiver.
  72. @property(nonatomic, readonly, copy, nullable) NSDictionary<NSString *, id> *extraAssets;
  73.  
  74. /// Information about the ad response that returned the ad.
  75. @property(nonatomic, readonly, nonnull) GADResponseInfo *responseInfo;
  76.  
  77. /// Called when the ad is estimated to have earned money. Available for allowlisted accounts only.
  78. @property(nonatomic, nullable, copy) GADPaidEventHandler paidEventHandler;
  79.  
  80. /// Indicates whether custom Mute This Ad is available for the native ad.
  81. @property(nonatomic, readonly, getter=isCustomMuteThisAdAvailable) BOOL customMuteThisAdAvailable;
  82.  
  83. /// An array of Mute This Ad reasons used to render customized mute ad survey. Use this array to
  84. /// implement your own Mute This Ad feature only when customMuteThisAdAvailable is YES.
  85. @property(nonatomic, readonly, nullable) NSArray<GADMuteThisAdReason *> *muteThisAdReasons;
  86.  
  87. /// Registers ad view, clickable asset views, and nonclickable asset views with this native ad.
  88. /// Media view shouldn't be registered as clickable.
  89. /// @param clickableAssetViews Dictionary of asset views that are clickable, keyed by asset IDs.
  90. /// @param nonclickableAssetViews Dictionary of asset views that are not clickable, keyed by asset
  91. ///        IDs.
  92. - (void)registerAdView:(nonnull UIView *)adView
  93.        clickableAssetViews:
  94.            (nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)clickableAssetViews
  95.     nonclickableAssetViews:
  96.         (nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)nonclickableAssetViews;
  97.  
  98. /// Unregisters ad view from this native ad. The corresponding asset views will also be
  99. /// unregistered.
  100. - (void)unregisterAdView;
  101.  
  102. /// Reports the mute event with the mute reason selected by user. Use nil if no reason was selected.
  103. /// Call this method only if customMuteThisAdAvailable is YES.
  104. - (void)muteThisAdWithReason:(nullable GADMuteThisAdReason *)reason;
  105.  
  106. @end
  107.  
  108. #pragma mark - Protocol and constants
  109.  
  110. /// The delegate of a GADAdLoader object implements this protocol to receive GADNativeAd ads.
  111. @protocol GADNativeAdLoaderDelegate <GADAdLoaderDelegate>
  112. /// Called when a native ad is received.
  113. - (void)adLoader:(nonnull GADAdLoader *)adLoader didReceiveNativeAd:(nonnull GADNativeAd *)nativeAd;
  114. @end
  115.  
  116. #pragma mark - Unified Native Ad View
  117.  
  118. /// Base class for native ad views. Your native ad view must be a subclass of this class and must
  119. /// call superclass methods for all overridden methods.
  120. @interface GADNativeAdView : UIView
  121.  
  122. /// This property must point to the native ad object rendered by this ad view.
  123. @property(nonatomic, strong, nullable) GADNativeAd *nativeAd;
  124.  
  125. /// Weak reference to your ad view's headline asset view.
  126. @property(nonatomic, weak, nullable) IBOutlet UIView *headlineView;
  127. /// Weak reference to your ad view's call to action asset view.
  128. @property(nonatomic, weak, nullable) IBOutlet UIView *callToActionView;
  129. /// Weak reference to your ad view's icon asset view.
  130. @property(nonatomic, weak, nullable) IBOutlet UIView *iconView;
  131. /// Weak reference to your ad view's body asset view.
  132. @property(nonatomic, weak, nullable) IBOutlet UIView *bodyView;
  133. /// Weak reference to your ad view's store asset view.
  134. @property(nonatomic, weak, nullable) IBOutlet UIView *storeView;
  135. /// Weak reference to your ad view's price asset view.
  136. @property(nonatomic, weak, nullable) IBOutlet UIView *priceView;
  137. /// Weak reference to your ad view's image asset view.
  138. @property(nonatomic, weak, nullable) IBOutlet UIView *imageView;
  139. /// Weak reference to your ad view's star rating asset view.
  140. @property(nonatomic, weak, nullable) IBOutlet UIView *starRatingView;
  141. /// Weak reference to your ad view's advertiser asset view.
  142. @property(nonatomic, weak, nullable) IBOutlet UIView *advertiserView;
  143. /// Weak reference to your ad view's media asset view.
  144. @property(nonatomic, weak, nullable) IBOutlet GADMediaView *mediaView;
  145. /// Weak reference to your ad view's AdChoices view. Must set adChoicesView before setting
  146. /// nativeAd, otherwise AdChoices will be rendered according to the preferredAdChoicesPosition
  147. /// defined in GADNativeAdViewAdOptions.
  148. @property(nonatomic, weak, nullable) IBOutlet GADAdChoicesView *adChoicesView;
  149.  
  150. @end
  151.  
Advertisement
Add Comment
Please, Sign In to add comment