123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566 |
- //
- // YOUPAIZYSeeVideosVC.m
- // VQU
- //
- // Created by Elaine on 2020/11/17.
- // Copyright © 2020 leo. All rights reserved.
- //
- #import "YOUPAIZYSeeVideosVC.h"
- #import "YOUPAIZYVideoModel.h"
- #import "YOUPAIEyeCatchingWaiterCell.h"
- #import "ZFPlayer.h"
- #import "ZFAVPlayerManager.h"
- #import "YOUPAIZFDouYinControlView.h"
- #import "YOUPAILZUserShowVC.h"
- #import "YOUPAILCIMSessionVC.h"
- #import "YOUPAILZCommonGiftView.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAIXRWalletVC.h"
- @interface YOUPAIZYSeeVideosVC ()<UITableViewDelegate, UITableViewDataSource,EyeCatchingWaiterCellDelegate>
- @property (nonatomic, strong) UITableView *youpaiptableView;
- @property (nonatomic, strong) ZFPlayerController *youpaipzFplayer;
- @property (nonatomic, strong) YOUPAIZFDouYinControlView *youpaipcontrolView;
- @property(nonatomic,assign)NSInteger youpaipcurrentPage;//代表当前页码
- @property(nonatomic,assign)NSInteger youpaiptotalPage;//总页码
- @property (nonatomic,assign)BOOL youpaipisLeavePage;// 是否离开
- @end
- @implementation YOUPAIZYSeeVideosVC
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleLightContent;
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- // self.navigationController.navigationBar.translucent = YES;
- // [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
- self.youpaipisLeavePage = NO;
- [self.youpaipzFplayer.currentPlayerManager play];
- [self.youpaipcontrolView youpaifresetControlView];
-
- self.navigationController.navigationBar.translucent = YES;
- UIImage *img = [UIImage imageWithColor:[LCBkgColor colorWithAlphaComponent:0.0f] size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- [self.navigationController.navigationBar setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
-
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- // [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
- // self.navigationController.navigationBar.translucent = NO;
- self.youpaipisLeavePage = YES;
- [self.youpaipzFplayer.currentPlayerManager pause];
- UIImage *img = [UIImage imageWithColor:LCNavColor size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- [self.navigationController.navigationBar setBackgroundColor:LCNavColor];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:LCNavColor];
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundColor:LCNavColor];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
-
- self.navigationController.navigationBar.translucent = NO;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifrefreshSeeVideoVCGuanZhuNotic:) name:@"refreshSeeVideoVCGuanZhu" object:nil];;
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifrefreshSeeVideoVCGuanZhuNotic:) name:@"ChangeFollowState" object:nil];;
-
- self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifbackClick) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]];
-
- if([self.youpaipuserId isEqualToString:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]){
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]];
- }
- [self youpaifinitTableView];
- [self.youpaiptableView scrollToRowAtIndexPath:self.youpaipindexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
- self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray;
- [self youpaifplayTheVideoAtIndexPath:self.youpaipindexPath];
-
- [self youpaifplayScrollVideo:NO is_follow:3];
-
- }
- -(void)youpaifplayScrollVideo:(BOOL)changeStatus is_follow:(NSInteger)is_follow{
-
- @weakify(self);
- self.youpaipzFplayer.zf_playerShouldPlayInScrollView = ^(NSIndexPath * _Nonnull indexPath) {
- NSLog(@"%@",indexPath);
- @strongify(self);
- YOUPAIEyeCatchingWaiterCell *cell = (YOUPAIEyeCatchingWaiterCell*)[self.youpaiptableView cellForRowAtIndexPath:indexPath];
- if (changeStatus) {
- cell.model.youpaipis_follow = is_follow;
-
- }else{
- }
-
- for(UIView*firstView in cell.subviews) {
- for(UIView*lastView in firstView.subviews) {
- if(lastView.tag == 100) {
- for(UIView*playerPresentView in lastView.subviews) {
- playerPresentView.backgroundColor= [UIColor clearColor];
- }
- }
- }
- }
- };
- }
- -(void)youpaifrefreshSeeVideoVCGuanZhuNotic:(NSNotification*)notification{
-
- NSDictionary *dict = [notification userInfo];
- NSString *idStr = dict[@"follow_uid"];
- NSInteger isfollow = [dict[@"is_follow"] intValue];
- NSArray *arr = self.youpaipvideoDataArray;
- if (arr.count>0) {
- NSIndexPath *index;
- NSMutableArray *arrM = [NSMutableArray new];
- for (int i = 0; i<arr.count; i++) {
- YOUPAIZYVideoModel *model = arr[i];
- if ([model.youpaipuser_id isEqualToString:idStr]) {
- model.youpaipis_follow = isfollow;
- index = [NSIndexPath indexPathForRow:i inSection:0];
- [arrM addObject:index];
-
-
- }
-
- }
- [UIView performWithoutAnimation:^{
- [self.youpaiptableView reloadRowsAtIndexPaths:arrM withRowAnimation:UITableViewRowAnimationFade];
- }];
-
-
-
- }
-
- }
- -(void)dealloc{
-
- [[NSNotificationCenter defaultCenter]removeObserver:self];
- }
- - (void)youpaifbackClick{
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)youpaifmoreClick{
-
- ZCAlertAction*action = [ZCAlertAction actionWithTitle:@"删除" andblock:^{//举报
- if (self.youpaipvideoDataArray.count == 0) {
- return;
- }
- NSInteger row = self.youpaipindexPath.row;
- NSLog(@"row ===%ld",row);
- YOUPAIZYVideoModel *model = self->_youpaipvideoDataArray[row];
- [LCHttpHelper requestWithURLString:TrendsDelete parameters:@{@"vt_id":model.youpaipvideoId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- // [self.videoDataArray removeObjectAtIndex:row];
- // [self.mp4UrlArray removeObjectAtIndex:row];
- // [self.tableView reloadData];
- [self.youpaiptableView.mj_header beginRefreshing];
-
- }
- } failure:^(NSError *error) {
- }];
-
- }];;
-
- ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action]];
- alertSheet.alertWindow.hidden = NO;
- [alertSheet show];
- }
- - (void)youpaifloadNewData{
- self.youpaiptableView.mj_footer.hidden = YES;
- [self.youpaiptableView.mj_footer endRefreshing];//先结束上拉,假如有的话
- [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData];
- self.youpaiptableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadMoreData)];
-
- self.youpaipcurrentPage = 1;
- [LCHttpHelper requestWithURLString:TrendsLists parameters:@{@"page":@(self.youpaipcurrentPage),@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [self.youpaipvideoDataArray removeAllObjects];
- [self.youpaipmp4UrlArray removeAllObjects];
- self.youpaipvideoDataArray = [YOUPAIZYVideoModel mj_objectArrayWithKeyValuesArray:[[dict objectForKey:@"data"] objectForKey:@"list"]];
- self.youpaiptotalPage = [[[dict objectForKey:@"data"] objectForKey:@"total_page"] integerValue];
- NSInteger currentPage = [[[dict objectForKey:@"data"] objectForKey:@"page"] integerValue];
- self.youpaipcurrentPage = currentPage;
- for (YOUPAIZYVideoModel *model in self.youpaipvideoDataArray) {
- [self.youpaipmp4UrlArray addObject:[NSURL URLWithString:model.youpaipfile_url]];
- }
- NSLog(@"%@",self.youpaipmp4UrlArray);
- self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray;
- [self.youpaiptableView reloadData];
- [self.youpaipzFplayer.currentPlayerManager pause];
- if (self.youpaipvideoDataArray.count != 0) {
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
- [self youpaifplayTheVideoAtIndexPath:indexPath];
- if (self.youpaipisLeavePage) {
- [self.youpaipzFplayer.currentPlayerManager pause];
- }
- }
- // __weak typeof(self) weakSelf = self;
-
- // [self.zFplayer zf_filterShouldPlayCellWhileScrolled:^(NSIndexPath *indexPath) {
- // [weakSelf youpaifplayTheVideoAtIndexPath:indexPath];
- // NSLog(@"%@",indexPath);
- // }];
-
- if (currentPage>=self.youpaiptotalPage) {
- [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData];
- self.youpaiptableView.mj_footer.hidden = YES;
- }
- [self.youpaiptableView.mj_header endRefreshing];
- }else{
- [self.youpaiptableView.mj_header endRefreshing];
- }
- } failure:^(NSError *error) {
- [self.youpaiptableView.mj_header endRefreshing];
- }];
- }
- - (void)youpaifloadMoreData{
- //先结束下拉 假如有的话
- [self.youpaiptableView.mj_header endRefreshing];
- [LCHttpHelper requestWithURLString:TrendsLists parameters:@{@"page":@(self.youpaipcurrentPage+1),@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSInteger count = self.youpaipvideoDataArray.count;
-
- NSMutableArray* modelArray = [YOUPAIZYVideoModel mj_objectArrayWithKeyValuesArray:[[dict objectForKey:@"data"]objectForKey:@"list"]];
- [self.youpaipvideoDataArray addObjectsFromArray:modelArray];
-
- self.youpaiptotalPage = [[[dict objectForKey:@"data"] objectForKey:@"total_page"] integerValue];
- NSInteger currentPage = [[[dict objectForKey:@"data"] objectForKey:@"page"] integerValue];
- self.youpaipcurrentPage = currentPage;
-
- for (YOUPAIZYVideoModel *model in modelArray) {
- [self.youpaipmp4UrlArray addObject:[NSURL URLWithString:model.youpaipfile_url]];
- }
-
- self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray;
- [self.youpaiptableView reloadData];
-
- NSIndexPath* indexPath = [NSIndexPath indexPathForRow:count inSection:0];
- [self.youpaiptableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
- [self youpaifplayTheVideoAtIndexPath:indexPath];
- if (self.youpaipisLeavePage) {
- [self.youpaipzFplayer.currentPlayerManager pause];
- }
- // __weak typeof(self) weakSelf = self;
- // [self.zFplayer zf_filterShouldPlayCellWhileScrolled:^(NSIndexPath *indexPath) {
- // [weakSelf youpaifplayTheVideoAtIndexPath:indexPath];
- // }];
-
- if (currentPage>=self.youpaiptotalPage) {
- [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData];
- self.youpaiptableView.mj_footer.hidden = YES;
- }
-
-
- [self.youpaiptableView.mj_header endRefreshing];
- }
- [self.youpaiptableView.mj_footer endRefreshing];
- } failure:^(NSError *error) {
- [self.youpaiptableView.mj_footer endRefreshing];
- }];
- }
- -(void)youpaifinitTableView
- {
- _youpaiptableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
- NSLog(@"%lf",_youpaiptableView.frame.size.height);
-
- _youpaiptableView.pagingEnabled = YES;
- [_youpaiptableView registerClass:[YOUPAIEyeCatchingWaiterCell class] forCellReuseIdentifier:@"YOUPAIEyeCatchingWaiterCell"];
- _youpaiptableView.backgroundColor = [UIColor blackColor];
- _youpaiptableView.delegate = self;
- _youpaiptableView.dataSource = self;
- _youpaiptableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _youpaiptableView.showsVerticalScrollIndicator = NO;
- _youpaiptableView.scrollsToTop = NO;
- if (@available(iOS 11.0, *)) {
- _youpaiptableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- _youpaiptableView.estimatedRowHeight = 0;
- _youpaiptableView.estimatedSectionFooterHeight = 0;
- _youpaiptableView.estimatedSectionHeaderHeight = 0;
- _youpaiptableView.rowHeight = KScreenHeight;
- _youpaiptableView.scrollsToTop = NO;
- _youpaiptableView.mj_header = [LCRefreshDotGiftHeader headerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadNewData)];
- if (@available(iOS 15.0, *)) {
- _youpaiptableView.sectionHeaderTopPadding = 0;
- }
- NSLog(@"%lf",_youpaiptableView.frame.size.height);
- [self.view addSubview:_youpaiptableView];
- }
- /// play the video
- - (void)youpaifplayTheVideoAtIndexPath:(NSIndexPath *)indexPath {
- [self.youpaipzFplayer playTheIndexPath:indexPath];
- [self.youpaipcontrolView youpaifresetControlView];
- YOUPAIZYVideoModel *model = self.youpaipvideoDataArray[indexPath.row];
- [self youpaiftrendsBrowser:model];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- // self.tableView.mj_footer.hidden = self.videoDataArray.count>0?NO:YES;
- return self.youpaipvideoDataArray.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- YOUPAIEyeCatchingWaiterCell * cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIEyeCatchingWaiterCell" forIndexPath:indexPath];
- self.youpaipindexPath = indexPath;
- cell.backgroundColor = [UIColor blackColor];
- YOUPAIZYVideoModel *model = self.youpaipvideoDataArray[indexPath.row];
- cell.model = model;
- cell.delegate = self;
- cell.hidesBottomBar = self.hidesBottomBarWhenPushed;
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [self youpaifplayTheVideoAtIndexPath:indexPath];
- }
- #pragma mark - UIScrollViewDelegate 列表播放必须实现
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
- [scrollView zf_scrollViewDidEndDecelerating];
- }
- - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
- [scrollView zf_scrollViewDidEndDraggingWillDecelerate:decelerate];
- }
- - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {
- [scrollView zf_scrollViewDidScrollToTop];
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- [scrollView zf_scrollViewDidScroll];
- }
- - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
- [scrollView zf_scrollViewWillBeginDragging];
- }
- #pragma mark --- 懒加载
- - (YOUPAIZFDouYinControlView *)youpaipcontrolView {
- if (!_youpaipcontrolView) {
- _youpaipcontrolView = [YOUPAIZFDouYinControlView new];
- }
- return _youpaipcontrolView;
- }
- - (ZFPlayerController *)youpaipzFplayer{
- if (_youpaipzFplayer == nil) {
- ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
- _youpaipzFplayer = [ZFPlayerController playerWithScrollView:self.youpaiptableView playerManager:playerManager containerViewTag:100];
- _youpaipzFplayer.disableGestureTypes = ZFPlayerDisableGestureTypesDoubleTap | ZFPlayerDisableGestureTypesPan | ZFPlayerDisableGestureTypesPinch;
- _youpaipzFplayer.allowOrentitaionRotation = NO;
- _youpaipzFplayer.WWANAutoPlay = YES;
- _youpaipzFplayer.playerDisapperaPercent = 1.0;
- _youpaipzFplayer.controlView = self.youpaipcontrolView;
- __weak typeof(self) weakSelf = self;
- _youpaipzFplayer.playerDidToEnd = ^(id _Nonnull asset) { // 播放结束后重新播放
- [weakSelf.youpaipzFplayer.currentPlayerManager replay];
- };
- _youpaipzFplayer.presentationSizeChanged = ^(id<ZFPlayerMediaPlayback> _Nonnull asset, CGSize size) { // 视频画面显示的模式
- NSInteger index = [weakSelf.youpaipmp4UrlArray indexOfObject:asset.assetURL];
- if (weakSelf.youpaipvideoDataArray.count >= index) {
- YOUPAIZYVideoModel *model = weakSelf.youpaipvideoDataArray[index];
- if (model.youpaipmode == 0) {
- if (size.width >= size.height) {
- model.youpaipmode = UIViewContentModeScaleAspectFit;
- } else {
- model.youpaipmode = UIViewContentModeScaleAspectFill;
- }
- }
- if (model.youpaipmode == UIViewContentModeScaleAspectFit) {
- weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFit;
- }else{
- weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill;
- }
- }
-
- };
- [_youpaipzFplayer setPlayerPrepareToPlay:^(id<ZFPlayerMediaPlayback> _Nonnull asset, NSURL * _Nonnull assetURL) {
- NSInteger index = [weakSelf.youpaipmp4UrlArray indexOfObject:asset.assetURL];
- if (weakSelf.youpaipvideoDataArray.count >= index) {
- YOUPAIZYVideoModel *model = weakSelf.youpaipvideoDataArray[index];
- if (model.youpaipmode == UIViewContentModeScaleAspectFit) {
- weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFit;
- }else{
- weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill;
- }
- }
-
- }];
- /// 停止的时候找出最合适的播放
- _youpaipzFplayer.zf_scrollViewDidEndScrollingCallback = ^(NSIndexPath * _Nonnull indexPath) {
- if (weakSelf.youpaipzFplayer.playingIndexPath) return;
- /// 加载下一页数据
- weakSelf.youpaipzFplayer.assetURLs = weakSelf.youpaipmp4UrlArray;
- [weakSelf.youpaiptableView reloadData];
- [weakSelf youpaifplayTheVideoAtIndexPath:indexPath];
- };
- }
- return _youpaipzFplayer;
- }
- #pragma EyeCatchingWaiterCellDelegate //cell的代理
- - (void)youpaifclickAvatar:(YOUPAIZYVideoModel*)model;//点击了头像
- {
- //LCUserShowVC* userShow = [[LCUserShowVC alloc]init];
- YOUPAILZUserShowVC *userShow = [[YOUPAILZUserShowVC alloc] init];
- userShow.youpaipuserId = model.youpaipuser_id;
- // userShow.videoModel = model;
- // userShow.delegate = self;
- [self.navigationController pushViewController:userShow animated:YES];
-
- }
- -(void)youpaifclickNikname:(YOUPAIZYVideoModel *)model
- {
- YOUPAILZUserShowVC *userShow = [[YOUPAILZUserShowVC alloc] init];
- userShow.youpaipuserId = model.youpaipuser_id;
- // userShow.videoModel = model;
- // userShow.delegate = self;
- [self.navigationController pushViewController:userShow animated:YES];
- }
- - (void)youpaifclickAttention:(YOUPAIZYVideoModel*)model;//点击了关注
- {
- if (model.youpaipis_follow == 0) {//+关注
- [LCCommonHttp followUserId:model.youpaipuser_id];
- model.youpaipis_follow = 1;
- [self.youpaiptableView reloadData];
- }else{
- [LCCommonHttp followUserId:model.youpaipuser_id];
- model.youpaipis_follow = 0;
- [self.youpaiptableView reloadData];
- }
- }
- - (void)youpaifclickSupport:(YOUPAIZYVideoModel*)model;//点击了点赞
- {
- [self.youpaiptableView reloadData];
- }
- -(void)youpaifclickImVideo:(YOUPAIZYVideoModel *)model;//点击了视频
- {
- if ([YOUPAILZChatRoomManager shareManager].chatroomWindow != nil && [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden == NO) {
- [ZCHUDHelper showTitle:@"你正在房间中,暂不可拨打视频"];
- return;
- }
- [UCAuthorityManager cameraAuthority:^{
- [LCHttpHelper requestWithURLString:CallChatType parameters:@{@"to_uid":model.youpaipuser_id,@"type":@"0"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- YOUPAILCVideoChatModel* videoModel = [YOUPAILCVideoChatModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- [[YOUPAILZChatRoomManager shareManager] youpaifcloseChatRoom];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"MeCallVideo" object:nil userInfo:nil];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-
- YOUPAILCVideoRequestVC* chatRequest = [[YOUPAILCVideoRequestVC alloc]init];
- chatRequest.youpaipvideoModel = videoModel;
- //modify by leo fix bug ios13
- ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest];
- chatRequest.view.backgroundColor = HexColorFromRGBA(0x000000, 0.55);
- chatRequest.definesPresentationContext = YES;
- nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;
- [self.navigationController presentViewController:nav animated:YES completion:^{
- // chatRequest.view.backgroundColor = HexColorFromRGBA(0x000000, 0.55);
- }];
- });
- }
- } failure:^(NSError *error) {
- }];
- } denied:^{
- dispatch_async(dispatch_get_main_queue(), ^{
- UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"现在去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
- if ([[UIDevice currentDevice].systemVersion floatValue] < 10.0)
- {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
- }
- else
- {
- // 去系统设置页面
- if (@available(iOS 10.0, *)) {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
- } else {
- // Fallback on earlier versions
- }
- }
- }];
- UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
- [systemAlert addAction:cancelAction];
- [systemAlert addAction:action];
- [self presentViewController: systemAlert animated: YES completion: nil];
- });
- }];
-
-
- }
- //累加视频动态浏览量
- -(void)youpaiftrendsBrowser:(YOUPAIZYVideoModel *)model{
- [LCHttpHelper requestWithURLString:TrendsBrowser parameters:@{@"vt_id":model.youpaipvideoId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSString *view_count = [NSString stringWithFormat:@"%@",[[dict objectForKey:@"data"] objectForKey:@"view_count"]];
- model.youpaipview_count = [view_count integerValue];
- [self.youpaiptableView reloadData];
- }
- } failure:^(NSError *error) {
- }];
- }
- // 点击了礼物
- - (void)youpaifclickGift:(YOUPAIZYVideoModel *)model{
-
- YOUPAILZCommonGiftView *view = [YOUPAILZCommonGiftView new];
- view.isTouchDismiss = YES;
- view.youpaipisAnchor = NO;
- [view setJumToWalletBlock1:^{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:@"InsufficientBalanceNotice" object:nil userInfo:nil];
- YOUPAIXRWalletVC *coinRecharge = [[YOUPAIXRWalletVC alloc]init];
- [self.navigationController pushViewController:coinRecharge animated:YES];
- });
- }];
- [view setYoupaiplzgiftblock:^(YOUPAILCGiftModel * _Nonnull giftModel, NSInteger count,NSString *categoryID) {
- [LCHttpHelper requestWithURLString:SendGift_New parameters:@{@"type":@(6),@"to_uid":model.youpaipuser_id,@"gift_id":giftModel.youpaipid,@"num":@(count),@"gift_type_id":categoryID} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"礼物赠送成功"];
- }
- } failure:^(NSError *error) {
-
- }];
-
- }];
- [self TFPresentVC:view completion:^{
-
-
- }];
- }
- //#pragma mark -- LZUserShowVCDelegate
- //-(void)youpaifclickUserShowVCAttention:(YOUPAIZYVideoModel *)model
- //{
- // [self.tableView reloadData];
- //}
- @end
|