CSJRewardedVideoWebViewControllerVM.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // CSJRewardedVideoWebViewControllerVM.h
  3. // CSJAdSDK
  4. //
  5. // Created by wangyanlin on 2020/8/27.
  6. // Copyright © 2020 bytedance. All rights reserved.
  7. //
  8. #import "CSJWebViewControllerViewModel.h"
  9. #import <UIKit/UIKit.h>
  10. #import "CSJVideoAdEnum.h"
  11. #import "CSJRewardVideoWebDefine.h"
  12. #import "CSJJSB3ExecuteUnitViewModel.h"
  13. #import "CSJRewardedVideoWebDefaultView.h"
  14. NS_ASSUME_NONNULL_BEGIN
  15. #define BURewardAgainCloseNotificationKey @"CSJRewardAgainCloseNotificationKey"
  16. @class CSJRewardedVideoWebViewControllerVM;
  17. @protocol CSJRewardedVideoWebAdapterProtocol <NSObject>
  18. @required
  19. - (NSString *)pageUrlInRewardVideoWebViewModel:(CSJRewardedVideoWebViewControllerVM *)viewModel;
  20. - (NSString *)trackTagInRewardVideoWebViewModel:(CSJRewardedVideoWebViewControllerVM *)viewModel;
  21. @end
  22. @class CSJMaterialMeta;
  23. @class CSJRewardedVideoWebViewController;
  24. @protocol CSJRewardedVideoWebViewDelegate;
  25. // 视频播放但是webview未展示时,为不可见;home键退出时,为不可见
  26. typedef NS_ENUM(NSInteger, BUWebVCLifeCycleStatus) {
  27. BUWebVCLifeCycleStatus_ViewDidDisappear = 0,
  28. BUWebVCLifeCycleStatus_ViewWillAppear = 1,
  29. };
  30. @interface CSJRewardedVideoWebViewControllerVM : CSJWebViewControllerViewModel
  31. <CSJRewardedVideoWebDefaultViewDelegate>
  32. @property (nonatomic, weak, nullable) id<CSJRewardedVideoWebViewDelegate> delegate;
  33. @property (nonatomic, assign) BOOL isTransform; //自己是否旋转
  34. @property (nonatomic, assign) BUChildTransformDirection transformDirection;
  35. @property (nonatomic, assign) BOOL isRewardedVideo; // YES: 激励视频 NO:全屏视频
  36. @property (nonatomic, strong) CSJMaterialMeta *materialMeta;
  37. @property (nonatomic, copy) NSString *ritScene;
  38. /// 是否静音
  39. @property (nonatomic, assign) BOOL mute;
  40. @property (nonatomic, assign) BOOL isLoadFinish;
  41. @property (nonatomic, assign) BOOL hasClosed;
  42. /// 渲染失败出现兜底页
  43. @property (nonatomic, assign) BOOL renderFailed;
  44. /// 3800:再看一个需求
  45. @property (nonatomic, weak) id rewardAd;
  46. /// 弱引用vc
  47. @property (nonatomic, weak) CSJRewardedVideoWebViewController *videoWebVC;
  48. + (instancetype)newWithAd:(CSJMaterialMeta *)materialMeta isNativeExpress:(BOOL)isNativeExpress pageType:(BUVideoWebPageType)pageType;
  49. - (instancetype)initViewControllerWithAd:(CSJMaterialMeta *)materialMeta isNativeExpress:(BOOL)isNativeExpress pageType:(BUVideoWebPageType)pageType;
  50. /// 尝试关闭当前页面
  51. - (void)webCloseButtonTapped;
  52. /// 跳过时长
  53. /// @param duration 时长
  54. - (void)skipRewardDuration:(NSInteger)duration;
  55. #pragma mark - subclass use
  56. @property (nonatomic, strong) CSJRewardedVideoWebDefaultView *defaultView;
  57. @property (nonatomic, strong) UIButton *silentButton;
  58. @property (nonatomic, strong) UIButton *dislikeButton;
  59. @property (nonatomic, strong) UIButton *closeButton;
  60. /// 倒计时长,delayTimeCount初始值无穷大
  61. @property (nonatomic, assign) NSInteger delayTimeCount;
  62. /// 记录页面状态
  63. @property (nonatomic, assign) BUWebVCLifeCycleStatus VCLifeCycleStatus;
  64. /// 3000版本以后,兜底展示逻辑 依赖 js 返回是否渲染成功
  65. @property (nonatomic, assign) BOOL isRenderSuc;
  66. /// 记录 view 状态
  67. @property (nonatomic, assign) BOOL isViewShow;
  68. /// 4200半屏新插屏支持pl落地页,增加该字段,以便布局时区分新插屏和pl落地页
  69. @property (nonatomic, assign) CGSize customSize;
  70. /// jsb注册
  71. - (void)registerJSB_Plugin;
  72. /// 点击跳转appstore
  73. - (NSDictionary *)jsCallNative_open_app_store;
  74. /// h5音量事件
  75. - (void)sendEndcardControlEvent:(BOOL)mute;
  76. /// 更新关闭按钮
  77. - (void)updateCloseButton;
  78. /// 关闭页面
  79. - (void)webCloseAction;
  80. /// 点击音量按钮
  81. - (void)silentButtonTapped;
  82. /// 点击反馈按钮
  83. - (void)dislikeButtonTapped;
  84. - (BOOL)shouldShowRewardAgainAlert;
  85. /// 4600 原生激励是否要展示“再看一个”前置入口
  86. - (BOOL)shouldShowRewardAgainEntrance;
  87. - (void)showRewardAgainAlert;
  88. - (void)showRewardAgainMethod;
  89. - (void)jsCallNative_sendPlayableReward;
  90. @end
  91. NS_ASSUME_NONNULL_END