feat(library): 支持设备追剧与观看历史

This commit is contained in:
Zhou Weidong committed 2026-10-27 09:54:51 +08:00
1 parent 4c3acb047c
commit 0d785bf1f8
12 files changed
+232 -76

No files matched your search

+5 -12
View File
@@ -141,17 +141,11 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
late final WatchHistoryRepository _watchHistory =
widget.watchHistoryRepository ??
HttpWatchHistoryRepository(
WatchApi(_apiClient),
isSignedIn: () => _auth.isSignedIn,
);
HttpWatchHistoryRepository(WatchApi(_apiClient));
late final FavoriteRepository _favorites =
widget.favoriteRepository ??
HttpFavoriteRepository(
LibraryApi(_apiClient),
isSignedIn: () => _auth.isSignedIn,
);
HttpFavoriteRepository(LibraryApi(_apiClient));
late final PlaybackRepository _playback =
widget.playbackRepository ??
@@ -219,7 +213,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
unawaited(_localeController.load());
// 登录/登出时同步收藏状态:收藏属于账号,不能跨账号串联
_auth.addListener(_onAuthChanged);
if (_auth.isSignedIn) unawaited(_favoriteController.load());
unawaited(_favoriteController.load());
if (_auth.isSignedIn) unawaited(_walletController.load());
unawaited(_downloadController.restore());
}
@@ -235,6 +229,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
unawaited(_walletController.load());
} else {
_favoriteController.clear();
unawaited(_favoriteController.load());
_downloadController.reset();
_walletController.reset();
}
@@ -293,9 +288,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
),
ChangeNotifierProvider(create: (_) => _createCategories()),
if (playlists != null)
ChangeNotifierProvider(
create: (_) => PlaylistController(playlists),
),
ChangeNotifierProvider(create: (_) => PlaylistController(playlists)),
ChangeNotifierProvider.value(value: _favoriteController),
ChangeNotifierProvider.value(value: _downloadController),
ChangeNotifierProvider.value(value: _walletController),