2023-07-03 19:23:42 +02:00
|
|
|
import 'package:nc_photos/account.dart';
|
|
|
|
import 'package:nc_photos/di_container.dart';
|
|
|
|
import 'package:nc_photos/entity/person.dart';
|
|
|
|
import 'package:nc_photos/entity/person/adapter/face_recognition.dart';
|
2023-07-16 13:30:23 +02:00
|
|
|
import 'package:nc_photos/entity/person/adapter/recognize.dart';
|
2023-07-03 19:23:42 +02:00
|
|
|
import 'package:nc_photos/entity/person/content_provider/face_recognition.dart';
|
2023-07-16 13:30:23 +02:00
|
|
|
import 'package:nc_photos/entity/person/content_provider/recognize.dart';
|
2023-07-03 19:23:42 +02:00
|
|
|
import 'package:nc_photos/entity/person_face.dart';
|
|
|
|
|
|
|
|
abstract class PersonAdapter {
|
|
|
|
const PersonAdapter();
|
|
|
|
|
|
|
|
static PersonAdapter of(DiContainer c, Account account, Person person) {
|
|
|
|
switch (person.contentProvider.runtimeType) {
|
2024-05-28 17:10:33 +02:00
|
|
|
case const (PersonFaceRecognitionProvider):
|
2023-07-03 19:23:42 +02:00
|
|
|
return PersonFaceRecognitionAdapter(c, account, person);
|
2024-05-28 17:10:33 +02:00
|
|
|
case const (PersonRecognizeProvider):
|
2023-07-16 13:30:23 +02:00
|
|
|
return PersonRecognizeAdapter(c, account, person);
|
2023-07-03 19:23:42 +02:00
|
|
|
default:
|
|
|
|
throw UnsupportedError(
|
|
|
|
"Unknown type: ${person.contentProvider.runtimeType}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// List faces of this person
|
|
|
|
Stream<List<PersonFace>> listFace();
|
|
|
|
}
|