feat(player): 选集面板挑集后记住上次选集
This commit is contained in:
1 parent
08aa6903d2
commit
799f3d1b7d
1 file changed
+15
@@ -173,6 +173,8 @@ class PlayerLogic extends ChangeNotifier {
|
||||
/// 推荐页每页一个 logic,若只保留最后一次注册的 handler,
|
||||
/// 相邻预加载页会盖掉正在播放页的注册,导致小窗 UI 不隐藏且无声音。
|
||||
static final Set<PlayerLogic> _pipSubscribers = <PlayerLogic>{};
|
||||
/// 「记住上次选集」:dramaId → 集号。只在用户从选集面板主动挑集时写入
|
||||
/// (见 [_recordPickedEpisode]),feed 里同一部剧据此显示上次选中的集。
|
||||
static final Map<String, int> pickedEpisode = {};
|
||||
final Set<String> _unlockedEpisodeIds = {};
|
||||
final Map<String, EpisodeStats> _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<void> selectEpisode(
|
||||
int index, {
|
||||
int? revision,
|
||||
|
||||
Reference in new issue
Block a user