From 7d12417116cb23ea199e692165ffb670d34a7ed5 Mon Sep 17 00:00:00 2001 From: roxy Date: Wed, 29 Apr 2026 19:04:14 +0800 Subject: [PATCH] bug fix --- .../popular/follow/sc_room_follow_page.dart | 8 ++-- .../popular/history/sc_room_history_page.dart | 8 ++-- .../home/popular/mine/sc_home_mine_page.dart | 10 ++++- .../popular/party/sc_home_party_page.dart | 15 ++++--- lib/modules/room/voice_room_route.dart | 25 +++++++---- lib/modules/search/sc_search_page.dart | 9 ++-- lib/services/audio/rtc_manager.dart | 43 ++++++++++++++++--- lib/services/audio/rtm_manager.dart | 22 ++++++++++ .../widgets/room/seat/room_seat_widget.dart | 1 + 需求进度.md | 1 + 10 files changed, 109 insertions(+), 33 deletions(-) diff --git a/lib/modules/home/popular/follow/sc_room_follow_page.dart b/lib/modules/home/popular/follow/sc_room_follow_page.dart index 96941d4..f5426d8 100644 --- a/lib/modules/home/popular/follow/sc_room_follow_page.dart +++ b/lib/modules/home/popular/follow/sc_room_follow_page.dart @@ -269,10 +269,12 @@ class _RoomFollowPageState ), ), onTap: () { - Provider.of( + Provider.of(context, listen: false).joinVoiceRoomSession( context, - listen: false, - ).joinVoiceRoomSession(context, roomRes.roomProfile?.id ?? ""); + roomRes.roomProfile?.id ?? "", + previewSeatCount: + roomRes.roomProfile?.extValues?.roomSetting?.mikeSize?.toInt(), + ); }, ); } diff --git a/lib/modules/home/popular/history/sc_room_history_page.dart b/lib/modules/home/popular/history/sc_room_history_page.dart index d2fd796..1fd5414 100644 --- a/lib/modules/home/popular/history/sc_room_history_page.dart +++ b/lib/modules/home/popular/history/sc_room_history_page.dart @@ -269,10 +269,12 @@ class _SCRoomHistoryPageState ), ), onTap: () { - Provider.of( + Provider.of(context, listen: false).joinVoiceRoomSession( context, - listen: false, - ).joinVoiceRoomSession(context, roomRes.roomProfile?.id ?? ""); + roomRes.roomProfile?.id ?? "", + previewSeatCount: + roomRes.roomProfile?.extValues?.roomSetting?.mikeSize?.toInt(), + ); }, ); } diff --git a/lib/modules/home/popular/mine/sc_home_mine_page.dart b/lib/modules/home/popular/mine/sc_home_mine_page.dart index df73dfb..5bd651a 100644 --- a/lib/modules/home/popular/mine/sc_home_mine_page.dart +++ b/lib/modules/home/popular/mine/sc_home_mine_page.dart @@ -247,7 +247,15 @@ class _HomeMinePageState extends State Provider.of( context, listen: false, - ).joinVoiceRoomSession(context, roomId); + ).joinVoiceRoomSession( + context, + roomId, + previewSeatCount: + Provider.of( + context, + listen: false, + ).myRoom?.setting?.mikeSize?.toInt(), + ); }, ) : GestureDetector( diff --git a/lib/modules/home/popular/party/sc_home_party_page.dart b/lib/modules/home/popular/party/sc_home_party_page.dart index 4e9903c..641a6b6 100644 --- a/lib/modules/home/popular/party/sc_home_party_page.dart +++ b/lib/modules/home/popular/party/sc_home_party_page.dart @@ -1174,11 +1174,12 @@ class _HomePartyPageState extends State ), ), onTap: () { - Provider.of( - context, - listen: false, - ).joinVoiceRoomSession(context, res.id ?? ""); - }, - ); - } + Provider.of(context, listen: false).joinVoiceRoomSession( + context, + res.id ?? "", + previewSeatCount: res.extValues?.roomSetting?.mikeSize?.toInt(), + ); + }, + ); + } } diff --git a/lib/modules/room/voice_room_route.dart b/lib/modules/room/voice_room_route.dart index 120577d..678083d 100644 --- a/lib/modules/room/voice_room_route.dart +++ b/lib/modules/room/voice_room_route.dart @@ -92,20 +92,24 @@ class VoiceRoomRoute implements SCIRouterProvider { BuildContext context, { bool rootNavigator = false, }) { - return Navigator.of( - context, - rootNavigator: rootNavigator, - ).push(_buildRoute(const RoomBackgroundSelectPage())); + return Navigator.of(context, rootNavigator: rootNavigator).push( + _buildDarkRoute( + const RoomBackgroundSelectPage(), + settings: RouteSettings(name: roomBackgroundSelect), + ), + ); } static Future openRoomBackgroundUpload( BuildContext context, { bool rootNavigator = false, }) { - return Navigator.of( - context, - rootNavigator: rootNavigator, - ).push(_buildRoute(const RoomBackgroundUploadPage())); + return Navigator.of(context, rootNavigator: rootNavigator).push( + _buildDarkRoute( + const RoomBackgroundUploadPage(), + settings: RouteSettings(name: roomBackgroundUpload), + ), + ); } static Future openRoomBackgroundPreview( @@ -114,7 +118,10 @@ class VoiceRoomRoute implements SCIRouterProvider { bool rootNavigator = false, }) { return Navigator.of(context, rootNavigator: rootNavigator).push( - _buildRoute(RoomBackgroundPreviewPage(backgroundPath: backgroundPath)), + _buildDarkRoute( + RoomBackgroundPreviewPage(backgroundPath: backgroundPath), + settings: RouteSettings(name: roomBackgroundPreview), + ), ); } diff --git a/lib/modules/search/sc_search_page.dart b/lib/modules/search/sc_search_page.dart index 405f2a4..98db4a1 100644 --- a/lib/modules/search/sc_search_page.dart +++ b/lib/modules/search/sc_search_page.dart @@ -435,10 +435,11 @@ class _SearchRoomListState extends State { behavior: HitTestBehavior.opaque, onTap: () async { if (context != null) { - Provider.of( - context, - listen: false, - ).joinVoiceRoomSession(context, e.id ?? ""); + Provider.of(context, listen: false).joinVoiceRoomSession( + context, + e.id ?? "", + previewSeatCount: e.extValues?.roomSetting?.mikeSize?.toInt(), + ); } }, child: Stack( diff --git a/lib/services/audio/rtc_manager.dart b/lib/services/audio/rtc_manager.dart index a2cd920..2fc2d41 100644 --- a/lib/services/audio/rtc_manager.dart +++ b/lib/services/audio/rtc_manager.dart @@ -98,6 +98,7 @@ class RealTimeCommunicationManager extends ChangeNotifier { RoomStartupFailureType _roomStartupFailureType = RoomStartupFailureType.none; int _roomStartupFailureToken = 0; int _roomEntryRequestSerial = 0; + int? _previewRoomSeatCount; bool _isHandlingRoomStartupFailure = false; Timer? _micListPollingTimer; Timer? _onlineUsersPollingTimer; @@ -185,6 +186,8 @@ class RealTimeCommunicationManager extends ChangeNotifier { int get roomStartupFailureToken => _roomStartupFailureToken; + int? get previewRoomSeatCount => _previewRoomSeatCount; + bool get shouldShowRoomVisualEffects => currenRoom != null && _roomVisualEffectsEnabled; @@ -1590,6 +1593,7 @@ class RealTimeCommunicationManager extends ChangeNotifier { bool clearRoomData = false, bool needOpenRedenvelope = false, String redPackId = "", + int? previewSeatCount, }) async { int nextTime = DateTime.now().millisecondsSinceEpoch; if (nextTime - startTime < 1000) { @@ -1636,9 +1640,14 @@ class RealTimeCommunicationManager extends ChangeNotifier { return; } rtmProvider = Provider.of(context, listen: false); + rtmProvider?.seedSystemRoomTips( + SCAppLocalizations.of(context)!.systemRoomTips, + ); _setRoomStartupLoading(); setRoomVisualEffectsEnabled(true); + _setPreviewRoomSeatCount(previewSeatCount, notify: false); VoiceRoomRoute.openVoiceRoom(context); + notifyListeners(); final entryRequestSerial = ++_roomEntryRequestSerial; unawaited( _enterAndInitializeVoiceRoomSession( @@ -1671,6 +1680,7 @@ class RealTimeCommunicationManager extends ChangeNotifier { return; } currenRoom = enteredRoom; + _previewRoomSeatCount = null; notifyListeners(); await initializeRoomSession( needOpenRedenvelope: needOpenRedenvelope, @@ -1691,6 +1701,29 @@ class RealTimeCommunicationManager extends ChangeNotifier { _roomStartupStatus == RoomStartupStatus.loading; } + void _setPreviewRoomSeatCount(int? seatCount, {bool notify = true}) { + final normalizedSeatCount = _normalizePreviewRoomSeatCount(seatCount); + if (_previewRoomSeatCount == normalizedSeatCount) { + return; + } + _previewRoomSeatCount = normalizedSeatCount; + if (notify) { + notifyListeners(); + } + } + + int? _normalizePreviewRoomSeatCount(int? seatCount) { + switch (seatCount) { + case 5: + case 10: + case 15: + case 20: + return seatCount; + default: + return null; + } + } + Future _cleanupStaleEnteredRoom(JoinRoomRes enteredRoom) async { final staleRoomId = enteredRoom.roomProfile?.roomProfile?.id ?? ""; if (staleRoomId.isEmpty) { @@ -1762,12 +1795,9 @@ class RealTimeCommunicationManager extends ChangeNotifier { return; } - rtmProvider?.addMsg( - Msg( - groupId: currenRoom?.roomProfile?.roomProfile?.roomAccount ?? "", - msg: SCAppLocalizations.of(context!)!.systemRoomTips, - type: SCRoomMsgType.systemTips, - ), + rtmProvider?.seedSystemRoomTips( + SCAppLocalizations.of(context!)!.systemRoomTips, + groupId: currenRoom?.roomProfile?.roomProfile?.roomAccount ?? "", ); rtmProvider?.addMsg( Msg( @@ -2174,6 +2204,7 @@ class RealTimeCommunicationManager extends ChangeNotifier { ///清空列表数据 void _clearData() { _roomEntryRequestSerial += 1; + _previewRoomSeatCount = null; _stopRoomStatePolling(); _resetHeartbeatTracking(); _resetAgoraTracking(); diff --git a/lib/services/audio/rtm_manager.dart b/lib/services/audio/rtm_manager.dart index 49a5762..901e3c1 100644 --- a/lib/services/audio/rtm_manager.dart +++ b/lib/services/audio/rtm_manager.dart @@ -889,6 +889,28 @@ class RealTimeMessagingManager extends ChangeNotifier { } /// 添加消息 + void seedSystemRoomTips(String tips, {String groupId = ""}) { + final normalizedTips = tips.trim(); + if (normalizedTips.isEmpty) { + return; + } + for (final msg in roomAllMsgList) { + if (msg.type == SCRoomMsgType.systemTips && msg.msg == normalizedTips) { + if ((msg.groupId ?? "").isEmpty && groupId.isNotEmpty) { + msg.groupId = groupId; + } + return; + } + } + addMsg( + Msg( + groupId: groupId, + msg: normalizedTips, + type: SCRoomMsgType.systemTips, + ), + ); + } + addMsg(Msg msg) { final mergedGiftMsg = _mergeGiftMessageIfNeeded(msg); if (mergedGiftMsg != null) { diff --git a/lib/ui_kit/widgets/room/seat/room_seat_widget.dart b/lib/ui_kit/widgets/room/seat/room_seat_widget.dart index f637628..cc210d2 100644 --- a/lib/ui_kit/widgets/room/seat/room_seat_widget.dart +++ b/lib/ui_kit/widgets/room/seat/room_seat_widget.dart @@ -98,6 +98,7 @@ class _RoomSeatWidgetState extends State { configuredSeatCount: provider.currenRoom?.roomProfile?.roomSetting?.mikeSize ?.toInt() ?? + provider.previewRoomSeatCount ?? 0, hasCurrentRoom: provider.currenRoom != null, isExitingCurrentVoiceRoomSession: diff --git a/需求进度.md b/需求进度.md index 05cf4c1..984cef6 100644 --- a/需求进度.md +++ b/需求进度.md @@ -18,6 +18,7 @@ - 已按最新音乐页与房间播放器设计继续对稿:音乐管理页右上角只保留添加按钮,排序/编辑按钮移到 `Total songs` 行末;空态不再展示搜索框,搜索框圆角收到 `17`;歌曲 item 改为 `#08251E` 背景和纵向渐隐描边,播放/暂停按钮移到右侧;左滑删除改为固定 `60` 宽删除按钮,需要点击删除按钮后才删除;音乐相关页面点击波浪反馈已收口移除。 - 已重做房间内音乐入口与播放器:右侧音乐浮标不再旋转,并移动到游戏图标上方;点击浮标改为在房间内打开/隐藏播放器,不再直接进入歌曲管理页;房间播放器使用新增的关闭、最小化、上一首、下一首、进入管理页等素材;当前用户在麦上推送音乐时,自己麦位头像左下角会显示并旋转 `用户正在播放bgm` 标识。 - 已继续修正音乐管理页交互细节:歌曲删除按钮现改为与 item 同一行滑出,不再作为底层背景露出;排序拖拽时使用透明 proxy,去掉默认白边;音乐管理页底部播放器去掉进度条上方多余当前时间和右侧关闭按钮;音乐管理页、文件夹页和歌曲选择页的路由切换改为深色 route,减少进入/添加音乐时的白屏闪烁。 +- 已顺带收口背景相关页面的路由白屏问题:背景选择页、背景上传页和背景预览页现统一走深色 route,避免切换瞬间露出默认白底。 - 已补齐 `en/ar/tr/bn` 四套现有多语言文案;当前项目声明支持 `zh`,但仓库里暂无 `assets/l10n/intl_zh.json`,因此中文兜底仍由页面内 fallback 文案承担。 - 验证进度:`flutter pub get` 已通过;音乐相关目录与房间接线文件的定向 `flutter analyze` 无 error/warning,当前仅 `rtc_manager.dart`、`sc_seat_item.dart` 保留项目原有 info 级别风格/废弃 API 提示;全量 `flutter analyze` 仍被仓库既有测试依赖缺失和测试 API 问题阻断;`flutter build apk --debug` 已通过并生成 `build/app/outputs/flutter-apk/app-debug.apk`。