mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
minor fixes
This commit is contained in:
parent
f2246b293c
commit
dc9ce79c2d
3 changed files with 2 additions and 39 deletions
|
|
@ -11,11 +11,6 @@ class PersonApiRepository extends ApiRepository {
|
|||
|
||||
PersonApiRepository(this._api);
|
||||
|
||||
Future<List<Person>> getAll() async {
|
||||
final dto = await checkNull(_api.getAllPeople());
|
||||
return dto.people.map(_toPerson).toList();
|
||||
}
|
||||
|
||||
Future<Person> update(String id, {String? name, DateTime? birthday}) async {
|
||||
final birthdayUtc = birthday == null ? null : DateTime.utc(birthday.year, birthday.month, birthday.day);
|
||||
final dto = PersonUpdateDto(
|
||||
|
|
@ -27,5 +22,5 @@ class PersonApiRepository extends ApiRepository {
|
|||
}
|
||||
|
||||
static Person _toPerson(PersonResponseDto dto) =>
|
||||
.new(birthDate: dto.birthDate, id: dto.id, name: dto.name, updatedAt: dto.updatedAt.value);
|
||||
.new(birthDate: dto.birthDate, id: dto.id, name: dto.name, updatedAt: dto.updatedAt.orElse(null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/person.model.dart';
|
||||
import 'package:immich_mobile/repositories/person_api.repository.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
final personServiceProvider = Provider.autoDispose<PersonService>(
|
||||
(ref) => PersonService(ref.watch(personApiRepositoryProvider)),
|
||||
);
|
||||
|
||||
class PersonService {
|
||||
final Logger _log = Logger("PersonService");
|
||||
final PersonApiRepository _personApiRepository;
|
||||
PersonService(this._personApiRepository);
|
||||
|
||||
Future<List<Person>> getAllPeople() async {
|
||||
try {
|
||||
return await _personApiRepository.getAll();
|
||||
} catch (error, stack) {
|
||||
_log.severe("Error while fetching curated people", error, stack);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Future<Person?> updateName(String id, String name) async {
|
||||
try {
|
||||
return await _personApiRepository.update(id, name: name);
|
||||
} catch (error, stack) {
|
||||
_log.severe("Error while updating person name", error, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ class PeoplePicker extends HookConsumerWidget {
|
|||
padding: const EdgeInsets.only(bottom: 2.0),
|
||||
child: LargeLeadingTile(
|
||||
title: Text(
|
||||
person.name,
|
||||
person.name.nullIfEmpty ?? context.t.no_name,
|
||||
style: context.textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue