1.房间在线人员 2,修复bug
This commit is contained in:
@@ -62,13 +62,14 @@
|
||||
#import "XPWebViewController.h"
|
||||
#import "SessionViewController.h"
|
||||
#import "XPFreeGiftsObtainView.h"
|
||||
|
||||
///P
|
||||
#import "XPRoomPresenter.h"
|
||||
#import "XPRoomProtocol.h"
|
||||
|
||||
#import "XPWeakTimer.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
|
||||
#import "Api+RoomSetting.h"
|
||||
#import "XNDJTDDLoadingTool.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "LittleGameStageView.h"
|
||||
@@ -89,6 +90,9 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否
|
||||
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间
|
||||
|
||||
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate,CountDownHelperDelegate,PIRoomEnterRedPacketViewDelegate,XPReceiveRedPacketViewDelegate,MSSessionReleaseHeadlinesViewDelegate, XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
{
|
||||
NSTimer * timer;
|
||||
}
|
||||
///背景
|
||||
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
||||
|
||||
@@ -249,6 +253,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
- (void)dealloc {
|
||||
#warning to dox - 时刻注意这个方法 功能做完的时候删除此方法
|
||||
NSLog(@"房间销毁了");
|
||||
if(timer != nil){
|
||||
[timer fire];
|
||||
timer = nil;
|
||||
}
|
||||
|
||||
[XPSkillCardPlayerManager shareInstance].photoIdList = nil;
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoomVC = NO;
|
||||
@@ -316,7 +324,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoom = YES;
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(openRedPacketNotification:) name:@"kOpenRedPacketNotification" object:nil];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showSendheadlineView:) name:@"kShowSendheadlineView" object:nil];
|
||||
|
||||
[self addTimer];
|
||||
}
|
||||
|
||||
-(void)showSendheadlineView:(NSNotification *)not{
|
||||
@@ -328,6 +336,13 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
releaseView.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:releaseView];
|
||||
}
|
||||
- (void)addTimer {
|
||||
@kWeakify(self);
|
||||
timer = [XPWeakTimer scheduledTimerWithTimeInterval:10 block:^(id userInfo) {
|
||||
@kStrongify(self);
|
||||
[self getOnlineCount];
|
||||
} userInfo:nil repeats:YES];
|
||||
}
|
||||
#pragma makr- MSSessionReleaseHeadlinesViewDelegate
|
||||
-(void)releaseHeadlinesWithText:(NSString *)text{
|
||||
XPCandyTreeInsufficientBalanceView *balanceView = [[XPCandyTreeInsufficientBalanceView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
@@ -627,7 +642,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self.view insertSubview:self.stageView belowSubview:self.roomHeaderView];
|
||||
}
|
||||
|
||||
[self.functionView updateRankViewConstraintsWityType:self.roomInfo.type];
|
||||
|
||||
if (self.roomInfo.type == RoomType_MiniGame) {
|
||||
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.mas_equalTo(self.view);
|
||||
@@ -1121,7 +1136,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
- (void)enterRoomSuccess:(NIMChatroom *)chatRoom {
|
||||
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
|
||||
// room/get中的房间在线人数 是定时更新的 不是及时刷新
|
||||
self.roomInfo.onlineNum = chatRoom.onlineUserCount;
|
||||
[self getOnlineCount];
|
||||
|
||||
[self.stageView onRoomEntered];
|
||||
[self.functionView onRoomEntered];
|
||||
//上报进房
|
||||
@@ -1137,7 +1153,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)enterRoomFail:(NSInteger)code {
|
||||
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
|
||||
[self hideHUD];
|
||||
@@ -1146,7 +1161,15 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
-(void)getOnlineCount{
|
||||
[Api requestRoomOnlineUserList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
NSArray *list = [XPMessageRemoteExtModel modelsWithArray:data.data];
|
||||
self.roomInfo.onlineNum = list.count;
|
||||
[self.functionView updateOnlineCount:[NSString stringWithFormat:@"%ld",list.count] countList:list isUpdateCount:NO];
|
||||
}
|
||||
} roomUid:self.roomUid];
|
||||
}
|
||||
///请求房间超管成功
|
||||
///这个接口本来是想和roominfo 和userinfo 一起请求的 但是 进房的同步操作 只有超管进入密码房间才会有同步的问题
|
||||
- (void)getRoomSuperAdminScuccess:(NSArray *)list {
|
||||
@@ -1577,6 +1600,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
break;
|
||||
}
|
||||
self.roomInfo.onlineNum = onLineNumber;
|
||||
[self.functionView updateOnlineCount:[NSString stringWithFormat:@"%ld",onLineNumber] countList:@[] isUpdateCount:YES];
|
||||
[self.roomHeaderView onRoomUpdate];
|
||||
[self.stageView handleNIMNotificationMessage:message];
|
||||
[self.animationView handleNIMNotificationMessage:message];
|
||||
@@ -1614,8 +1638,17 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic];
|
||||
self.roomInfo.isCloseScreen = roomInfo.isCloseScreen;
|
||||
|
||||
[self.menuContainerView onRoomUpdate];
|
||||
} else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
|
||||
}else if(attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect){
|
||||
NSDictionary * dic= attachment.data[@"roomInfo"];
|
||||
if (dic.allKeys.count <=0) {
|
||||
dic = attachment.data;
|
||||
}
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic];
|
||||
self.roomInfo.hasAnimationEffect = roomInfo.hasAnimationEffect;
|
||||
}
|
||||
else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
|
||||
NSDictionary *dic = attachment.data;
|
||||
NSString *uid = dic[@"uid"];
|
||||
if (uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
@@ -1696,6 +1729,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
}
|
||||
} else if(message.messageType == NIMMessageTypeText) {
|
||||
@@ -1808,7 +1842,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:attachment.data[@"roomInfo"]];
|
||||
self.roomInfo.isCloseScreen = roomInfo.isCloseScreen;
|
||||
[self.menuContainerView onRoomUpdate];
|
||||
}
|
||||
}else if(attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect){
|
||||
NSDictionary * dic= attachment.data[@"roomInfo"];
|
||||
if (dic.allKeys.count <= 0) {
|
||||
dic = attachment.data;
|
||||
}
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic];
|
||||
self.roomInfo.hasAnimationEffect = roomInfo.hasAnimationEffect;
|
||||
}
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
}
|
||||
}else if(message.messageType == NIMMessageTypeText) {
|
||||
|
Reference in New Issue
Block a user