个播房无下一个房间时上划处理
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame;
|
- (instancetype)initWithFrame:(CGRect)frame;
|
||||||
|
|
||||||
- (void)updateForAnchorRoomList:(NSMutableArray *)roomArray;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -69,47 +69,15 @@
|
|||||||
self.scrollEnabled = YES;
|
self.scrollEnabled = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateForAnchorRoomList:(NSMutableArray *)livesArray
|
|
||||||
{
|
|
||||||
if (livesArray.count && [livesArray firstObject]) {
|
|
||||||
[self.lives removeAllObjects];
|
|
||||||
[self.lives addObjectsFromArray:livesArray];
|
|
||||||
RoomInfoModel *roomInfo = self.lives[0];
|
|
||||||
self.middleImageView.imageUrl = roomInfo.backPic;
|
|
||||||
}
|
|
||||||
if (livesArray.count > 1) {
|
|
||||||
RoomInfoModel *roomInfo = self.lives[1];
|
|
||||||
self.downImageView.imageUrl = roomInfo.backPic;
|
|
||||||
}
|
|
||||||
self.scrollEnabled = livesArray.count > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)switchPlayer:(UIScrollView*)scrollView
|
- (void)switchPlayer:(UIScrollView*)scrollView
|
||||||
{
|
{
|
||||||
CGFloat offset = scrollView.contentOffset.y;
|
CGFloat offset = scrollView.contentOffset.y;
|
||||||
if (self.lives.count > 1) {
|
|
||||||
if (offset >= self.frame.size.height)
|
if (offset >= self.frame.size.height)
|
||||||
{
|
{
|
||||||
// slides to the down player
|
|
||||||
scrollView.contentOffset = CGPointMake(0, 0);
|
|
||||||
_currentIndex++;
|
|
||||||
self.middleImageView.image = self.downImageView.image;
|
|
||||||
if (_currentIndex == self.lives.count)
|
|
||||||
{
|
|
||||||
_currentIndex = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (self.lives.count > 1) {
|
|
||||||
RoomInfoModel *roomInfo = self.lives[1];
|
|
||||||
self.downImageView.imageUrl = roomInfo.backPic;
|
|
||||||
}
|
|
||||||
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) {
|
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) {
|
||||||
[self.anchorScrollDelegate anchorScrollViewScrollToNext:self];
|
[self.anchorScrollDelegate anchorScrollViewScrollToNext:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
scrollView.contentOffset = CGPointMake(0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||||
|
@@ -104,8 +104,6 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
@property (nonatomic,assign) BOOL isRequestSuperAdmin;
|
@property (nonatomic,assign) BOOL isRequestSuperAdmin;
|
||||||
///是否是最小化进房
|
///是否是最小化进房
|
||||||
@property (nonatomic,assign) BOOL isMiniEnter;
|
@property (nonatomic,assign) BOOL isMiniEnter;
|
||||||
///个播房列表
|
|
||||||
@property (nonatomic, strong) NSMutableArray *cycleAnchorList;
|
|
||||||
///个播上划引导
|
///个播上划引导
|
||||||
@property (nonatomic, strong) AnchorRoomSrollTipView *anchorScrollTipView;
|
@property (nonatomic, strong) AnchorRoomSrollTipView *anchorScrollTipView;
|
||||||
|
|
||||||
@@ -651,7 +649,6 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
if (roomInfo.type == RoomType_Anchor) {//个播房,获取下一个房间
|
if (roomInfo.type == RoomType_Anchor) {//个播房,获取下一个房间
|
||||||
[self handleInitAnchorRoom];
|
[self handleInitAnchorRoom];
|
||||||
[self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
|
||||||
[self showAnchorScrollTipView];
|
[self showAnchorScrollTipView];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -716,7 +713,6 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
self.roomInfo = roomInfo;
|
self.roomInfo = roomInfo;
|
||||||
if (roomInfo.type == RoomType_Anchor) {
|
if (roomInfo.type == RoomType_Anchor) {
|
||||||
[self handleInitAnchorRoom];
|
[self handleInitAnchorRoom];
|
||||||
[self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
|
||||||
[self showAnchorScrollTipView];
|
[self showAnchorScrollTipView];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -758,17 +754,41 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
|
|
||||||
///获取推荐滚动的个播房列表(只有第一次进房获取)
|
///获取推荐滚动的个播房列表(只有第一次进房获取)
|
||||||
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo {
|
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo {
|
||||||
[self.cycleAnchorList addObject:self.roomInfo];
|
self.anchorScrollView.contentOffset = CGPointMake(0, 0);
|
||||||
if (roomInfo) {
|
[self hideHUD];
|
||||||
[self.cycleAnchorList addObject:roomInfo];
|
if (roomInfo) { //获取下一个房间成功
|
||||||
|
//1、退出房间操作
|
||||||
|
self.isRequestSuperAdmin = NO;
|
||||||
|
[self exitOldRoom];
|
||||||
|
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
||||||
|
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
||||||
|
[[RtcManager instance] exitRoom];
|
||||||
|
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||||
|
//2、移除房间子控件
|
||||||
|
[self.backContainerView removeFromSuperview];
|
||||||
|
[self.stageView removeFromSuperview];
|
||||||
|
[self.messageContainerView removeFromSuperview];
|
||||||
|
[self.activityContainerView removeFromSuperview];
|
||||||
|
[self.roomHeaderView removeFromSuperview];
|
||||||
|
[self.functionView removeFromSuperview];
|
||||||
|
self.messageContainerView = nil;
|
||||||
|
self.stageView = nil;
|
||||||
|
[self.menuContainerView removeFromSuperview];
|
||||||
|
self.menuContainerView = nil;
|
||||||
|
//3、重新进入房间
|
||||||
|
self.roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
||||||
|
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
||||||
|
/// 公屏 福袋礼物爆出的礼物 需要依赖 当前房间中的礼物列表 需要提前获取礼物列表 可以拿到礼物 没有想到别的方法去解决这个问题 有需要改的在修改吧
|
||||||
|
[self.presenter getNormalGiftList:self.roomUid];
|
||||||
|
///获取房间超管列表
|
||||||
|
[self.presenter getRoomSuperAdmin:self.roomUid];
|
||||||
|
} else {
|
||||||
|
[self showErrorToast:@"已经到底啦~自动为您返回当前房间"];
|
||||||
}
|
}
|
||||||
//获取到下一个房间信息后,设置可以滚动
|
|
||||||
[self.anchorScrollView updateForAnchorRoomList:self.cycleAnchorList];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///个播房初始化一些操作
|
///个播房初始化一些操作
|
||||||
- (void)handleInitAnchorRoom {
|
- (void)handleInitAnchorRoom {
|
||||||
[self.anchorScrollView updateForAnchorRoomList:nil];
|
|
||||||
if (self.roomInfo.valid) { // 房间有效,直接进入房间
|
if (self.roomInfo.valid) { // 房间有效,直接进入房间
|
||||||
if (self.roomInfo.roomPwd.length > 0 && self.roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue && [XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {//进房密码的情况
|
if (self.roomInfo.roomPwd.length > 0 && self.roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue && [XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {//进房密码的情况
|
||||||
if (!self.isRequestSuperAdmin) {
|
if (!self.isRequestSuperAdmin) {
|
||||||
@@ -932,7 +952,6 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
[self.backContainerView onRoomUpdate];
|
[self.backContainerView onRoomUpdate];
|
||||||
if (self.roomInfo.type == RoomType_Anchor && self.roomInfo.hadChangeRoomType) {///从其他房变为个播房
|
if (self.roomInfo.type == RoomType_Anchor && self.roomInfo.hadChangeRoomType) {///从其他房变为个播房
|
||||||
[self handleInitAnchorRoom];
|
[self handleInitAnchorRoom];
|
||||||
[self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
|
||||||
[self showAnchorScrollTipView];
|
[self showAnchorScrollTipView];
|
||||||
} else if (anchorToOther) {
|
} else if (anchorToOther) {
|
||||||
[self.anchorScrollView removeFromSuperview];
|
[self.anchorScrollView removeFromSuperview];
|
||||||
@@ -1310,34 +1329,8 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[self.view endEditing:YES];
|
[self.view endEditing:YES];
|
||||||
[self.anchorScrollView updateForAnchorRoomList:nil];
|
|
||||||
[self showAnchorLoading];
|
[self showAnchorLoading];
|
||||||
//1、退出房间操作
|
[self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||||
self.isRequestSuperAdmin = NO;
|
|
||||||
[self exitOldRoom];
|
|
||||||
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
|
||||||
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
|
||||||
[[RtcManager instance] exitRoom];
|
|
||||||
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
|
||||||
//2、移除房间子控件
|
|
||||||
[self.backContainerView removeFromSuperview];
|
|
||||||
[self.stageView removeFromSuperview];
|
|
||||||
[self.messageContainerView removeFromSuperview];
|
|
||||||
[self.activityContainerView removeFromSuperview];
|
|
||||||
[self.roomHeaderView removeFromSuperview];
|
|
||||||
[self.functionView removeFromSuperview];
|
|
||||||
self.messageContainerView = nil;
|
|
||||||
self.stageView = nil;
|
|
||||||
[self.menuContainerView removeFromSuperview];
|
|
||||||
self.menuContainerView = nil;
|
|
||||||
//3、重新进入房间
|
|
||||||
RoomInfoModel *roomInfo = [self.cycleAnchorList lastObject];
|
|
||||||
self.roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
|
||||||
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
|
||||||
/// 公屏 福袋礼物爆出的礼物 需要依赖 当前房间中的礼物列表 需要提前获取礼物列表 可以拿到礼物 没有想到别的方法去解决这个问题 有需要改的在修改吧
|
|
||||||
[self.presenter getNormalGiftList:self.roomUid];
|
|
||||||
///获取房间超管列表
|
|
||||||
[self.presenter getRoomSuperAdmin:self.roomUid];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///个播开始滚动
|
///个播开始滚动
|
||||||
@@ -1504,13 +1497,6 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
|||||||
return _anchorScrollView;
|
return _anchorScrollView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray *)cycleAnchorList {
|
|
||||||
if (!_cycleAnchorList) {
|
|
||||||
_cycleAnchorList = [NSMutableArray array];
|
|
||||||
}
|
|
||||||
return _cycleAnchorList;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (AnchorRoomSrollTipView *)anchorScrollTipView {
|
- (AnchorRoomSrollTipView *)anchorScrollTipView {
|
||||||
if (!_anchorScrollTipView) {
|
if (!_anchorScrollTipView) {
|
||||||
_anchorScrollTipView = [[AnchorRoomSrollTipView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
_anchorScrollTipView = [[AnchorRoomSrollTipView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
Reference in New Issue
Block a user