Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Show all faces in 'All' section of faces

ashilkn39252122efad
diff --git a/mobile/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/lib/ui/viewer/search/result/people_section_all_page.dart
index 43ddc7f268..17cb144f3c 100644
--- a/mobile/lib/ui/viewer/search/result/people_section_all_page.dart
+++ b/mobile/lib/ui/viewer/search/result/people_section_all_page.dart
@@ -1,17 +1,51 @@
+import "dart:async";
+
import 'package:flutter/material.dart';
+import "package:photos/events/event.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/search/search_result.dart";
+import "package:photos/models/search/search_types.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/viewer/search_tab/people_section.dart";
-class PeopleSectionAllPage extends StatelessWidget {
- final Future<List<SearchResult>> searchResults;
-
+class PeopleSectionAllPage extends StatefulWidget {
const PeopleSectionAllPage({
super.key,
- required this.searchResults,
});
+ @override
+ State<PeopleSectionAllPage> createState() => _PeopleSectionAllPageState();
+}
+
+class _PeopleSectionAllPageState extends State<PeopleSectionAllPage> {
+ late Future<List<SearchResult>> sectionData;
+ final streamSubscriptions = <StreamSubscription>[];
+
+ @override
+ void initState() {
+ super.initState();
+ sectionData = SectionType.face.getData(context);
+
+ final streamsToListenTo = SectionType.face.viewAllUpdateEvents();
+ for (Stream<Event> stream in streamsToListenTo) {
+ streamSubscriptions.add(
+ stream.listen((event) async {
+ setState(() {
+ sectionData = SectionType.face.getData(context);
+ });
+ }),
+ );
+ }
+ }
+
+ @override
+ void dispose() {
+ for (var subscriptions in streamSubscriptions) {
+ subscriptions.cancel();
+ }
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
final smallFontSize = getEnteTextTheme(context).small.fontSize!;
@@ -24,7 +58,7 @@ class PeopleSectionAllPage extends StatelessWidget {
title: Text(S.of(context).people),
),
body: FutureBuilder<List<SearchResult>>(
- future: searchResults,
+ future: sectionData,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
diff --git a/mobile/lib/ui/viewer/search_tab/people_section.dart b/mobile/lib/ui/viewer/search_tab/people_section.dart
index 3460002583..df5c929e31 100644
--- a/mobile/lib/ui/viewer/search_tab/people_section.dart
+++ b/mobile/lib/ui/viewer/search_tab/people_section.dart
@@ -86,9 +86,7 @@ class _PeopleSectionState extends State<PeopleSection> {
if (shouldShowMore) {
routeToPage(
context,
- PeopleSectionAllPage(
- searchResults: Future.value(widget.examples),
- ),
+ const PeopleSectionAllPage(),
);
}
},