mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 02:18:50 +01:00
Fix client side album not listing in Collections when offline
This commit is contained in:
parent
afa9167ff3
commit
cb62b76d87
1 changed files with 23 additions and 5 deletions
|
@ -52,11 +52,23 @@ class ListAlbum2 {
|
|||
Account account, {
|
||||
ErrorHandler? onError,
|
||||
}) async* {
|
||||
final ls = await Ls(_c.fileRepo)(
|
||||
List<File>? ls;
|
||||
var isRemoteGood = true;
|
||||
try {
|
||||
ls = await Ls(_c.fileRepo)(
|
||||
account,
|
||||
File(
|
||||
path: remote_storage_util.getRemoteAlbumsDir(account),
|
||||
));
|
||||
File(path: remote_storage_util.getRemoteAlbumsDir(account)),
|
||||
);
|
||||
} catch (e) {
|
||||
_log.warning("[_call] Failed while Ls", e);
|
||||
}
|
||||
if (ls == null) {
|
||||
isRemoteGood = false;
|
||||
ls = await Ls(_c.fileRepoLocal)(
|
||||
account,
|
||||
File(path: remote_storage_util.getRemoteAlbumsDir(account)),
|
||||
);
|
||||
}
|
||||
final List<File?> albumFiles =
|
||||
ls.where((element) => element.isCollection != true).toList();
|
||||
// migrate files
|
||||
|
@ -71,7 +83,13 @@ class ListAlbum2 {
|
|||
albumFiles[i] = null;
|
||||
}
|
||||
}
|
||||
yield* _c.albumRepo2.getAlbums(account, albumFiles.whereNotNull().toList());
|
||||
if (isRemoteGood) {
|
||||
yield* _c.albumRepo2
|
||||
.getAlbums(account, albumFiles.whereNotNull().toList());
|
||||
} else {
|
||||
yield* _c.albumRepo2Local
|
||||
.getAlbums(account, albumFiles.whereNotNull().toList());
|
||||
}
|
||||
}
|
||||
|
||||
final DiContainer _c;
|
||||
|
|
Loading…
Reference in a new issue