个播滚动优化
This commit is contained in:
@@ -221,4 +221,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: 034aba5260596f012774aa92cf2207105b5af99f
|
PODFILE CHECKSUM: 034aba5260596f012774aa92cf2207105b5af99f
|
||||||
|
|
||||||
COCOAPODS: 1.11.2
|
COCOAPODS: 1.11.3
|
||||||
|
@@ -217,12 +217,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)getCurrentRoomInfo:(NSString *)roomUid {
|
- (void)getCurrentRoomInfo:(NSString *)roomUid {
|
||||||
|
NSString * uid= [AccountInfoStorage instance].getUid;
|
||||||
[Api getRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api getRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data];
|
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data];
|
||||||
[[self getView] getCurrentRoomInfo:roomInfo];
|
[[self getView] getCurrentRoomInfoSuccess:roomInfo];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView] getCurrentRoomInfo:nil];
|
[[self getView] getCurrentRoomInfoSuccess:nil];
|
||||||
}] uid:roomUid intoUid:@""];
|
}] uid:roomUid intoUid:uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///获取下一个个播房成功
|
///获取下一个个播房成功
|
||||||
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
|
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
|
||||||
///获取当前房间的信息
|
///获取当前房间的信息
|
||||||
- (void)getCurrentRoomInfo:(RoomInfoModel *_Nullable)roomInfo;
|
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -26,10 +26,6 @@
|
|||||||
@property (nonatomic, assign) id<AnchorRoomScrollViewDelegate> anchorScrollDelegate;
|
@property (nonatomic, assign) id<AnchorRoomScrollViewDelegate> anchorScrollDelegate;
|
||||||
@property (nonatomic, strong) UIView *middleImageView;
|
@property (nonatomic, strong) UIView *middleImageView;
|
||||||
@property (nonatomic,assign) BOOL isCanScrollTop;
|
@property (nonatomic,assign) BOOL isCanScrollTop;
|
||||||
///是不是下一个
|
|
||||||
@property (nonatomic,assign) BOOL isScrollNext;
|
|
||||||
///是不是上一个
|
|
||||||
@property (nonatomic,assign) BOOL isScrollPrevious;
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame;
|
- (instancetype)initWithFrame:(CGRect)frame;
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
@implementation AnchorRoomScrollView
|
@implementation AnchorRoomScrollView
|
||||||
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame
|
- (instancetype)initWithFrame:(CGRect)frame
|
||||||
{
|
{
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
@@ -83,7 +84,6 @@
|
|||||||
[self.topDisplayView stopAnimation];
|
[self.topDisplayView stopAnimation];
|
||||||
[self.downDisplayView stopAnimation];
|
[self.downDisplayView stopAnimation];
|
||||||
self.animatePlay = NO;
|
self.animatePlay = NO;
|
||||||
NSLog(@"动画结束了");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)roomMessageTabelViewStopScroll {
|
- (void)roomMessageTabelViewStopScroll {
|
||||||
@@ -107,7 +107,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||||
NSLog(@"滚动的Y:%.2f", scrollView.contentOffset.y);
|
|
||||||
if (scrollView.contentOffset.y > KScreenHeight) {///乡上滚动
|
if (scrollView.contentOffset.y > KScreenHeight) {///乡上滚动
|
||||||
if (scrollView.contentOffset.y <= (KScreenHeight * 1.5)) {
|
if (scrollView.contentOffset.y <= (KScreenHeight * 1.5)) {
|
||||||
return;
|
return;
|
||||||
@@ -117,15 +116,19 @@
|
|||||||
[self startAnimate:self.downDisplayView];
|
[self startAnimate:self.downDisplayView];
|
||||||
}
|
}
|
||||||
} else {///向下滚动
|
} else {///向下滚动
|
||||||
|
if (self.isCanScrollTop) {
|
||||||
if (scrollView.contentOffset.y > (KScreenHeight * 0.5)) {
|
if (scrollView.contentOffset.y > (KScreenHeight * 0.5)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (!self.animatePlay) {
|
||||||
|
[self startAnimate:self.topDisplayView];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
///刚进来的时候 还不能向上滚动的时候
|
||||||
|
if (!self.animatePlay) {
|
||||||
|
[self startAnimate:self.downDisplayView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.animatePlay) {
|
|
||||||
[self startAnimate:self.topDisplayView];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +151,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[self stopAnimate];
|
[self stopAnimate];
|
||||||
NSLog(@"scrollViewDidEndDeceleratingY:%.2f", scrollView.contentOffset.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -440,6 +440,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma mark - RoomGuestDelegate
|
#pragma mark - RoomGuestDelegate
|
||||||
|
- (void)onRoomChange {
|
||||||
|
if (self.followAnchorTimer != nil) {
|
||||||
|
dispatch_source_cancel(self.followAnchorTimer);
|
||||||
|
}
|
||||||
|
if (self.trumpetTimer != nil) {
|
||||||
|
dispatch_source_cancel(self.trumpetTimer);
|
||||||
|
}
|
||||||
|
if (self.userGiftTimer != nil) {
|
||||||
|
dispatch_source_cancel(self.userGiftTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)onRoomUpdate {
|
- (void)onRoomUpdate {
|
||||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||||
MicroQueueModel * model = [self.delegate.getMicroQueue objectForKey:@"-1"];
|
MicroQueueModel * model = [self.delegate.getMicroQueue objectForKey:@"-1"];
|
||||||
|
@@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)onRoomUpdate;
|
- (void)onRoomUpdate;
|
||||||
- (void)onUserUpdate;
|
- (void)onUserUpdate;
|
||||||
- (void)onRoomEntered;
|
- (void)onRoomEntered;
|
||||||
|
/// 个播 可以切换房间
|
||||||
|
- (void)onRoomChange;
|
||||||
- (void)onRoomMiniEntered;///最小化进房
|
- (void)onRoomMiniEntered;///最小化进房
|
||||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message;
|
- (void)handleNIMNotificationMessage:(NIMMessage *)message;
|
||||||
- (void)handleNIMCustomMessage:(NIMMessage *)message;
|
- (void)handleNIMCustomMessage:(NIMMessage *)message;
|
||||||
|
@@ -114,7 +114,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
///滚动过的个播列表
|
///滚动过的个播列表
|
||||||
@property (nonatomic,strong) NSMutableArray<NSString *> *anchorRoomList;
|
@property (nonatomic,strong) NSMutableArray<NSString *> *anchorRoomList;
|
||||||
///序号
|
///序号
|
||||||
@property (nonatomic,assign) BOOL anchorIndex;
|
@property (nonatomic,assign) NSInteger anchorIndex;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -468,6 +468,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
if (!self.stageView.superview) {
|
if (!self.stageView.superview) {
|
||||||
[self.anchorScrollView insertSubview:self.stageView belowSubview:self.roomHeaderView];
|
[self.anchorScrollView insertSubview:self.stageView belowSubview:self.roomHeaderView];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.mas_equalTo(self.anchorScrollView.middleImageView);
|
make.left.right.mas_equalTo(self.anchorScrollView.middleImageView);
|
||||||
make.top.mas_equalTo(self.roomHeaderView.mas_bottom);
|
make.top.mas_equalTo(self.roomHeaderView.mas_bottom);
|
||||||
@@ -780,21 +781,22 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
|
|
||||||
///获取推荐滚动的个播房列表(只有第一次进房获取)
|
///获取推荐滚动的个播房列表(只有第一次进房获取)
|
||||||
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo {
|
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo {
|
||||||
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
|
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
if (roomInfo) { //获取下一个房间成功
|
if (roomInfo) { //获取下一个房间成功
|
||||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
if (![self.anchorRoomList containsObject:self.roomUid]) {
|
||||||
if (![self.anchorRoomList containsObject:[NSString stringWithFormat:@"%ld", roomInfo.uid]]) {
|
[self.anchorRoomList addObject:self.roomUid];
|
||||||
[self.anchorRoomList addObject:roomUid];
|
|
||||||
}
|
}
|
||||||
self.anchorIndex = self.anchorRoomList.count -1;
|
self.anchorIndex = self.anchorRoomList.count -1;
|
||||||
//1、退出房间操作
|
//1、退出房间操作
|
||||||
|
self.anchorScrollView.isCanScrollTop = YES;
|
||||||
|
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
|
||||||
self.isRequestSuperAdmin = NO;
|
self.isRequestSuperAdmin = NO;
|
||||||
[self exitOldRoom];
|
[self exitOldRoom];
|
||||||
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
||||||
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
||||||
[[RtcManager instance] exitRoom];
|
[[RtcManager instance] exitRoom];
|
||||||
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||||
|
[self.functionView onRoomChange];
|
||||||
//2、移除房间子控件
|
//2、移除房间子控件
|
||||||
[self.backContainerView removeFromSuperview];
|
[self.backContainerView removeFromSuperview];
|
||||||
[self.stageView removeFromSuperview];
|
[self.stageView removeFromSuperview];
|
||||||
@@ -815,16 +817,19 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
///获取房间超管列表
|
///获取房间超管列表
|
||||||
[self.presenter getRoomSuperAdmin:self.roomUid];
|
[self.presenter getRoomSuperAdmin:self.roomUid];
|
||||||
} else {
|
} else {
|
||||||
|
if (self.anchorScrollView.isCanScrollTop) {
|
||||||
|
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
|
||||||
|
} else {
|
||||||
|
self.anchorScrollView.contentOffset = CGPointMake(0, 0);
|
||||||
|
}
|
||||||
[self showErrorToast:@"已经到底啦~自动为您返回当前房间"];
|
[self showErrorToast:@"已经到底啦~自动为您返回当前房间"];
|
||||||
}
|
}
|
||||||
self.anchorScrollView.isScrollNext = NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getCurrentRoomInfo:(RoomInfoModel *)roomInfo {
|
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *)roomInfo {
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
|
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
|
||||||
if (roomInfo && roomInfo.valid) {
|
if (roomInfo && roomInfo.valid) {
|
||||||
|
|
||||||
//1、退出房间操作
|
//1、退出房间操作
|
||||||
self.isRequestSuperAdmin = NO;
|
self.isRequestSuperAdmin = NO;
|
||||||
[self exitOldRoom];
|
[self exitOldRoom];
|
||||||
|
Reference in New Issue
Block a user