|
//
// liveListController.m
// ThePaperHD
//
// Created by scar1900 on 15/3/10.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "liveListController.h"
#import "liveTitleCell.h"
#import "liveTopDateCell.h"
#import "liveContTitleCell.h"
#import "liveContentCell.h"
#import "liveVideoCell.h"
#import "liveImageCell.h"
#import "TPImageScannerController.h"
#import "liveContFootCell.h"
//#import "detailContentHomeController.h"
#import "ImageContentController.h"
//#import "topicHomeController.h"
//#import "TPcontentWebController.h"
#import "TPLiveHomeController.h"
#import "Reachability.h"
#define contentPadding isPad?@"12":@"10"
#define CONTENTWIDTH (float)(rect_screen.size.width-60)
#define TABLEWIDTH CONTENTWIDTH
#define cellHeightScale isPad?@"1.1":@"1"
#define videoSizeHight isPad?@"300":@"150"
#define videoPadding isPad?@"10":@"7"
@interface liveListController ()<liveVideoCellDelegate,liveImageDelegate,imageScanerDelegate,
liveFootDelegate,liveViewModelDelegate>
@property(nonatomic, strong)liveInfoBO *liveInfoBO;
@property(nonatomic, strong)NSMutableArray *dataList;
@property(nonatomic, strong)NSMutableArray *heightOfCellInEachSection; //cell高度数组
@property(nonatomic, strong)NSMutableArray *sectionTitleHeightList; // 组头数据源
@end
@implementation liveListController
@synthesize nodeId;
@synthesize livePageBO = _livePageBO;
@synthesize dataList = _dataList;
@synthesize heightOfCellInEachSection,sectionTitleHeightList;
@synthesize liveInfoBO;
//@synthesize moviePlayerController;
@synthesize isVideoPlaying;
@synthesize delegate;
@synthesize viewModel;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.viewModel = [liveViewModel new];
self.viewModel.nodeId = self.nodeId;
self.viewModel.delegate = self;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.clipsToBounds = YES;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsZero;
self.tableView.hidden = YES;
[self configCanRefresh:YES canLoad:YES];
UIPinchGestureRecognizer *zoomGesture = [[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(pinchHandler:)];
zoomGesture.delaysTouchesBegan = YES;
[self.tableView addGestureRecognizer:zoomGesture];
[self manualRefresh];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
}
- (void) reachabilityChanged:(NSNotification *)note
{
if (![Remote IsEableNetwork]) {
return;
}
int readmode = [[TPUserDefault instance].readModeStr intValue];
if (readmode == intelligentMode) {
[self setLivePageBO:self.livePageBO];
}
}
- (void)needrefreshNightMode:(id)sender{
self.view.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.livePageBO = self.livePageBO;
[self.tableView reloadData];
}
- (void)dealloc {
[self stopAndRemoveVideo];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)setLivePageBO:(liveDetailPageVO *)pageBO {
_livePageBO = pageBO;
self.heightOfCellInEachSection = [NSMutableArray array];
self.sectionTitleHeightList = [NSMutableArray array];
__weak typeof(self) weakSelf = self;
[self.viewModel getTableDataSourceWithLivePageData:pageBO completion:^(NSMutableArray *dataSource, NSMutableArray *sectionTitleList, NSMutableArray *heightList, NSString *nextUrl) {
weakSelf.nextUrl = nextUrl;
weakSelf.liveInfoBO = setJsonDicToDataModel(pageBO.liveInfo, [liveInfoBO class]);
weakSelf.heightOfCellInEachSection = [NSMutableArray arrayWithArray:heightList];
weakSelf.sectionTitleHeightList = [NSMutableArray arrayWithArray:sectionTitleList];
weakSelf.dataList = [NSMutableArray arrayWithArray:dataSource];
}];
}
- (void)setDataList:(NSMutableArray *)list {
self.tableView.hidden = NO;
BOOL isListNULL = NO;
if (!_dataList || _dataList.count == 0) {
isListNULL = YES;
}
_dataList = list;
[self.tableView reloadData];
if (isListNULL) {
[CoreAnimationEffect animationEaseOut:self.view];
}
}
- (void)reloadTableWithFontChange {
self.livePageBO = self.livePageBO;
[self.tableView reloadData];
// [self.tableView setContentOffset:CGPointZero animated:YES];
/**
* bug:5672(直播详情页:直播详情页改变字体大小,新闻会自动回到顶部)
*/
}
#pragma mark - refresh and load handler
- (void)pullRefreshHandler {
if (!self.nodeId) {
TPLOG(@"数据有问题,无法获取新数据");
[self endRefresh];
return;
}
[self.viewModel remotePullMethod];
}
- (void)pullLoadMoreHander {
if (!self.nextUrl) {
TPLOG(@"数据有问题,无法获取新数据");
[self loadSuccess];
return;
}
[self.viewModel remotePullLoadMethod:self.nextUrl];
}
#pragma mark - tableView delegate
#pragma mark UITableViewDelegate and UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.dataList?self.dataList.count:0;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (self.dataList && self.dataList.count > 0) {
id obj = self.dataList[section];
if ([obj isKindOfClass:[NSArray class]]) {
NSArray *listArray = obj;
return listArray.count;
}else return 1;
}else return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.heightOfCellInEachSection && self.heightOfCellInEachSection.count > 0) {
id obj = self.heightOfCellInEachSection[indexPath.section];
if ([obj isKindOfClass:[NSArray class]]) {
NSArray *listArray = obj;
NSString *heightStr = listArray[indexPath.row];
return [heightStr floatValue];
}else {
return [obj floatValue];
}
}else return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
NSString *titleHeight = sectionTitleHeightList[section];
if (!isBlankString(titleHeight)) {
return 30;
}else return 0;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if (section != 0) {
// CGFloat padding = 0;
// UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
// if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
// padding = 125;
// }
NSString *title = self.sectionTitleHeightList[section];
if ([title isEqualToString:@""]) {
return nil;
}
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.tableView.frame), 30)];
view.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, TABLEWIDTH, 30)];
backView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
[view addSubview:backView];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, TABLEWIDTH-10, 30)];
label.font = appFont(TEXT_FOUR_LEVELSIZE, NO);
label.textColor = [UIColor colorWithHexString:BLUECOLOR];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = NSTextAlignmentLeft;
[backView addSubview:label];
label.text = title;
[backView makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(view);
}];
return view;
}else return nil;
}
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
id obj = self.dataList[indexPath.section];
if ([obj isKindOfClass:[liveInfoBO class]]) {
return [self getLiveTitleCell:table cellForRowAtIndexPath:indexPath]; //直播标题
}else{
NSArray *list = obj;
id indexObject = list[indexPath.row];
NSDictionary *dic = indexObject;
NSString *type = dic[@"type"];
if ([type isEqualToString:@"topDate"]) { //置顶时间
return [self getTopDateCell:table cellForRowAtIndexPath:indexPath];
}else if ([type isEqualToString:@"topTitle"] || [type isEqualToString:@"contentTitle"]) {
return [self getContTitleCell:table cellForRowAtIndexPath:indexPath]; //文章标题
}else if ([type isMatchedByRegex:@"contentText"]) {
return [self getContTextCell:table cellForRowAtIndexPath:indexPath]; //正文文字
}else if ([type isMatchedByRegex:@"video"]) {
return [self getVideoCell:table cellForRowAtIndexPath:indexPath]; //视频
}else if ([type isMatchedByRegex:@"image"]) {
return [self getImageCell:table cellForRowAtIndexPath:indexPath]; //图片
}else {
return [self getfootCell:table cellForRowAtIndexPath:indexPath]; //分享和查看更多
}
}
}
- (liveTitleCell *)getLiveTitleCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveTitleCell";
liveTitleCell *cell = (liveTitleCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
id obj = self.dataList[indexPath.section];
cell.liveInfo = obj;
return cell;
}
- (liveTopDateCell *)getTopDateCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveTopDateCell";
liveTopDateCell *cell = (liveTopDateCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveTopDateCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
return cell;
}
- (liveContTitleCell *)getContTitleCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveContTitleCell";
liveContTitleCell *cell = (liveContTitleCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveContTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
if (indexPath.row == 0) {
cell.isFirst = YES;
}else cell.isFirst = NO;
return cell;
}
- (liveContentCell *)getContTextCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveContentCell";
liveContentCell *cell = (liveContentCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveContentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
return cell;
}
- (liveVideoCell *)getVideoCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveVideoCell";
liveVideoCell *cell = (liveVideoCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveVideoCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
cell.indexPath = indexPath;
cell.delegate = self;
return cell;
}
- (void)clickVedioImage:(imageObjectBO *)imageBO Cell:(liveVideoCell *)cell {
CGFloat backY = [cell.noImageButton convertRect:cell.noImageButton.bounds toView:KEY_WINDOW].origin.y-64;
NSMutableArray *contentSectionList = self.dataList[cell.indexPath.section];
videoObjectBO *video = cell.dataDic[@"video"];
video.isTap = @"1";
CGFloat videoHeight = [videoSizeHight floatValue]*rect_screen.size.width/320+[videoPadding floatValue];
CGFloat videoDescHeight = [self.viewModel returnContentExtendHeight:getLineSpaceAttributedString(video.name,
[iphoneLineSpaceAndParaSpace returnLevel3LineSpace_specialTopic],
appFont(TEXT_FOUR_LEVELSIZE, NO))];
videoHeight = videoHeight + videoDescHeight;
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:imageBO,@"image",@"video",@"type",video,@"video", nil];
cell.dataDic = dic;
NSMutableArray *heightarray = self.heightOfCellInEachSection[cell.indexPath.section];
[heightarray replaceObjectAtIndex:cell.indexPath.row withObject:[NSString stringWithFormat:@"%f",videoHeight]];
[contentSectionList replaceObjectAtIndex:cell.indexPath.row withObject:dic];
[self.dataList replaceObjectAtIndex:cell.indexPath.section withObject:contentSectionList];
[self.heightOfCellInEachSection replaceObjectAtIndex:cell.indexPath.section withObject:heightarray];
NSArray *array = @[cell.indexPath];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
if (backY < 0) {
[self.tableView beginUpdates];
[self.tableView scrollToRowAtIndexPath:cell.indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
[self.tableView endUpdates];
}
});
}
- (liveImageCell *)getImageCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveImageCell";
liveImageCell *cell = (liveImageCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveImageCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
cell.indexPath = indexPath;
cell.delegate = self;
return cell;
}
- (void)clickImage:(imageObjectBO *)imageBO Cell:(liveImageCell *)cell {
CGFloat backY = [cell.noImageButton convertRect:cell.noImageButton.bounds toView:KEY_WINDOW].origin.y-64;
NSMutableArray *contentSectionList = self.dataList[cell.indexPath.section];
imageBO.isTap = @"1";
NSMutableArray *imageList1 = [NSMutableArray array];
[cell.imageList enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSDictionary *dic = setDataModelToDic(obj, [imageObjectBO class]);
[imageList1 addObject:dic];
}];
NSDictionary *imageDic = @{@"type":@"image",@"imageBO":imageBO,@"imageList":imageList1};
cell.dataDic = imageDic;
NSMutableArray *heightarray = self.heightOfCellInEachSection[cell.indexPath.section];
CGFloat cellHeight = 0;
CGFloat contentWidth = rect_screen.size.width-50-10;
if ([imageBO.width floatValue] > contentWidth) {
cellHeight = [imageBO.height floatValue]*contentWidth/[imageBO.width floatValue];
}else cellHeight = [imageBO.height floatValue]*[cellHeightScale floatValue];
NSAttributedString *attriString = getLineSpaceAttributedString(imageBO.desc,
[iphoneLineSpaceAndParaSpace returnLevel3LineSpace_specialTopic],
appFont(TEXT_FOUR_LEVELSIZE, NO));
CGFloat imageExHeight = [self.viewModel returnContentExtendHeight:attriString];
cellHeight = cellHeight + imageExHeight;
[heightarray replaceObjectAtIndex:cell.indexPath.row withObject:[NSString stringWithFormat:@"%f",cellHeight]];
[contentSectionList replaceObjectAtIndex:cell.indexPath.row withObject:imageDic];
[self.dataList replaceObjectAtIndex:cell.indexPath.section withObject:contentSectionList];
[self.heightOfCellInEachSection replaceObjectAtIndex:cell.indexPath.section withObject:heightarray];
NSArray *array = @[cell.indexPath];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
if (backY < 0) {
[self.tableView beginUpdates];
[self.tableView scrollToRowAtIndexPath:cell.indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
[self.tableView endUpdates];
}
});
}
- (liveContFootCell *)getfootCell:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"liveContFootCell";
liveContFootCell *cell = (liveContFootCell*)[table dequeueReusableCellWithIdentifier:cellID];
if (nil == cell) {
cell = [[liveContFootCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
NSArray *list = self.dataList[indexPath.section];
id obj = list[indexPath.row];
cell.dataDic = obj;
cell.delegate = self;
cell.indexPath = indexPath;
if (indexPath.row == list.count-1) {
cell.isLast = YES;
}else cell.isLast = NO;
return cell;
}
#pragma mark - cell delegate
- (void)clickImage:(imageObjectBO *)imgBO imageList:(NSArray *)imageList withImageView:(UIImageView *)imageView {
TPLOG(@"click Image:%@",imgBO);
NSMutableArray *imageBOArray = [NSMutableArray array];
[imageList enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[imageObjectBO class]]) {
imageObjectBO *imageBO = obj;
if ([imageBO.tags isEqualToString:@"other"]) {
[imageBOArray addObject:imageBO];
}
}
}];
__block NSInteger currentIndex;
[imageBOArray enumerateObjectsUsingBlock:^(imageObjectBO* obj, NSUInteger idx, BOOL *stop) {
if ([obj.name isEqualToString:imgBO.name]) {
currentIndex = idx;
}
}];
TPImageScannerController *imageScanner = [[TPImageScannerController alloc]init];
[self.navigationController pushViewController:imageScanner animated:NO];
[UIView transitionWithView:self.navigationController.view duration:0.35f options:UIViewAnimationOptionTransitionFlipFromLeft animations:nil completion:^(BOOL finished) {
imageScanner.currentIndex = currentIndex;
imageScanner.imageBOList = imageBOArray;
imageScanner.type = contentImageScannerType;
imageScanner.delegate = self;
}];
}
- (void)goToDetailPage:(listContObjectVO *)listBO {
pushContentWithListContentObject(self.navigationController, listBO);
}
- (void)shareEvent:(NSString *)shareText
button:(UIButton *)btn {
if ([self.delegate respondsToSelector:@selector(beginToShare:button:)]) {
[self.delegate beginToShare:shareText button:btn];
}
}
#pragma mark - video play
- (void)clickToPlayVideo:(CGRect)videoFrame indexPath:(NSIndexPath *)indexPath videoBO:(videoObjectBO *)videoBO{
[(TPLiveHomeController *)self.delegate setIsClose:NO];
[self.viewModel adVideoInView:self.view videoFrame:videoFrame videoData:videoBO];
}
- (void)movieTimedOut {
// [self stopAndRemoveVideo];
}
- (void)stopAndRemoveVideo {
[self.viewModel stopAndRemoveVideo];
/**
* bug:5682( 推送:视频播放中收到推送,有如下问题)
*/
}
- (void)moviePlayerWillMoveFromWindow {
}
- (void)turnToright {
[[UIApplication sharedApplication]
setStatusBarOrientation:UIInterfaceOrientationPortrait
animated:NO];
[[UIDevice currentDevice]
setValue:[NSNumber
numberWithInteger:UIInterfaceOrientationPortrait]
forKey:@"orientation"];
[[UIApplication sharedApplication]
setStatusBarOrientation:UIInterfaceOrientationLandscapeRight
animated:NO];
[[UIDevice currentDevice]
setValue:[NSNumber
numberWithInteger:UIInterfaceOrientationLandscapeRight]
forKey:@"orientation"];
}
- (void)turnToPortrait {
[(TPLiveHomeController *)self.delegate setIsClose:YES];
[[UIApplication sharedApplication]
setStatusBarOrientation:UIInterfaceOrientationLandscapeRight
animated:NO];
[[UIDevice currentDevice]
setValue:[NSNumber
numberWithInteger:UIInterfaceOrientationLandscapeRight]
forKey:@"orientation"];
[[UIApplication sharedApplication]
setStatusBarOrientation:UIInterfaceOrientationPortrait
animated:NO];
[[UIDevice currentDevice]
setValue:[NSNumber
numberWithInteger:UIInterfaceOrientationPortrait]
forKey:@"orientation"];
[self.delegate videoEnterFullScreen:NO];
}
#pragma mark - image scanner delegate
- (void)imageContentClick:(imageObjectBO *)imageBO {
[self.navigationController popViewControllerAnimated:NO];
((MLNavigationController *)self.navigationController).canDragBack = YES;
[UIView transitionWithView:self.navigationController.view duration:0.35f options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:^(BOOL finished) {
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - pinchhandler
- (void)pinchHandler:(UIPinchGestureRecognizer*)zoom {
UIGestureRecognizerState state = zoom.state;
if (state == UIGestureRecognizerStateBegan) {
}else if (state == UIGestureRecognizerStateChanged) {
// TPLOG(@"%f",zoom.scale);
}else if (state == UIGestureRecognizerStateEnded) {
// TPLOG(@"end scale:%f",zoom.scale);
CGFloat fontSize = [iphoneLineSpaceAndParaSpace resizeDifDeviceFontToStandardFont:[TPUserDefault instance].contFontSize];
fontSize = round(fontSize);
if (zoom.scale > 1) { //放大
if (fontSize == fontSizeExBig) {
return;
}
if (fontSize == fontSizeExSmall) {
[TPUserDefault instance].contFontSize = fontSizeSmall;
}else if (fontSize == fontSizeSmall) {
[TPUserDefault instance].contFontSize = fontSizeMiddle;
}else if (fontSize == round(fontSizeMiddle)) {
[TPUserDefault instance].contFontSize = fontSizeBig;
}else if (fontSize == fontSizeBig) {
[TPUserDefault instance].contFontSize = fontSizeExBig;
}
[self reloadTableWithFontChange];
}else if (zoom.scale<1){
if (fontSize == fontSizeExSmall) {
return;
}
if (fontSize == fontSizeExBig) {
[TPUserDefault instance].contFontSize = fontSizeBig;
}else if (fontSize == fontSizeBig) {
[TPUserDefault instance].contFontSize = fontSizeMiddle;
}else if (fontSize == round(fontSizeMiddle)) {
[TPUserDefault instance].contFontSize = fontSizeSmall;
}else if (fontSize == fontSizeSmall) {
[TPUserDefault instance].contFontSize = fontSizeExSmall;
}
[self reloadTableWithFontChange];
}
}
}
#pragma mark - viewModel delegate
- (void)getLiveDetailPageData:(liveDetailPageVO *)pageBO {
self.livePageBO = pageBO;
[self endRefresh];
}
- (void)getLiveInfo:(liveInfoBO *)infoBO {
self.liveInfoBO = infoBO;
if ([self.delegate respondsToSelector:@selector(listRefreshed:)]) {
[self.delegate listRefreshed:self.liveInfoBO];
}
}
- (void)returnMoreInfoData:(id)responseData {
__weak typeof(self) weakSelf = self;
[self.viewModel getMoreFootData:self.dataList
responseData:responseData
heightList:heightOfCellInEachSection
titleList:sectionTitleHeightList completion:^(NSMutableArray *dataSource, NSMutableArray *sectionTitleList, NSMutableArray *heightList, NSString *nextUrl) {
weakSelf.heightOfCellInEachSection = [NSMutableArray arrayWithArray:heightList];
weakSelf.sectionTitleHeightList = [NSMutableArray arrayWithArray:sectionTitleList];
weakSelf.dataList = [NSMutableArray arrayWithArray:dataSource];
[self loadSuccess];
weakSelf.nextUrl = nextUrl;
}];
}
- (void)videoEnterFullScreen:(BOOL)isEnterFullScreen {
if ([self.delegate respondsToSelector:@selector(videoEnterFullScreen:)]) {
[self.delegate videoEnterFullScreen:isEnterFullScreen];
}
}
- (void)refreshPage {
if ([self.delegate respondsToSelector:@selector(refreshData)]) {
[self.delegate refreshData];
}
}
- (void)remoteFail:(BOOL)isTimeOut {
[self endRefresh];
[self loadFailed];
if (isTimeOut) {
[self networkTimeOut];
}
} //网络出错
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
|