This commit is contained in:
roxy 2026-04-29 19:04:14 +08:00
parent 62d6405aa0
commit 7d12417116
10 changed files with 109 additions and 33 deletions

View File

@ -269,10 +269,12 @@ class _RoomFollowPageState
), ),
), ),
onTap: () { onTap: () {
Provider.of<RtcProvider>( Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context, context,
listen: false, roomRes.roomProfile?.id ?? "",
).joinVoiceRoomSession(context, roomRes.roomProfile?.id ?? ""); previewSeatCount:
roomRes.roomProfile?.extValues?.roomSetting?.mikeSize?.toInt(),
);
}, },
); );
} }

View File

@ -269,10 +269,12 @@ class _SCRoomHistoryPageState
), ),
), ),
onTap: () { onTap: () {
Provider.of<RtcProvider>( Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context, context,
listen: false, roomRes.roomProfile?.id ?? "",
).joinVoiceRoomSession(context, roomRes.roomProfile?.id ?? ""); previewSeatCount:
roomRes.roomProfile?.extValues?.roomSetting?.mikeSize?.toInt(),
);
}, },
); );
} }

View File

@ -247,7 +247,15 @@ class _HomeMinePageState extends State<SCHomeMinePage>
Provider.of<RealTimeCommunicationManager>( Provider.of<RealTimeCommunicationManager>(
context, context,
listen: false, listen: false,
).joinVoiceRoomSession(context, roomId); ).joinVoiceRoomSession(
context,
roomId,
previewSeatCount:
Provider.of<SocialChatRoomManager>(
context,
listen: false,
).myRoom?.setting?.mikeSize?.toInt(),
);
}, },
) )
: GestureDetector( : GestureDetector(

View File

@ -1174,10 +1174,11 @@ class _HomePartyPageState extends State<SCHomePartyPage>
), ),
), ),
onTap: () { onTap: () {
Provider.of<RtcProvider>( Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context, context,
listen: false, res.id ?? "",
).joinVoiceRoomSession(context, res.id ?? ""); previewSeatCount: res.extValues?.roomSetting?.mikeSize?.toInt(),
);
}, },
); );
} }

View File

@ -92,20 +92,24 @@ class VoiceRoomRoute implements SCIRouterProvider {
BuildContext context, { BuildContext context, {
bool rootNavigator = false, bool rootNavigator = false,
}) { }) {
return Navigator.of( return Navigator.of(context, rootNavigator: rootNavigator).push<T>(
context, _buildDarkRoute<T>(
rootNavigator: rootNavigator, const RoomBackgroundSelectPage(),
).push<T>(_buildRoute<T>(const RoomBackgroundSelectPage())); settings: RouteSettings(name: roomBackgroundSelect),
),
);
} }
static Future<T?> openRoomBackgroundUpload<T>( static Future<T?> openRoomBackgroundUpload<T>(
BuildContext context, { BuildContext context, {
bool rootNavigator = false, bool rootNavigator = false,
}) { }) {
return Navigator.of( return Navigator.of(context, rootNavigator: rootNavigator).push<T>(
context, _buildDarkRoute<T>(
rootNavigator: rootNavigator, const RoomBackgroundUploadPage(),
).push<T>(_buildRoute<T>(const RoomBackgroundUploadPage())); settings: RouteSettings(name: roomBackgroundUpload),
),
);
} }
static Future<T?> openRoomBackgroundPreview<T>( static Future<T?> openRoomBackgroundPreview<T>(
@ -114,7 +118,10 @@ class VoiceRoomRoute implements SCIRouterProvider {
bool rootNavigator = false, bool rootNavigator = false,
}) { }) {
return Navigator.of(context, rootNavigator: rootNavigator).push<T>( return Navigator.of(context, rootNavigator: rootNavigator).push<T>(
_buildRoute<T>(RoomBackgroundPreviewPage(backgroundPath: backgroundPath)), _buildDarkRoute<T>(
RoomBackgroundPreviewPage(backgroundPath: backgroundPath),
settings: RouteSettings(name: roomBackgroundPreview),
),
); );
} }

View File

@ -435,10 +435,11 @@ class _SearchRoomListState extends State<SearchRoomList> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () async { onTap: () async {
if (context != null) { if (context != null) {
Provider.of<RtcProvider>( Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context, context,
listen: false, e.id ?? "",
).joinVoiceRoomSession(context, e.id ?? ""); previewSeatCount: e.extValues?.roomSetting?.mikeSize?.toInt(),
);
} }
}, },
child: Stack( child: Stack(

View File

@ -98,6 +98,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
RoomStartupFailureType _roomStartupFailureType = RoomStartupFailureType.none; RoomStartupFailureType _roomStartupFailureType = RoomStartupFailureType.none;
int _roomStartupFailureToken = 0; int _roomStartupFailureToken = 0;
int _roomEntryRequestSerial = 0; int _roomEntryRequestSerial = 0;
int? _previewRoomSeatCount;
bool _isHandlingRoomStartupFailure = false; bool _isHandlingRoomStartupFailure = false;
Timer? _micListPollingTimer; Timer? _micListPollingTimer;
Timer? _onlineUsersPollingTimer; Timer? _onlineUsersPollingTimer;
@ -185,6 +186,8 @@ class RealTimeCommunicationManager extends ChangeNotifier {
int get roomStartupFailureToken => _roomStartupFailureToken; int get roomStartupFailureToken => _roomStartupFailureToken;
int? get previewRoomSeatCount => _previewRoomSeatCount;
bool get shouldShowRoomVisualEffects => bool get shouldShowRoomVisualEffects =>
currenRoom != null && _roomVisualEffectsEnabled; currenRoom != null && _roomVisualEffectsEnabled;
@ -1590,6 +1593,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
bool clearRoomData = false, bool clearRoomData = false,
bool needOpenRedenvelope = false, bool needOpenRedenvelope = false,
String redPackId = "", String redPackId = "",
int? previewSeatCount,
}) async { }) async {
int nextTime = DateTime.now().millisecondsSinceEpoch; int nextTime = DateTime.now().millisecondsSinceEpoch;
if (nextTime - startTime < 1000) { if (nextTime - startTime < 1000) {
@ -1636,9 +1640,14 @@ class RealTimeCommunicationManager extends ChangeNotifier {
return; return;
} }
rtmProvider = Provider.of<RtmProvider>(context, listen: false); rtmProvider = Provider.of<RtmProvider>(context, listen: false);
rtmProvider?.seedSystemRoomTips(
SCAppLocalizations.of(context)!.systemRoomTips,
);
_setRoomStartupLoading(); _setRoomStartupLoading();
setRoomVisualEffectsEnabled(true); setRoomVisualEffectsEnabled(true);
_setPreviewRoomSeatCount(previewSeatCount, notify: false);
VoiceRoomRoute.openVoiceRoom(context); VoiceRoomRoute.openVoiceRoom(context);
notifyListeners();
final entryRequestSerial = ++_roomEntryRequestSerial; final entryRequestSerial = ++_roomEntryRequestSerial;
unawaited( unawaited(
_enterAndInitializeVoiceRoomSession( _enterAndInitializeVoiceRoomSession(
@ -1671,6 +1680,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
return; return;
} }
currenRoom = enteredRoom; currenRoom = enteredRoom;
_previewRoomSeatCount = null;
notifyListeners(); notifyListeners();
await initializeRoomSession( await initializeRoomSession(
needOpenRedenvelope: needOpenRedenvelope, needOpenRedenvelope: needOpenRedenvelope,
@ -1691,6 +1701,29 @@ class RealTimeCommunicationManager extends ChangeNotifier {
_roomStartupStatus == RoomStartupStatus.loading; _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<void> _cleanupStaleEnteredRoom(JoinRoomRes enteredRoom) async { Future<void> _cleanupStaleEnteredRoom(JoinRoomRes enteredRoom) async {
final staleRoomId = enteredRoom.roomProfile?.roomProfile?.id ?? ""; final staleRoomId = enteredRoom.roomProfile?.roomProfile?.id ?? "";
if (staleRoomId.isEmpty) { if (staleRoomId.isEmpty) {
@ -1762,12 +1795,9 @@ class RealTimeCommunicationManager extends ChangeNotifier {
return; return;
} }
rtmProvider?.addMsg( rtmProvider?.seedSystemRoomTips(
Msg( SCAppLocalizations.of(context!)!.systemRoomTips,
groupId: currenRoom?.roomProfile?.roomProfile?.roomAccount ?? "", groupId: currenRoom?.roomProfile?.roomProfile?.roomAccount ?? "",
msg: SCAppLocalizations.of(context!)!.systemRoomTips,
type: SCRoomMsgType.systemTips,
),
); );
rtmProvider?.addMsg( rtmProvider?.addMsg(
Msg( Msg(
@ -2174,6 +2204,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
/// ///
void _clearData() { void _clearData() {
_roomEntryRequestSerial += 1; _roomEntryRequestSerial += 1;
_previewRoomSeatCount = null;
_stopRoomStatePolling(); _stopRoomStatePolling();
_resetHeartbeatTracking(); _resetHeartbeatTracking();
_resetAgoraTracking(); _resetAgoraTracking();

View File

@ -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) { addMsg(Msg msg) {
final mergedGiftMsg = _mergeGiftMessageIfNeeded(msg); final mergedGiftMsg = _mergeGiftMessageIfNeeded(msg);
if (mergedGiftMsg != null) { if (mergedGiftMsg != null) {

View File

@ -98,6 +98,7 @@ class _RoomSeatWidgetState extends State<RoomSeatWidget> {
configuredSeatCount: configuredSeatCount:
provider.currenRoom?.roomProfile?.roomSetting?.mikeSize provider.currenRoom?.roomProfile?.roomSetting?.mikeSize
?.toInt() ?? ?.toInt() ??
provider.previewRoomSeatCount ??
0, 0,
hasCurrentRoom: provider.currenRoom != null, hasCurrentRoom: provider.currenRoom != null,
isExitingCurrentVoiceRoomSession: isExitingCurrentVoiceRoomSession:

View File

@ -18,6 +18,7 @@
- 已按最新音乐页与房间播放器设计继续对稿:音乐管理页右上角只保留添加按钮,排序/编辑按钮移到 `Total songs` 行末;空态不再展示搜索框,搜索框圆角收到 `17`;歌曲 item 改为 `#08251E` 背景和纵向渐隐描边,播放/暂停按钮移到右侧;左滑删除改为固定 `60` 宽删除按钮,需要点击删除按钮后才删除;音乐相关页面点击波浪反馈已收口移除。 - 已按最新音乐页与房间播放器设计继续对稿:音乐管理页右上角只保留添加按钮,排序/编辑按钮移到 `Total songs` 行末;空态不再展示搜索框,搜索框圆角收到 `17`;歌曲 item 改为 `#08251E` 背景和纵向渐隐描边,播放/暂停按钮移到右侧;左滑删除改为固定 `60` 宽删除按钮,需要点击删除按钮后才删除;音乐相关页面点击波浪反馈已收口移除。
- 已重做房间内音乐入口与播放器:右侧音乐浮标不再旋转,并移动到游戏图标上方;点击浮标改为在房间内打开/隐藏播放器,不再直接进入歌曲管理页;房间播放器使用新增的关闭、最小化、上一首、下一首、进入管理页等素材;当前用户在麦上推送音乐时,自己麦位头像左下角会显示并旋转 `用户正在播放bgm` 标识。 - 已重做房间内音乐入口与播放器:右侧音乐浮标不再旋转,并移动到游戏图标上方;点击浮标改为在房间内打开/隐藏播放器,不再直接进入歌曲管理页;房间播放器使用新增的关闭、最小化、上一首、下一首、进入管理页等素材;当前用户在麦上推送音乐时,自己麦位头像左下角会显示并旋转 `用户正在播放bgm` 标识。
- 已继续修正音乐管理页交互细节:歌曲删除按钮现改为与 item 同一行滑出,不再作为底层背景露出;排序拖拽时使用透明 proxy去掉默认白边音乐管理页底部播放器去掉进度条上方多余当前时间和右侧关闭按钮音乐管理页、文件夹页和歌曲选择页的路由切换改为深色 route减少进入/添加音乐时的白屏闪烁。 - 已继续修正音乐管理页交互细节:歌曲删除按钮现改为与 item 同一行滑出,不再作为底层背景露出;排序拖拽时使用透明 proxy去掉默认白边音乐管理页底部播放器去掉进度条上方多余当前时间和右侧关闭按钮音乐管理页、文件夹页和歌曲选择页的路由切换改为深色 route减少进入/添加音乐时的白屏闪烁。
- 已顺带收口背景相关页面的路由白屏问题:背景选择页、背景上传页和背景预览页现统一走深色 route避免切换瞬间露出默认白底。
- 已补齐 `en/ar/tr/bn` 四套现有多语言文案;当前项目声明支持 `zh`,但仓库里暂无 `assets/l10n/intl_zh.json`,因此中文兜底仍由页面内 fallback 文案承担。 - 已补齐 `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` - 验证进度:`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`