Skip to content

Commit

Permalink
[mob] Fix person cover refresh issue (#4216)
Browse files Browse the repository at this point in the history
## Description

## Tests
  • Loading branch information
ua741 authored Nov 27, 2024
2 parents d2d859a + 35bc7df commit 5f1beec
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions mobile/lib/models/search/search_constants.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const kPersonParamID = 'person_id';
const kPersonWidgetKey = 'person_widget_key';
const kClusterParamId = 'cluster_id';
const kFileID = 'file_id';
3 changes: 3 additions & 0 deletions mobile/lib/services/search_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ class SearchService {
p.data.name,
files,
params: {
kPersonWidgetKey: p.data.avatarFaceID ?? p.hashCode.toString(),
kPersonParamID: personID,
kFileID: files.first.uploadedFileID,
},
Expand All @@ -1018,6 +1019,8 @@ class SearchService {
p.data.name,
files,
params: {
kPersonWidgetKey:
p.data.avatarFaceID ?? p.hashCode.toString(),
kPersonParamID: personID,
kFileID: files.first.uploadedFileID,
},
Expand Down
6 changes: 4 additions & 2 deletions mobile/lib/services/user_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ class UserService {
Widget page;
final String passkeySessionID = response.data["passkeySessionID"];
String twoFASessionID = response.data["twoFactorSessionID"];
if (twoFASessionID.isEmpty) {
if (twoFASessionID.isEmpty &&
response.data["twoFactorSessionIDV2"] != null) {
twoFASessionID = response.data["twoFactorSessionIDV2"];
}
if (passkeySessionID.isNotEmpty) {
Expand Down Expand Up @@ -719,7 +720,8 @@ class UserService {
if (response.statusCode == 200) {
Widget page;
String twoFASessionID = response.data["twoFactorSessionID"];
if (twoFASessionID.isEmpty) {
if (twoFASessionID.isEmpty &&
response.data["twoFactorSessionIDV2"] != null) {
twoFASessionID = response.data["twoFactorSessionIDV2"];
}
final String passkeySessionID = response.data["passkeySessionID"];
Expand Down
12 changes: 12 additions & 0 deletions mobile/lib/ui/viewer/people/save_or_edit_person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
),
child: snapshot.hasData
? PersonFaceWidget(
key: ValueKey(
person?.data.avatarFaceID ??
"",),
personFile,
clusterID: personClusterID,
personId: person!.remoteID,
Expand Down Expand Up @@ -158,9 +161,18 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
person!,
);
if (result != null) {
_logger
.info('Person avatar updated');
setState(() {
person = result;
});
showToast(
context,
"Person avatar updated ${person!.data.avatarFaceID ?? 'empty'}",
);
Bus.instance.fire(
PeopleChangedEvent(),
);
}
},
),
Expand Down
8 changes: 6 additions & 2 deletions mobile/lib/ui/viewer/search_tab/people_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,14 @@ class FaceSearchResult extends StatelessWidget {

@override
Widget build(BuildContext context) {
final params = (searchResult as GenericSearchResult).params;
return PersonFaceWidget(
searchResult.previewThumbnail()!,
personId: (searchResult as GenericSearchResult).params[kPersonParamID],
clusterID: (searchResult as GenericSearchResult).params[kClusterParamId],
personId: params[kPersonParamID],
clusterID: params[kClusterParamId],
key: params.containsKey(kPersonWidgetKey)
? ValueKey(params[kPersonWidgetKey])
: null,
);
}
}
2 changes: 1 addition & 1 deletion mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: ente photos application
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 0.9.63+963
version: 0.9.64+964
publish_to: none

environment:
Expand Down

0 comments on commit 5f1beec

Please sign in to comment.