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: () {
Provider.of<RtcProvider>(
Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context,
listen: false,
).joinVoiceRoomSession(context, roomRes.roomProfile?.id ?? "");
roomRes.roomProfile?.id ?? "",
previewSeatCount:
roomRes.roomProfile?.extValues?.roomSetting?.mikeSize?.toInt(),
);
},
);
}

View File

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

View File

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

View File

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

View File

@ -92,20 +92,24 @@ class VoiceRoomRoute implements SCIRouterProvider {
BuildContext context, {
bool rootNavigator = false,
}) {
return Navigator.of(
context,
rootNavigator: rootNavigator,
).push<T>(_buildRoute<T>(const RoomBackgroundSelectPage()));
return Navigator.of(context, rootNavigator: rootNavigator).push<T>(
_buildDarkRoute<T>(
const RoomBackgroundSelectPage(),
settings: RouteSettings(name: roomBackgroundSelect),
),
);
}
static Future<T?> openRoomBackgroundUpload<T>(
BuildContext context, {
bool rootNavigator = false,
}) {
return Navigator.of(
context,
rootNavigator: rootNavigator,
).push<T>(_buildRoute<T>(const RoomBackgroundUploadPage()));
return Navigator.of(context, rootNavigator: rootNavigator).push<T>(
_buildDarkRoute<T>(
const RoomBackgroundUploadPage(),
settings: RouteSettings(name: roomBackgroundUpload),
),
);
}
static Future<T?> openRoomBackgroundPreview<T>(
@ -114,7 +118,10 @@ class VoiceRoomRoute implements SCIRouterProvider {
bool rootNavigator = false,
}) {
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,
onTap: () async {
if (context != null) {
Provider.of<RtcProvider>(
context,
listen: false,
).joinVoiceRoomSession(context, e.id ?? "");
Provider.of<RtcProvider>(context, listen: false).joinVoiceRoomSession(
context,
e.id ?? "",
previewSeatCount: e.extValues?.roomSetting?.mikeSize?.toInt(),
);
}
},
child: Stack(

View File

@ -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<RtmProvider>(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<void> _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();

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

View File

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

View File

@ -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`