烦死了😡
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#import "TTPopup.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XPGiftStorage.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "XCHudTool.h"
|
||||
///Model
|
||||
#import "AttachmentModel.h"
|
||||
@@ -265,7 +264,7 @@
|
||||
[self receiveGift:attachment];
|
||||
} else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
|
||||
NSDictionary * dic = attachment.data;
|
||||
if (((NSString *)dic[@"uid"]).integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
if (((NSString *)dic[@"uid"]).integerValue == self.hostDelegate.getUserInfo.uid) {
|
||||
[self microInvite:dic[@"micPosition"]];
|
||||
}
|
||||
}
|
||||
@@ -316,32 +315,13 @@
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 获取房间角色
|
||||
- (RACSignal *)rac_queryChatRoomMember:(NSString *)uid roomId:(NSString *)roomId{
|
||||
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
[subscriber sendNext:members.firstObject];
|
||||
[subscriber sendCompleted];
|
||||
}else {
|
||||
[subscriber sendNext:nil];
|
||||
[subscriber sendCompleted];
|
||||
}
|
||||
}];
|
||||
return nil;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - StageViewDelegate - 留给子 View 重写的模板方法
|
||||
- (void)didSelectAtIndex:(NSInteger)index {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
MicroQueueModel* micModel = [self.micQueue objectForKey:[self indexToPosition:index]];
|
||||
UserInfoModel* userInfo = self.hostDelegate.getUserInfo;
|
||||
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NSString* position = [self indexToPosition:index];
|
||||
NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
|
||||
void(^nimUpQueue)(NSString*) = ^ (NSString* up){
|
||||
@@ -371,8 +351,6 @@
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
|
||||
TTActionSheetConfig *upMic = [TTActionSheetConfig normalTitle:@"上麦" clickAction:^{
|
||||
NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid];
|
||||
@@ -383,39 +361,41 @@
|
||||
nimUpQueue(position);
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
NSString * lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁";
|
||||
TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{
|
||||
///TODO ; 请求接口
|
||||
// TODO: 请求接口
|
||||
}];
|
||||
|
||||
NSString * muteTitle = micModel.microState.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦";
|
||||
TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{
|
||||
///TODO ; 请求接口
|
||||
// TODO: 请求接口
|
||||
}];
|
||||
|
||||
if (micModel.userInfo && micModel.userInfo.uid > 0) {///坑位上有人 展示用户卡片
|
||||
NSString * targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = position;
|
||||
model.posState = (UserCardMicroPosStateType)micModel.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)micModel.microState.micState;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model delegate:self.hostDelegate];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
} else {///坑位上没人的话 管理员显示上麦/锁麦/闭麦/抱她上麦(目前不做)
|
||||
[[self rac_queryChatRoomMember:uid roomId:roomId] subscribeNext:^(id _Nullable x) {
|
||||
NIMChatroomMember * member = x;
|
||||
if (member == nil) {return;}
|
||||
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {///管理员的话
|
||||
[TTPopup actionSheetWithItems:@[upMic, lockMic, muteMic]];
|
||||
} else {///普通人的话 如果麦位没有锁的话 直接上坑
|
||||
if (micModel.microState.posState == MicroPosStateType_Lock) {return;}
|
||||
nimUpQueue(position);
|
||||
}
|
||||
}];
|
||||
}
|
||||
if (micModel.userInfo && micModel.userInfo.uid > 0) {
|
||||
NSString * targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = position;
|
||||
model.posState = (UserCardMicroPosStateType)micModel.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)micModel.microState.micState;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model delegate:self.hostDelegate];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
} else {
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
if (member == nil) {return;}
|
||||
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {///管理员的话
|
||||
[TTPopup actionSheetWithItems:@[upMic, lockMic, muteMic]];
|
||||
} else {
|
||||
if (micModel.microState.posState == MicroPosStateType_Lock) return;
|
||||
nimUpQueue(position);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
|
Reference in New Issue
Block a user