半屏聊天的完善

This commit is contained in:
fengshuo
2022-06-06 17:52:49 +08:00
parent 7b097735c6
commit eab7fc6274
7 changed files with 92 additions and 25 deletions

View File

@@ -73,14 +73,14 @@
self = [super init];
if (self) {
_session = session;
[self initViews];
[self initLayout];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initViews];
[self initLayout];
[IQKeyboardManager sharedManager].enable = NO;
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
[self initHeaderAndFooterRrfresh];
@@ -130,6 +130,31 @@
}
- (UINavigationController *)getKeyWindowNav {
UIWindow * currentWindow;
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
if(window.tag == 1000) {
currentWindow = window;
break;
}
}
if (self.openType == SessionListOpenTypeRoom) {
[self.navigationController popViewControllerAnimated:YES];
[currentWindow.superview removeFromSuperview];
currentWindow.rootViewController = nil;
currentWindow.windowLevel = -1;
currentWindow = nil;
}
if ([XCCurrentVCStackManager shareManager].currentNavigationController) {
return [XCCurrentVCStackManager shareManager].currentNavigationController;
}
return self.navigationController;
}
#pragma mark - Private Method
- (void)initViews {
self.sessionNavView.isInRoom = self.openType == SessionListOpenTypeRoom;
@@ -141,7 +166,7 @@
- (void)initLayout {
[self.sessionNavView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kNavigationHeight);
make.height.mas_equalTo(self.openType == SessionListOpenTypeRoom ? 44 : kNavigationHeight);
make.left.top.right.mas_equalTo(self.view);
}];
@@ -238,7 +263,7 @@
if (uid.length > 0) {
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
infoVC.uid = uid.integerValue;
[self.navigationController pushViewController:infoVC animated:YES];
[[self getKeyWindowNav] pushViewController:infoVC animated:YES];
}
}
@@ -254,7 +279,7 @@
- (void)sessionNavView:(SessionNavView *)view didClickReport:(UIButton *)sender {
SessionInfoViewController * reportVC = [[SessionInfoViewController alloc] init];
reportVC.userId = self.session.sessionId;
[self.navigationController pushViewController:reportVC animated:YES];
[self.getKeyWindowNav pushViewController:reportVC animated:YES];
}
#pragma mark - UITableViewDataSource
@@ -343,16 +368,16 @@
- (void)onAvatarClick:(NSInteger)uid {
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
infoVC.uid = uid;
[self.navigationController pushViewController:infoVC animated:YES];
[self.getKeyWindowNav pushViewController:infoVC animated:YES];
}
- (void)onFollowInRoom:(NSString *)roomUid {
__block BOOL isSameRoom = NO;
__block RoomInfoModel *roomModel;
[self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[self.getKeyWindowNav.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XPRoomViewController class]]) {
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
[self.navigationController popToRootViewControllerAnimated:NO];
[[self getKeyWindowNav] popToRootViewControllerAnimated:NO];
roomModel = rooomVC.getRoomInfo;
if(rooomVC.getRoomInfo.uid == [roomUid integerValue]) {
isSameRoom = YES;
@@ -397,6 +422,19 @@
}
- (void)didSelectMenuItem:(MessageMenuModel *)info {
UIWindow * currentWindow;
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
if(window.tag == 1000) {
currentWindow = window;
break;
}
}
if (currentWindow) {
currentWindow.windowLevel = -1;
}
switch (info.type) {
case MessageMenuType_Photo:
{