mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 00:14:42 +01:00
Improve doc
This commit is contained in:
parent
91caf39184
commit
64b281289b
2 changed files with 11 additions and 1 deletions
|
@ -10,6 +10,8 @@ part 'repo.g.dart';
|
||||||
abstract class FileRepo2 {
|
abstract class FileRepo2 {
|
||||||
/// Query all files belonging to [account]
|
/// 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
|
/// 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
|
/// 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.
|
/// cached value and later another set of updated value from a remote source.
|
||||||
|
@ -127,6 +129,8 @@ class CachedFileRepo implements FileRepo2 {
|
||||||
|
|
||||||
abstract class FileDataSource2 {
|
abstract class FileDataSource2 {
|
||||||
/// Query all files belonging to [account]
|
/// Query all files belonging to [account]
|
||||||
|
///
|
||||||
|
/// Returned files are sorted by time in descending order
|
||||||
Stream<List<FileDescriptor>> getFileDescriptors(
|
Stream<List<FileDescriptor>> getFileDescriptors(
|
||||||
Account account, String shareDirPath);
|
Account account, String shareDirPath);
|
||||||
|
|
||||||
|
|
|
@ -501,18 +501,24 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Remove file items not recognized by the app
|
||||||
List<CollectionItem> _filterItems(
|
List<CollectionItem> _filterItems(
|
||||||
List<CollectionItem> rawItems, Set<int>? whitelist) {
|
List<CollectionItem> rawItems, Set<int>? whitelist) {
|
||||||
if (whitelist == null) {
|
if (whitelist == null) {
|
||||||
return rawItems;
|
return rawItems;
|
||||||
}
|
}
|
||||||
return rawItems.where((e) {
|
final results = rawItems.where((e) {
|
||||||
if (e is CollectionFileItem) {
|
if (e is CollectionFileItem) {
|
||||||
return whitelist.contains(e.file.fdId);
|
return whitelist.contains(e.file.fdId);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).toList();
|
}).toList();
|
||||||
|
if (rawItems.length != results.length) {
|
||||||
|
_log.fine(
|
||||||
|
"[_filterItems] ${rawItems.length - results.length} items filtered out");
|
||||||
|
}
|
||||||
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _getCoverUrlByItems() {
|
String? _getCoverUrlByItems() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue