BUNativeExpressSplashView.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // BUNativeExpressSplashView.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2019 bytedance. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "BUMaterialMeta.h"
  9. #import "BUMopubAdMarkUpDelegate.h"
  10. @class BUNativeExpressSplashView;
  11. NS_ASSUME_NONNULL_BEGIN
  12. @protocol BUNativeExpressSplashViewDelegate <NSObject>
  13. /**
  14. This method is called when splash ad material loaded successfully.
  15. */
  16. - (void)nativeExpressSplashViewDidLoad:(BUNativeExpressSplashView *)splashAdView;
  17. /**
  18. This method is called when splash ad material failed to load.
  19. @param error : the reason of error
  20. */
  21. - (void)nativeExpressSplashView:(BUNativeExpressSplashView *)splashAdView didFailWithError:(NSError * _Nullable)error;
  22. /**
  23. This method is called when rendering a nativeExpressAdView successed.
  24. */
  25. - (void)nativeExpressSplashViewRenderSuccess:(BUNativeExpressSplashView *)splashAdView;
  26. /**
  27. This method is called when a nativeExpressAdView failed to render.
  28. @param error : the reason of error
  29. */
  30. - (void)nativeExpressSplashViewRenderFail:(BUNativeExpressSplashView *)splashAdView error:(NSError * __nullable)error;
  31. /**
  32. This method is called when nativeExpressSplashAdView will be showing.
  33. */
  34. - (void)nativeExpressSplashViewWillVisible:(BUNativeExpressSplashView *)splashAdView;
  35. /**
  36. This method is called when nativeExpressSplashAdView is clicked.
  37. */
  38. - (void)nativeExpressSplashViewDidClick:(BUNativeExpressSplashView *)splashAdView;
  39. /**
  40. This method is called when nativeExpressSplashAdView's skip button is clicked.
  41. */
  42. - (void)nativeExpressSplashViewDidClickSkip:(BUNativeExpressSplashView *)splashAdView;
  43. /**
  44. This method is called when nativeExpressSplashAdView countdown equals to zero
  45. */
  46. - (void)nativeExpressSplashViewCountdownToZero:(BUNativeExpressSplashView *)splashAdView;
  47. /**
  48. This method is called when nativeExpressSplashAdView closed.
  49. */
  50. - (void)nativeExpressSplashViewDidClose:(BUNativeExpressSplashView *)splashAdView;
  51. /**
  52. This method is called when when video ad play completed or an error occurred.
  53. */
  54. - (void)nativeExpressSplashViewFinishPlayDidPlayFinish:(BUNativeExpressSplashView *)splashView didFailWithError:(NSError *)error;
  55. /**
  56. This method is called when another controller has been closed.
  57. @param interactionType : open appstore in app or open the webpage or view video ad details page.
  58. */
  59. - (void)nativeExpressSplashViewDidCloseOtherController:(BUNativeExpressSplashView *)splashView interactionType:(BUInteractionType)interactionType;
  60. @end
  61. @interface BUNativeExpressSplashView : UIView <BUMopubAdMarkUpDelegate>
  62. /**
  63. The delegate for receiving state change messages.
  64. */
  65. @property (nonatomic, weak, nullable) id<BUNativeExpressSplashViewDelegate> delegate;
  66. /**
  67. Maximum allowable load timeout, default 3s, unit s.
  68. */
  69. @property (nonatomic, assign) NSTimeInterval tolerateTimeout;
  70. /**
  71. Whether hide skip button, default NO.
  72. If you hide the skip button, you need to customize the countdown.
  73. */
  74. @property (nonatomic, assign) BOOL hideSkipButton;
  75. /**
  76. Whether the splash ad data has been loaded.
  77. */
  78. @property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
  79. /// media configuration parameters.
  80. @property (nonatomic, copy, readonly) NSDictionary *mediaExt;
  81. /**
  82. Initializes native express splash ad with slot id and frame.
  83. @param slotID : the unique identifier of splash ad
  84. @param adSize : the adSize of native express splashAd view. It is recommended for the mobile phone screen.
  85. @param rootViewController : the root controller for present splash.
  86. @return BUNativeExpressSplashView
  87. */
  88. - (instancetype)initWithSlotID:(NSString *)slotID adSize:(CGSize)adSize rootViewController:(UIViewController *)rootViewController;
  89. /**
  90. Initializes Express Splash video ad with ad slot, adSize and rootViewController.
  91. @param slot A object, through which you can pass in the splash unique identifier, ad type, and so on.
  92. @param adSize the adSize of native express splashAd view. It is recommended for the mobile phone screen.
  93. @param rootViewController the root controller for present splash.
  94. @return BUNativeExpressSplashView
  95. */
  96. - (instancetype)initWithSlot:(BUAdSlot *)slot adSize:(CGSize)adSize rootViewController:(UIViewController *)rootViewController;
  97. /**
  98. Load splash ad datas.
  99. Start the countdown(@tolerateTimeout) as soon as you request datas.
  100. */
  101. - (void)loadAdData;
  102. /**
  103. Remove splash view.
  104. Stop the countdown as soon as you call this method.
  105. 移除开屏视图
  106. 一旦调用这个方法,倒计时将自动停止
  107. */
  108. - (void)removeSplashView;
  109. @end
  110. NS_ASSUME_NONNULL_END