优化私聊页面跟随进游戏房失败

This commit is contained in:
chenguilong
2022-04-01 19:58:00 +08:00
parent c0b005912c
commit 397fbe46c6

View File

@@ -23,6 +23,11 @@
#import "XPMineUserInfoViewController.h"
#import "XPRoomViewController.h"
#import "RoomHostDelegate.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
///Tool
#import "XCCurrentVCStackManager.h"
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, SendMessageViewDelegate, XPSessionMessageHeadViewDelegate>
@@ -33,6 +38,7 @@
@property (nonatomic, strong) SendMessageView * sendMessageView;
///
@property (nonatomic, strong) XPSessionMessageHeadView *followInRoomView;
@property (nonatomic, strong) UserInfoModel *userInfo;
@end
@@ -138,6 +144,7 @@
///
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (userInfo.roomUid) {
self.followInRoomView.hidden = NO;
self.followInRoomView.userInfo = userInfo;
@@ -224,16 +231,30 @@
}
- (void)onFollowInRoom:(NSString *)roomUid {
//退 TODO
__block BOOL isSameRoom = NO;
__block RoomInfoModel *roomModel;
[self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XPRoomViewController class]]) {
[self.navigationController popToRootViewControllerAnimated:NO];
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
[rooomVC exitRoom];
[self.navigationController popToRootViewControllerAnimated:NO];
roomModel = rooomVC.getRoomInfo;
if(rooomVC.getRoomInfo.uid == [roomUid integerValue]) {
isSameRoom = YES;
} else {
[rooomVC exitRoom];
}
*stop = YES;
}
}];
[XPRoomViewController openRoom:roomUid viewController:self];
if (!isSameRoom) {
if (roomModel.type == RoomType_MiniGame) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid fromNick:self.userInfo.nick fromType:UserEnterRoomFromType_Follow_User fromUid:[NSString stringWithFormat:@"%ld", self.userInfo.uid] viewController:[[XCCurrentVCStackManager shareManager] getCurrentVC]];
});
} else {
[XPRoomViewController openRoom:roomUid fromNick:self.userInfo.nick fromType:UserEnterRoomFromType_Follow_User fromUid:[NSString stringWithFormat:@"%ld", self.userInfo.uid] viewController:self];
}
}
}
#pragma mark - SendMessageViewDelegate