mirror of
https://github.com/immich-app/immich.git
synced 2025-07-08 10:46:48 -04:00
wip
This commit is contained in:
parent
701b2be633
commit
4d45e36ea0
@ -27,9 +27,10 @@ class AlbumNotifierV2 extends StateNotifier<List<Album>> {
|
|||||||
late final StreamSubscription<List<Album>> _streamSub;
|
late final StreamSubscription<List<Album>> _streamSub;
|
||||||
|
|
||||||
Future<void> refreshAlbums() async {
|
Future<void> refreshAlbums() async {
|
||||||
await _albumService.refreshDeviceAlbums();
|
Future.wait([
|
||||||
await _albumService.refreshRemoteAlbums(isShared: false);
|
_albumService.refreshDeviceAlbums(),
|
||||||
await _albumService.refreshRemoteAlbums(isShared: true);
|
_albumService.refreshAllRemoteAlbums(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getDeviceAlbums() {
|
Future<void> getDeviceAlbums() {
|
||||||
|
@ -173,6 +173,30 @@ class AlbumService {
|
|||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// V2
|
||||||
|
Future<bool> refreshAllRemoteAlbums() async {
|
||||||
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
|
try {
|
||||||
|
final [sharedAlbums, ownedAlbums] = await Future.wait([
|
||||||
|
_apiService.albumsApi.getAllAlbums(shared: true),
|
||||||
|
_apiService.albumsApi.getAllAlbums(shared: false),
|
||||||
|
]);
|
||||||
|
|
||||||
|
final List<AlbumResponseDto> allAlbums = [
|
||||||
|
...sharedAlbums ?? [],
|
||||||
|
...ownedAlbums ?? [],
|
||||||
|
];
|
||||||
|
|
||||||
|
print("All albums: ${allAlbums.length}");
|
||||||
|
|
||||||
|
debugPrint("refreshAllAlbums took ${sw.elapsedMilliseconds}ms");
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint("Error refreshing all albums: $e");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<Album?> createAlbum(
|
Future<Album?> createAlbum(
|
||||||
String albumName,
|
String albumName,
|
||||||
Iterable<Asset> assets, [
|
Iterable<Asset> assets, [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user