Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fallback to using first letter avatar if face avatar is not available yet becuase db is not ready in UserAvatarWidget

ashilkn6fd19b3dca8d
diff --git a/mobile/lib/ui/sharing/user_avator_widget.dart b/mobile/lib/ui/sharing/user_avator_widget.dart
index 85eee4687d..300b83d744 100644
--- a/mobile/lib/ui/sharing/user_avator_widget.dart
+++ b/mobile/lib/ui/sharing/user_avator_widget.dart
@@ -118,6 +118,14 @@ class _UserAvatarWidgetState extends State<UserAvatarWidget> {
child: PersonFaceWidget(
_faceThumbnail!,
personId: personID,
+ onErrorCallback: () {
+ if (mounted) {
+ setState(() {
+ _personID = null;
+ _faceThumbnail = null;
+ });
+ }
+ },
),
);
} else if (snapshot.hasError) {
diff --git a/mobile/lib/ui/viewer/search/result/person_face_widget.dart b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
index d86760ae80..5cf99a7fb5 100644
--- a/mobile/lib/ui/viewer/search/result/person_face_widget.dart
+++ b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
@@ -25,6 +25,7 @@ class PersonFaceWidget extends StatefulWidget {
final bool thumbnailFallback;
final bool cannotTrustFile;
final Uint8List? faceCrop;
+ final VoidCallback? onErrorCallback;
// PersonFaceWidget constructor checks that both personId and clusterID are not null
// and that the file is not null
@@ -36,6 +37,7 @@ class PersonFaceWidget extends StatefulWidget {
this.thumbnailFallback = false,
this.cannotTrustFile = false,
this.faceCrop,
+ this.onErrorCallback,
super.key,
}) : assert(
personId != null || clusterID != null,
@@ -169,6 +171,7 @@ class _PersonFaceWidgetState extends State<PersonFaceWidget> {
e,
s,
);
+ widget.onErrorCallback?.call();
return null;
}
}