房间PK修复了抱人上麦协议不对的问题

This commit is contained in:
fengshuo
2022-05-25 15:40:24 +08:00
parent f8fb7e2dfa
commit f172f32b40
4 changed files with 53 additions and 22 deletions

View File

@@ -352,6 +352,16 @@
default:
break;
}
} else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
ArrangeMicUserModel * userInfo = [ArrangeMicUserModel modelWithDictionary:attachment.data];
if (userInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
[self headerRefresh];
}
} else if(attachment.first == CustomMessageType_Room_PK && attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
ArrangeMicUserModel * userInfo = [ArrangeMicUserModel modelWithDictionary:[attachment.data objectForKey:[AccountInfoStorage instance].getUid]];
if (userInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
[self headerRefresh];
}
}
}
} else if(message.messageType == NIMMessageTypeNotification) {
@@ -547,24 +557,46 @@
position = [self findLockPosition];
}
NSString * uid = userInfo.uid;
if (position.length > 0 && uid.length > 0) {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:@(position.integerValue) forKey:@"micPosition"];
[dic setValue:@(uid.integerValue) forKey:@"uid"];
AttachmentModel *attachement = [[AttachmentModel alloc]init];
attachement.first = CustomMessageType_Queue;
attachement.second = Custom_Message_Sub_Queue_Invite;
attachement.data = dic;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachement;
message.messageObject = object;
//
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
[self dismissViewControllerAnimated:YES completion:nil];
} else {
if (position.length > 0) {
if (self.userInfo.type == ArrangeMicType_Room_PK) {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:position forKey:@"position"];
[dic setValue:uid forKey:@"uid"];
[dic setValue:@(userInfo.groupType) forKey:@"groupType"];
[dic setValue:userInfo.nick forKey:@"nick"];
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Room_PK;
attachment.second = Custom_Message_Sub_Room_PK_Manager_Up_Mic;
attachment.data = @{uid:dic};
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
//
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
} else {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:@(position.integerValue) forKey:@"micPosition"];
[dic setValue:@(uid.integerValue) forKey:@"uid"];
AttachmentModel *attachement = [[AttachmentModel alloc]init];
attachement.first = CustomMessageType_Queue;
attachement.second = Custom_Message_Sub_Queue_Invite;
attachement.data = dic;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachement;
message.messageObject = object;
//
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
[self dismissViewControllerAnimated:YES completion:nil];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self headerRefresh];
});
} else {
[self showErrorToast:@"麦上无空位了"];
}
}

View File

@@ -258,7 +258,7 @@
- (NSAttributedString *)createRoomPKAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if (attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
[attribute appendAttributedString:[self createTextAttribute:@"管理员邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"房主/管理员邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
for (NSDictionary * selectuUser in [attachment.data allValues]) {
RoomPKChooseUserModel * userInfoModel = [RoomPKChooseUserModel modelWithDictionary:selectuUser];
if (userInfoModel.groupType != GroupType_default && userInfoModel.nick.length > 0) {

View File

@@ -201,9 +201,7 @@
#pragma mark - Getters And Setters
- (void)setIsManager:(BOOL)isManager {
_isManager = isManager;
if (_isManager) {
self.beginButton.hidden = !_isManager;
}
self.beginButton.hidden = !_isManager;
}
- (void)setPkDetailInfo:(RoomPKDetailInfoModel *)pkDetailInfo {

View File

@@ -880,6 +880,7 @@
- (void)setIsManager:(BOOL)isManager {
_isManager = isManager;
self.beginButton.hidden = !_isManager;
self.roomPKPlayingView.isManager = _isManager;
}
- (void)setRedChooseArray:(NSArray<RoomPKChooseUserModel *> *)redChooseArray {