2023-04-13 17:32:31 +02:00
|
|
|
import 'package:clock/clock.dart';
|
2023-04-28 19:21:53 +02:00
|
|
|
import 'package:equatable/equatable.dart';
|
2023-04-13 17:32:31 +02:00
|
|
|
import 'package:nc_photos/account.dart';
|
|
|
|
import 'package:nc_photos/entity/collection.dart';
|
2023-05-01 19:05:33 +02:00
|
|
|
import 'package:nc_photos/entity/collection/util.dart';
|
2023-04-13 17:32:31 +02:00
|
|
|
import 'package:nc_photos/entity/collection_item/util.dart';
|
|
|
|
import 'package:nc_photos/entity/person.dart';
|
|
|
|
|
2023-04-28 19:21:53 +02:00
|
|
|
class CollectionPersonProvider
|
|
|
|
with EquatableMixin
|
|
|
|
implements CollectionContentProvider {
|
2023-04-13 17:32:31 +02:00
|
|
|
const CollectionPersonProvider({
|
|
|
|
required this.account,
|
|
|
|
required this.person,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get fourCc => "PERS";
|
|
|
|
|
|
|
|
@override
|
2023-07-03 19:23:42 +02:00
|
|
|
String get id => person.id;
|
2023-04-13 17:32:31 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
int? get count => person.count;
|
|
|
|
|
|
|
|
@override
|
|
|
|
DateTime get lastModified => clock.now().toUtc();
|
|
|
|
|
|
|
|
@override
|
2023-09-14 19:22:19 +02:00
|
|
|
List<CollectionCapability> get capabilities => [
|
|
|
|
CollectionCapability.deleteItem,
|
|
|
|
];
|
2023-04-13 17:32:31 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
CollectionItemSort get itemSort => CollectionItemSort.dateDescending;
|
|
|
|
|
2023-05-01 19:05:33 +02:00
|
|
|
@override
|
|
|
|
List<CollectionShare> get shares => [];
|
|
|
|
|
2023-04-13 17:32:31 +02:00
|
|
|
@override
|
2023-04-28 19:21:53 +02:00
|
|
|
String? getCoverUrl(
|
|
|
|
int width,
|
|
|
|
int height, {
|
|
|
|
bool? isKeepAspectRatio,
|
|
|
|
}) {
|
2023-07-03 19:23:42 +02:00
|
|
|
return person.getCoverUrl(width, height,
|
|
|
|
isKeepAspectRatio: isKeepAspectRatio);
|
2023-04-13 17:32:31 +02:00
|
|
|
}
|
|
|
|
|
2023-05-12 20:44:21 +02:00
|
|
|
@override
|
|
|
|
bool get isDynamicCollection => true;
|
|
|
|
|
2023-05-15 15:23:27 +02:00
|
|
|
@override
|
|
|
|
bool get isPendingSharedAlbum => false;
|
|
|
|
|
2023-09-08 20:30:27 +02:00
|
|
|
@override
|
|
|
|
bool get isOwned => true;
|
|
|
|
|
2023-04-28 19:21:53 +02:00
|
|
|
@override
|
|
|
|
List<Object?> get props => [account, person];
|
|
|
|
|
2023-04-13 17:32:31 +02:00
|
|
|
final Account account;
|
|
|
|
final Person person;
|
|
|
|
}
|