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