2022-08-06 06:21:11 +02:00
|
|
|
import 'package:nc_photos/account.dart';
|
|
|
|
import 'package:nc_photos/di_container.dart';
|
2023-12-06 15:05:33 +01:00
|
|
|
import 'package:nc_photos/entity/file_descriptor.dart';
|
2022-08-06 06:21:11 +02:00
|
|
|
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
|
|
|
import 'package:nc_photos/entity/search.dart';
|
|
|
|
|
|
|
|
class Search {
|
|
|
|
Search(this._c) : assert(require(_c));
|
|
|
|
|
|
|
|
static bool require(DiContainer c) => DiContainer.has(c, DiType.searchRepo);
|
|
|
|
|
2023-12-06 15:05:33 +01:00
|
|
|
Future<List<FileDescriptor>> call(
|
|
|
|
Account account, SearchCriteria criteria) async {
|
2022-08-06 06:21:11 +02:00
|
|
|
final files = await _c.searchRepo.list(account, criteria);
|
|
|
|
return files.where((f) => file_util.isSupportedFormat(f)).toList();
|
|
|
|
}
|
|
|
|
|
|
|
|
final DiContainer _c;
|
|
|
|
}
|