diff --git a/app/lib/entity/file/repo.dart b/app/lib/entity/file/repo.dart index 6ccdc9c1..65db5298 100644 --- a/app/lib/entity/file/repo.dart +++ b/app/lib/entity/file/repo.dart @@ -10,6 +10,8 @@ part 'repo.g.dart'; abstract class FileRepo2 { /// Query all files belonging to [account] /// + /// Returned files are sorted by time in descending order + /// /// Normally the stream should complete with only a single event, but some /// implementation might want to return multiple set of values, say one set of /// cached value and later another set of updated value from a remote source. @@ -127,6 +129,8 @@ class CachedFileRepo implements FileRepo2 { abstract class FileDataSource2 { /// Query all files belonging to [account] + /// + /// Returned files are sorted by time in descending order Stream> getFileDescriptors( Account account, String shareDirPath); diff --git a/app/lib/widget/collection_browser/bloc.dart b/app/lib/widget/collection_browser/bloc.dart index c9b76c73..d51da1da 100644 --- a/app/lib/widget/collection_browser/bloc.dart +++ b/app/lib/widget/collection_browser/bloc.dart @@ -501,18 +501,24 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger { ); } + /// Remove file items not recognized by the app List _filterItems( List rawItems, Set? whitelist) { if (whitelist == null) { return rawItems; } - return rawItems.where((e) { + final results = rawItems.where((e) { if (e is CollectionFileItem) { return whitelist.contains(e.file.fdId); } else { return true; } }).toList(); + if (rawItems.length != results.length) { + _log.fine( + "[_filterItems] ${rawItems.length - results.length} items filtered out"); + } + return results; } String? _getCoverUrlByItems() {