From edf844c1e89473624313127a112011e866fddf6a Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Thu, 14 Aug 2025 18:04:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=AC=E5=85=B1=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E7=AE=A1=E7=90=86=E5=99=A8=E7=9A=84=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=EF=BC=8C=E5=B9=B6=E5=9C=A8=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=92=8C=E4=BF=A1=E6=81=AF=E8=A1=A5=E5=85=A8=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=E8=B0=83=E7=94=A8=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=9B=E5=9C=A8=E7=9B=B8=E5=85=B3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BC=95=E5=85=A5=E5=85=AC=E5=85=B1=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E7=AE=A1=E7=90=86=E5=99=A8=E7=9A=84=E5=A4=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BB=A5=E6=94=AF=E6=8C=81=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BA=86?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=88=BF=E9=97=B4=E7=AE=A1=E7=90=86=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5=E5=92=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BE=93=E5=87=BA=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=8F=AF=E8=AF=BB=E6=80=A7=E5=92=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .trae/rules/project_rules.md | 0 YuMi/Modules/YMLogin/Api/PILoginManager.m | 4 + .../View/LoginFullInfoViewController.m | 4 + .../YMRoom/Manager/PublicRoomManager.m | 157 +++++++++++------- .../LuckyGiftWinningBannerView.m | 21 ++- .../YMRoom/View/Common/BravoGiftBannerView.m | 24 ++- .../LuckyPackage/LuckyPackageBannerView.m | 23 ++- .../MULTILINE_TEXT_ISSUES_ANALYSIS.md | 6 + .../UNIFIED_TEXT_LAYOUT_README.md | 1 + .../YMTabbar/View/TabbarViewController.m | 17 +- 10 files changed, 193 insertions(+), 64 deletions(-) create mode 100644 .trae/rules/project_rules.md diff --git a/.trae/rules/project_rules.md b/.trae/rules/project_rules.md new file mode 100644 index 00000000..e69de29b diff --git a/YuMi/Modules/YMLogin/Api/PILoginManager.m b/YuMi/Modules/YMLogin/Api/PILoginManager.m index 80a0397f..10fe38b6 100644 --- a/YuMi/Modules/YMLogin/Api/PILoginManager.m +++ b/YuMi/Modules/YMLogin/Api/PILoginManager.m @@ -19,6 +19,7 @@ #import "UserInfoModel.h" #import "XPLoginAuthCodeVC.h" #import "FirstRechargeManager.h" +#import "PublicRoomManager.h" @implementation PILoginManager +(void)loginWithVC:(MvpViewController *)VC isLoginPhone:(BOOL)isLoginPhone{ @@ -86,5 +87,8 @@ // 登录成功并进入主页后,启动首充监控 [[FirstRechargeManager sharedManager] startMonitoring]; + + // 初始化公共房间管理器 + [[PublicRoomManager sharedManager] initialize]; } @end diff --git a/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m b/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m index 86ac15d4..28a4a250 100644 --- a/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m +++ b/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m @@ -24,6 +24,7 @@ #import "LoginFullInfoProtocol.h" #import "PILoginManager.h" #import "ClientConfig.h" +#import "PublicRoomManager.h" #import "RegionListViewController.h" @@ -370,6 +371,9 @@ ///需要重新加载一次 ticket 刷新tabbar的item [[AccountInfoStorage instance] saveTicket:nil]; + // 初始化公共房间管理器 + [[PublicRoomManager sharedManager] initialize]; + NSString * inviteCode = self.codeTextField.text.length > 0 ? self.codeTextField.text : @""; [PILoginManager jumpToHomeVCWithInviteCode:inviteCode]; } diff --git a/YuMi/Modules/YMRoom/Manager/PublicRoomManager.m b/YuMi/Modules/YMRoom/Manager/PublicRoomManager.m index 299546ee..231172ee 100644 --- a/YuMi/Modules/YMRoom/Manager/PublicRoomManager.m +++ b/YuMi/Modules/YMRoom/Manager/PublicRoomManager.m @@ -8,12 +8,14 @@ #import "PublicRoomManager.h" #import "UserInfoModel.h" #import "ClientConfig.h" +#import "AccountModel.h" #import "AccountInfoStorage.h" #import "XPMessageRemoteExtModel.h" #import "AttachmentModel.h" #import "YUMIConstant.h" +#import "XPSkillCardPlayerManager.h" -@interface PublicRoomManager () +@interface PublicRoomManager () @property (nonatomic, assign) BOOL isInitialized; @property (nonatomic, assign) BOOL isInPublicRoom; @@ -58,68 +60,52 @@ return; } - // 检查用户是否已登录 -// NSString *uid = [AccountInfoStorage instance].getUid; -// if (uid.length == 0) { -// NSLog(@"PublicRoomManager: 用户未登录,无法初始化"); -// return; -// } - - // 检查是否已获取到用户信息 -// UserInfoModel *userInfo = [AccountInfoStorage instance].getHomeUserInfo; -// if (!userInfo || !userInfo.partitionId) { -// NSLog(@"PublicRoomManager: 用户信息不完整,等待用户信息更新"); -// return; -// } - - // 检查配置信息是否已加载 -// ClientDataModel *configInfo = [ClientConfig shareConfig].configInfo; -// if (!configInfo || !configInfo.publicChatRoomIdMap) { -// NSLog(@"PublicRoomManager: 配置信息未加载,等待配置更新"); -// return; -// } - - // 保存用户信息 -// self.userInfo = userInfo; -// self.currentUserId = uid; - // 注册云信代理 [[NIMSDK sharedSDK].chatManager addDelegate:self]; + [[NIMSDK sharedSDK].chatroomManager addDelegate:self]; // 标记为已初始化 self.isInitialized = YES; +} + +- (BOOL)checkConfigPublicRoomID:(NSString *)partitionId { + ClientDataModel *configInfo = [ClientConfig shareConfig].configInfo; + if (!configInfo || !configInfo.publicChatRoomIdMap) { + NSLog(@"PublicRoomManager: 配置信息未加载,等待配置更新"); + return NO; + } -// NSLog(@"PublicRoomManager: 初始化成功,用户ID: %@, 分区ID: %@", uid, userInfo.partitionId); + self.currentPublicRoomId = [configInfo.publicChatRoomIdMap objectForKey:partitionId]; - // 尝试进入公共房间 -// [self tryEnterPublicRoom]; + return [NSString isEmpty:self.currentPublicRoomId]; } - (void)reset { NSLog(@"PublicRoomManager: 开始重置"); - // 退出公共房间 + // 退出公共房间(同步等待完成) if (self.isInPublicRoom && self.currentPublicRoomId) { [self exitPublicRoomWithCompletion:^(NSError * _Nullable error) { if (error) { NSLog(@"PublicRoomManager: 退出公共房间失败: %@", error); } else { NSLog(@"PublicRoomManager: 退出公共房间成功"); + + self.currentUserId = nil; + self.userInfo = nil; + + NSLog(@"PublicRoomManager: 重置完成"); } }]; + } else { + NSLog(@"PublicRoomManager: 不在房间,不处理"); } - // 移除云信代理 - [[NIMSDK sharedSDK].chatManager removeDelegate:self]; - // 重置状态 self.isInitialized = NO; self.isInPublicRoom = NO; self.currentPublicRoomId = nil; - self.currentUserId = nil; - self.userInfo = nil; - - NSLog(@"PublicRoomManager: 重置完成"); + } #pragma mark - 状态查询 @@ -139,8 +125,19 @@ #pragma mark - 私有方法 - (void)tryEnterPublicRoom { - if (!self.isInitialized || !self.userInfo) { - NSLog(@"PublicRoomManager: 未初始化或用户信息缺失,无法进入公共房间"); + NSLog(@"PublicRoomManager: 开始尝试进入公共房间"); + NSLog(@"PublicRoomManager: 当前状态 - isInitialized: %@, isInPublicRoom: %@, currentPublicRoomId: %@", + self.isInitialized ? @"YES" : @"NO", + self.isInPublicRoom ? @"YES" : @"NO", + self.currentPublicRoomId ?: @"nil"); + + if (!self.isInitialized) { + NSLog(@"PublicRoomManager: 管理器未初始化,无法进入公共房间"); + return; + } + + if (!self.userInfo) { + NSLog(@"PublicRoomManager: 用户信息缺失,无法进入公共房间"); return; } @@ -149,8 +146,18 @@ ClientDataModel *configInfo = [ClientConfig shareConfig].configInfo; NSDictionary *publicChatRoomIdMap = configInfo.publicChatRoomIdMap; - if (!publicChatRoomIdMap || !partitionId) { - NSLog(@"PublicRoomManager: 公共房间配置或分区ID缺失"); + NSLog(@"PublicRoomManager: 配置信息 - partitionId: %@, configInfo: %@, publicChatRoomIdMap: %@", + partitionId ?: @"nil", + configInfo ? @"存在" : @"nil", + publicChatRoomIdMap ? @"存在" : @"nil"); + + if (!publicChatRoomIdMap) { + NSLog(@"PublicRoomManager: 公共房间配置缺失"); + return; + } + + if (!partitionId) { + NSLog(@"PublicRoomManager: 分区ID缺失"); return; } @@ -167,7 +174,7 @@ if (error) { NSLog(@"PublicRoomManager: 进入公共房间失败: %@", error); } else { - NSLog(@"PublicRoomManager: 进入公共房间成功"); + NSLog(@"PublicRoomManager: 进入公共房间成功,房间ID: %@", roomId.stringValue); } }]; } @@ -176,7 +183,7 @@ if (!self.userInfo) { NSError *error = [NSError errorWithDomain:@"PublicRoomManager" code:-1 - userInfo:@{NSLocalizedDescriptionKey: @"用户信息缺失"}]; + userInfo:@{NSLocalizedDescriptionKey: @"用户信息缺失 nnn"}]; if (completion) { completion(error); } @@ -186,7 +193,6 @@ // 创建进房请求 NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init]; request.roomId = roomId; - // 设置扩展信息 XPMessageRemoteExtModel *extModel = [[XPMessageRemoteExtModel alloc] init]; extModel.defUser = self.userInfo.defUser; @@ -269,6 +275,8 @@ return; } + NSLog(@"PublicRoomManager: room id-%@ 正在尝试退出公共房间", self.currentPublicRoomId); + @kWeakify(self); [[NIMSDK sharedSDK].chatroomManager exitChatroom:self.currentPublicRoomId completion:^(NSError * _Nullable error) { @kStrongify(self); @@ -290,8 +298,17 @@ #pragma mark - 用户信息更新处理 - (void)updateUserInfo:(UserInfoModel *)userInfo { - if (!userInfo || !userInfo.partitionId) { - NSLog(@"PublicRoomManager: 用户信息更新失败,信息不完整"); + NSLog(@"PublicRoomManager: 开始更新用户信息"); + NSLog(@"PublicRoomManager: 用户信息 - uid: %ld, partitionId: %@", + userInfo.uid, userInfo.partitionId ?: @"nil"); + + if (!userInfo) { + NSLog(@"PublicRoomManager: 用户信息为空,更新失败"); + return; + } + + if (!userInfo.partitionId) { + NSLog(@"PublicRoomManager: 用户分区ID缺失,更新失败"); return; } @@ -303,11 +320,25 @@ self.userInfo = userInfo; self.currentUserId = [NSString stringWithFormat:@"%ld", userInfo.uid]; - - // 如果已初始化但未在公共房间,尝试进入 - if (self.isInitialized && !self.isInPublicRoom) { - [self tryEnterPublicRoom]; + if (![self checkConfigPublicRoomID:@(userInfo.uid).stringValue]) { + return; } + + NSLog(@"PublicRoomManager: 用户信息更新完成 - currentUserId: %@, isInitialized: %@, isInPublicRoom: %@", + self.currentUserId, + self.isInitialized ? @"YES" : @"NO", + self.isInPublicRoom ? @"YES" : @"NO"); + + // 注释掉自动进入房间逻辑,改为统一入口控制 + // 如果已初始化但未在公共房间,尝试进入 + // if (self.isInitialized && !self.isInPublicRoom) { + // NSLog(@"PublicRoomManager: 条件满足,开始尝试进入公共房间"); + // [self tryEnterPublicRoom]; + // } else { + // NSLog(@"PublicRoomManager: 条件不满足,跳过进入公共房间 - isInitialized: %@, isInPublicRoom: %@", + // self.isInitialized ? @"YES" : @"NO", + // self.isInPublicRoom ? @"YES" : @"NO"); + // } } #pragma mark - 配置更新处理 @@ -324,10 +355,18 @@ return; } + // 注释掉自动进入房间逻辑,改为统一入口控制 // 如果未在公共房间,尝试进入 - if (!self.isInPublicRoom) { - [self tryEnterPublicRoom]; - } + // if (!self.isInPublicRoom) { + // [self tryEnterPublicRoom]; + // } +} + +#pragma mark - NIMChatRoomManagerDelegate +#define ConnectionStateStyleString(enum) \ + [@[@"Entering", @"EnterOK", @"EnterFailed", @"LoseConnection"] objectAtIndex:(enum)] +- (void)chatroom:(NSString *)roomId connectionStateChanged:(NIMChatroomConnectionState)state { + NSLog(@"PublicRoomManager 房间连接状态: %@", ConnectionStateStyleString(state)); } #pragma mark - NIMChatManagerDelegate @@ -355,9 +394,9 @@ } } - NSLog(@"PublicRoomManager: 收到公共房间消息: %@\n%@", - message.rawAttachContent, - messageExt.roomExt); +// NSLog(@"PublicRoomManager: 收到公共房间消息: %@\n%@", +// message.rawAttachContent, +// messageExt.roomExt); } } } @@ -365,6 +404,12 @@ - (void)handleFirst_106:(AttachmentModel *)attachment message:(NIMMessage *)message { + // 只有用户在房间时,才会转发 + if (![XPSkillCardPlayerManager shareInstance].isInRoom) { + NSLog(@"PublicRoomManager: 用户未在房间中,跳过消息转发"); + return; + } + switch (attachment.second) { case Custom_Message_Sub_Super_Gift: [[NSNotificationCenter defaultCenter] postNotificationName:@"MessageFromPublicRoomWithAttachmentNotification" diff --git a/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m b/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m index 7e7389ac..09489153 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m @@ -199,13 +199,32 @@ exitCurrentRoom:(void(^)(void))exit { return; } + // 在弹框显示前保存必要数据,避免依赖banner对象 + NSString *targetRoomUid = self.model.roomUid; + void(^exitCurrentRoomBlock)(void) = self.exitCurrentRoom; + @kWeakify(self); [TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{ @kStrongify(self); + + // 检查banner是否还存在 + if (!self) { + NSLog(@"⚠️ LuckyGiftWinningBannerView: banner已被移除,但弹框回调仍在执行"); + // 即使banner被移除,仍然执行跳转逻辑 + if (exitCurrentRoomBlock) { + exitCurrentRoomBlock(); + } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [XPRoomViewController openRoom:targetRoomUid + viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + }); + return; + } + + // banner还存在,正常执行 if (self.exitCurrentRoom) { self.exitCurrentRoom(); } - NSString *targetRoomUid = self.model.roomUid; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [XPRoomViewController openRoom:targetRoomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; diff --git a/YuMi/Modules/YMRoom/View/Common/BravoGiftBannerView.m b/YuMi/Modules/YMRoom/View/Common/BravoGiftBannerView.m index e1c05675..50e2eb4a 100644 --- a/YuMi/Modules/YMRoom/View/Common/BravoGiftBannerView.m +++ b/YuMi/Modules/YMRoom/View/Common/BravoGiftBannerView.m @@ -55,9 +55,6 @@ exitCurrentRoom:(void(^)(void))exit { [superView addSubview:banner]; NSInteger time = 3; -//#if DEBUG -// time = 3000; -//#endif @kWeakify(banner); [banner popEnterAnimation:^(BOOL finished) { @@ -148,13 +145,32 @@ exitCurrentRoom:(void(^)(void))exit { return; } + // 在弹框显示前保存必要数据,避免依赖banner对象 + NSNumber *targetRoomUid = self.model.roomUid; + void(^exitCurrentRoomBlock)(void) = self.exitCurrentRoom; + @kWeakify(self); [TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{ @kStrongify(self); + + // 检查banner是否还存在 + if (!self) { + NSLog(@"⚠️ BravoGiftBannerView: banner已被移除,但弹框回调仍在执行"); + // 即使banner被移除,仍然执行跳转逻辑 + if (exitCurrentRoomBlock) { + exitCurrentRoomBlock(); + } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [XPRoomViewController openRoom:targetRoomUid.stringValue + viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + }); + return; + } + + // banner还存在,正常执行 if (self.exitCurrentRoom) { self.exitCurrentRoom(); } - NSNumber *targetRoomUid = self.model.roomUid; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [XPRoomViewController openRoom:targetRoomUid.stringValue viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m index 2e603f7a..635bc61d 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m @@ -204,15 +204,34 @@ exitCurrentRoom:(void(^)(void))exit { return; } + // 在弹框显示前保存必要数据,避免依赖banner对象 + NSInteger targetRoomUid = self.model.roomUid; + void(^exitCurrentRoomBlock)(void) = self.exitCurrentRoom; + @kWeakify(self); [TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{ @kStrongify(self); + + // 检查banner是否还存在 + if (!self) { + NSLog(@"⚠️ LuckyPackageBannerView: banner已被移除,但弹框回调仍在执行"); + // 即使banner被移除,仍然执行跳转逻辑 + if (exitCurrentRoomBlock) { + exitCurrentRoomBlock(); + } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [XPRoomViewController openRoom:@(targetRoomUid).stringValue + viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + }); + return; + } + + // banner还存在,正常执行 if (self.exitCurrentRoom) { self.exitCurrentRoom(); } - NSString *targetRoomUid = @(self.model.roomUid).stringValue; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:targetRoomUid + [XPRoomViewController openRoom:@(targetRoomUid).stringValue viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; }); } cancelHandler:^{}]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MULTILINE_TEXT_ISSUES_ANALYSIS.md b/YuMi/Modules/YMRoom/View/MessageContainerView/MULTILINE_TEXT_ISSUES_ANALYSIS.md index 5f318864..ce3e4187 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MULTILINE_TEXT_ISSUES_ANALYSIS.md +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MULTILINE_TEXT_ISSUES_ANALYSIS.md @@ -95,6 +95,7 @@ make.width.mas_lessThanOrEqualTo(size.width).priority(UILayoutPriorityDefaultHig - 简化约束逻辑,提高可维护性 - 移除冗余计算,提升性能和代码清晰度 - 正确处理 contentLabel 边距,避免文本宽度计算错误 +- 修复 preferredMaxLayoutWidth 设置,确保与文本容器宽度一致 ## 技术要点 @@ -121,6 +122,11 @@ make.width.mas_lessThanOrEqualTo(size.width).priority(UILayoutPriorityDefaultHig - 实际可用宽度 = `kRoomMessageMaxWidth - 24` - 确保文本尺寸计算与实际渲染空间一致 +6. **preferredMaxLayoutWidth 一致性**: + - contentLabel 的 preferredMaxLayoutWidth 必须与文本容器宽度保持一致 + - 设置为 `kRoomMessageMaxWidth - 24`,避免因宽度不匹配导致的文本截断 + - 确保 YYTextLayout 计算和 UILabel 渲染使用相同的宽度基准 + ## 风险评估 - **低风险**: 修改主要是修正错误的参数和方法调用 diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/UNIFIED_TEXT_LAYOUT_README.md b/YuMi/Modules/YMRoom/View/MessageContainerView/UNIFIED_TEXT_LAYOUT_README.md index e564bc77..f1018b00 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/UNIFIED_TEXT_LAYOUT_README.md +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/UNIFIED_TEXT_LAYOUT_README.md @@ -189,6 +189,7 @@ - ✅ 统一的文本布局策略 - ✅ 提高文本尺寸计算的准确性和性能 - ✅ 避免约束冲突导致的布局异常 +- ✅ 修复 preferredMaxLayoutWidth 与文本容器宽度不一致导致的截断问题 ## 风险评估 diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index 3a830d83..a513444d 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -339,6 +339,20 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; [[IAPManager sharedManager] handleLogin]; [[IAPManager sharedManager] retryCheckAllReceipt]; + + // 统一入口:1秒后进入公共房间 +// @kWeakify(self); + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// @kStrongify(self); + NSLog(@"TabbarViewController: 统一入口 - 开始进入公共房间"); + [[PublicRoomManager sharedManager] enterPublicRoomWithCompletion:^(NSError * _Nullable error) { + if (error) { + NSLog(@"TabbarViewController: 进入公共房间失败: %@", error); + } else { + NSLog(@"TabbarViewController: 进入公共房间成功"); + } + }]; + }); } -(void)getRoomGameInfo{ @@ -391,7 +405,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; [[XPSkillCardPlayerManager shareInstance] requestBravoGiftTabInfomation]; [[RoomBoomManager sharedManager] saveUserInfo:userInfo]; - // 更新公共房间管理器的用户信息 + // 初始化PublicRoomManager并更新用户信息 + [[PublicRoomManager sharedManager] initialize]; [[PublicRoomManager sharedManager] updateUserInfo:userInfo]; [self getRoomGameInfo];