From 799f3d1b7d5a375ed1787ac9eac42139e6b4dafd Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Wed, 28 Oct 2026 18:47:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(player):=20=E9=80=89=E9=9B=86=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=8C=91=E9=9B=86=E5=90=8E=E8=AE=B0=E4=BD=8F=E4=B8=8A?= =?UTF-8?q?=E6=AC=A1=E9=80=89=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/player/player_logic.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/pages/player/player_logic.dart b/lib/pages/player/player_logic.dart index 4685810..c20607a 100644 --- a/lib/pages/player/player_logic.dart +++ b/lib/pages/player/player_logic.dart @@ -173,6 +173,8 @@ class PlayerLogic extends ChangeNotifier { /// 推荐页每页一个 logic,若只保留最后一次注册的 handler, /// 相邻预加载页会盖掉正在播放页的注册,导致小窗 UI 不隐藏且无声音。 static final Set _pipSubscribers = {}; + /// 「记住上次选集」:dramaId → 集号。只在用户从选集面板主动挑集时写入 + /// (见 [_recordPickedEpisode]),feed 里同一部剧据此显示上次选中的集。 static final Map pickedEpisode = {}; final Set _unlockedEpisodeIds = {}; final Map _episodeStats = {}; @@ -1608,6 +1610,7 @@ class PlayerLogic extends ChangeNotifier { _pendingSelectionIndex = null; _pendingSelectionRevision = null; await selectEpisode(index, revision: revision); + _recordPickedEpisode(index); } } finally { _selectionDrain = null; @@ -1620,6 +1623,18 @@ class PlayerLogic extends ChangeNotifier { } } + /// 记录用户从选集面板主动挑的集,供 feed 侧「记住上次选集」展示。 + /// 只在切集确实落到该集时记录,避免快速连点时把没播过的集记成"上次选集"。 + void _recordPickedEpisode(int index) { + if (!_started || _disposed || session.currentIndex != index) return; + if (index < 0 || index >= sessionEpisodes.length) return; + final episode = sessionEpisodes[index]; + final dramaId = _dramaIdForEpisode(episode.id); + if (dramaId != null) { + pickedEpisode[dramaId] = episode.number; + } + } + Future selectEpisode( int index, { int? revision,