烦死了😡

This commit is contained in:
zu
2021-12-01 17:56:10 +08:00
parent 026f96b561
commit e4e344de6c

View File

@@ -19,7 +19,6 @@
#import "TTPopup.h" #import "TTPopup.h"
#import "XPMacro.h" #import "XPMacro.h"
#import "XPGiftStorage.h" #import "XPGiftStorage.h"
#import "AccountInfoStorage.h"
#import "XCHudTool.h" #import "XCHudTool.h"
///Model ///Model
#import "AttachmentModel.h" #import "AttachmentModel.h"
@@ -265,7 +264,7 @@
[self receiveGift:attachment]; [self receiveGift:attachment];
} else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) { } else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
NSDictionary * dic = attachment.data; 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"]]; [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 #pragma mark - StageViewDelegate - View
- (void)didSelectAtIndex:(NSInteger)index { - (void)didSelectAtIndex:(NSInteger)index {
NSString * uid = [AccountInfoStorage instance].getUid;
MicroQueueModel* micModel = [self.micQueue objectForKey:[self indexToPosition:index]]; MicroQueueModel* micModel = [self.micQueue objectForKey:[self indexToPosition:index]];
UserInfoModel* userInfo = self.hostDelegate.getUserInfo; UserInfoModel* userInfo = self.hostDelegate.getUserInfo;
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo; RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
NSString* position = [self indexToPosition:index]; NSString* position = [self indexToPosition:index];
NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
void(^nimUpQueue)(NSString*) = ^ (NSString* up){ void(^nimUpQueue)(NSString*) = ^ (NSString* up){
@@ -371,8 +351,6 @@
} }
}]; }];
}; };
TTActionSheetConfig *upMic = [TTActionSheetConfig normalTitle:@"上麦" clickAction:^{ TTActionSheetConfig *upMic = [TTActionSheetConfig normalTitle:@"上麦" clickAction:^{
NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid]; NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid];
@@ -383,39 +361,41 @@
nimUpQueue(position); nimUpQueue(position);
} }
}]; }];
NSString * lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁"; NSString * lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁";
TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{ TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{
///TODO ; // TODO:
}]; }];
NSString * muteTitle = micModel.microState.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦"; NSString * muteTitle = micModel.microState.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦";
TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{ TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{
///TODO ; // TODO:
}]; }];
if (micModel.userInfo && micModel.userInfo.uid > 0) {/// if (micModel.userInfo && micModel.userInfo.uid > 0) {
NSString * targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid]; NSString * targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init]; XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
model.uid = targetUid; model.uid = targetUid;
model.position = position; model.position = position;
model.posState = (UserCardMicroPosStateType)micModel.microState.posState; model.posState = (UserCardMicroPosStateType)micModel.microState.posState;
model.micState = (UserCardMicroMicStateType)micModel.microState.micState; model.micState = (UserCardMicroMicStateType)micModel.microState.micState;
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model delegate:self.hostDelegate]; XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model delegate:self.hostDelegate];
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil]; [self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
} else {/// ///() } else {
[[self rac_queryChatRoomMember:uid roomId:roomId] subscribeNext:^(id _Nullable x) { NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
NIMChatroomMember * member = x; request.roomId = roomId;
if (member == nil) {return;} request.userIds = @[uid];
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {/// [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
[TTPopup actionSheetWithItems:@[upMic, lockMic, muteMic]]; NIMChatroomMember * member = members.firstObject;
} else {/// if (member == nil) {return;}
if (micModel.microState.posState == MicroPosStateType_Lock) {return;} if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {///
nimUpQueue(position); [TTPopup actionSheetWithItems:@[upMic, lockMic, muteMic]];
} } else {
}]; if (micModel.microState.posState == MicroPosStateType_Lock) return;
} nimUpQueue(position);
}
}];
}
} }
- (NSInteger)countOfMircoView { - (NSInteger)countOfMircoView {