π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
keep alive face thumbnail when scrolling fast
laurenspriemc2d1c668887e
diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart b/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dartindex 0327c5853d..3e1b138c26 100644--- a/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart@@ -21,6 +21,7 @@ class PersonFaceWidget extends StatefulWidget {final String? clusterID;final bool useFullFile;final VoidCallback? onErrorCallback;+ final bool keepAlive;// PersonFaceWidget constructor checks that both personId and clusterID are not null// and that the file is not null@@ -29,6 +30,7 @@ class PersonFaceWidget extends StatefulWidget {this.clusterID,this.useFullFile = true,this.onErrorCallback,+ this.keepAlive = false,super.key,}) : assert(personId != null || clusterID != null,@@ -39,12 +41,16 @@ class PersonFaceWidget extends StatefulWidget {State<PersonFaceWidget> createState() => _PersonFaceWidgetState();}-class _PersonFaceWidgetState extends State<PersonFaceWidget> {+class _PersonFaceWidgetState extends State<PersonFaceWidget>+ with AutomaticKeepAliveClientMixin {Future<Uint8List?>? faceCropFuture;EnteFile? fileForFaceCrop;bool get isPerson => widget.personId != null;+ @override+ bool get wantKeepAlive => widget.keepAlive;+@overridevoid initState() {super.initState();@@ -64,6 +70,10 @@ class _PersonFaceWidgetState extends State<PersonFaceWidget> {@overrideWidget build(BuildContext context) {+ super.build(+ context,+ ); // Calling super.build for AutomaticKeepAliveClientMixin+return FutureBuilder<Uint8List?>(future: faceCropFuture,builder: (context, snapshot) {diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dartindex d78eb4b9ba..d711bd9ebd 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart@@ -95,12 +95,14 @@ class SelectablePersonSearchExample extends StatelessWidget {final GenericSearchResult searchResult;final double size;final SelectedPeople selectedPeople;+ final bool isDefaultFace;const SelectablePersonSearchExample({super.key,required this.searchResult,required this.selectedPeople,this.size = 102,+ this.isDefaultFace = false,});void _handleTap(BuildContext context) {@@ -192,7 +194,10 @@ class SelectablePersonSearchExample extends StatelessWidget {searchResult.previewThumbnail()!,shouldShowSyncStatus: false,)- : FaceSearchResult(searchResult);+ : FaceSearchResult(+ searchResult,+ isDefaultFace: isDefaultFace,+ );} else {child = const NoThumbnailWidget(addBorder: false,@@ -301,8 +306,13 @@ class SelectablePersonSearchExample extends StatelessWidget {class FaceSearchResult extends StatelessWidget {final SearchResult searchResult;+ final bool isDefaultFace;- const FaceSearchResult(this.searchResult, {super.key});+ const FaceSearchResult(+ this.searchResult, {+ super.key,+ this.isDefaultFace = false,+ });@overrideWidget build(BuildContext context) {@@ -313,6 +323,7 @@ class FaceSearchResult extends StatelessWidget {key: params.containsKey(kPersonWidgetKey)? ValueKey(params[kPersonWidgetKey]): ValueKey(params[kPersonParamID] ?? params[kClusterParamId]),+ keepAlive: isDefaultFace,);}}@@ -486,6 +497,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {searchResult: normalFaces[index],size: itemSize,selectedPeople: widget.selectedPeople!,+ isDefaultFace: true,): PersonSearchExample(searchResult: normalFaces[index],@@ -525,6 +537,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {searchResult: extraFaces[index],size: itemSize,selectedPeople: widget.selectedPeople!,+ isDefaultFace: false,): PersonSearchExample(searchResult: extraFaces[index],