Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Move Contacts section from search tab to shared tab

ashilkn628f195c0e32
diff --git a/mobile/lib/ui/tabs/shared_collections_tab.dart b/mobile/lib/ui/tabs/shared_collections_tab.dart
index 7e93abca39..247783161c 100644
--- a/mobile/lib/ui/tabs/shared_collections_tab.dart
+++ b/mobile/lib/ui/tabs/shared_collections_tab.dart
@@ -3,13 +3,16 @@ import "dart:math";
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
+import "package:photos/core/constants.dart";
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/collection_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/events/user_logged_out_event.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection/collection_items.dart';
+import "package:photos/models/search/generic_search_result.dart";
import 'package:photos/services/collections_service.dart';
+import "package:photos/services/search_service.dart";
import "package:photos/ui/collections/album/row_item.dart";
import "package:photos/ui/collections/collection_list_page.dart";
import 'package:photos/ui/common/loading_widget.dart';
@@ -20,6 +23,7 @@ import "package:photos/ui/tabs/shared/empty_state.dart";
import "package:photos/ui/tabs/shared/quick_link_album_item.dart";
import "package:photos/ui/viewer/gallery/collect_photos_card_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
+import "package:photos/ui/viewer/search_tab/contacts_section.dart";
import "package:photos/utils/debouncer.dart";
import "package:photos/utils/navigation_util.dart";
@@ -290,6 +294,27 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
),
)
: const SizedBox.shrink(),
+ const SizedBox(height: 2),
+ FutureBuilder(
+ future: SearchService.instance
+ .getAllContactsSearchResults(kSearchSectionLimit),
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ return ContactsSection(
+ snapshot.data as List<GenericSearchResult>,
+ );
+ } else if (snapshot.hasError) {
+ _logger.severe(
+ "failed to load contacts section",
+ snapshot.error,
+ snapshot.stackTrace,
+ );
+ return const EnteLoadingWidget();
+ } else {
+ return const EnteLoadingWidget();
+ }
+ },
+ ),
const SizedBox(height: 4),
const CollectPhotosCardWidget(),
const SizedBox(height: 32),
diff --git a/mobile/lib/ui/viewer/search_tab/contacts_section.dart b/mobile/lib/ui/viewer/search_tab/contacts_section.dart
index dc52a5b5fe..25662e2c1b 100644
--- a/mobile/lib/ui/viewer/search_tab/contacts_section.dart
+++ b/mobile/lib/ui/viewer/search_tab/contacts_section.dart
@@ -100,30 +100,23 @@ class _ContactsSectionState extends State<ContactsSection> {
),
const ContactCTA(),
];
- return Padding(
- padding: const EdgeInsets.symmetric(vertical: 8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SectionHeader(
- SectionType.contacts,
- hasMore:
- (_contactSearchResults.length >= kSearchSectionLimit - 1),
- ),
- const SizedBox(height: 2),
- SizedBox(
- child: SingleChildScrollView(
- padding: const EdgeInsets.symmetric(horizontal: 4.5),
- physics: const BouncingScrollPhysics(),
- scrollDirection: Axis.horizontal,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: recommendations,
- ),
- ),
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SectionHeader(
+ SectionType.contacts,
+ hasMore: (_contactSearchResults.length >= kSearchSectionLimit - 1),
+ ),
+ SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(horizontal: 4.5),
+ physics: const BouncingScrollPhysics(),
+ scrollDirection: Axis.horizontal,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: recommendations,
),
- ],
- ),
+ ),
+ ],
);
}
}
diff --git a/mobile/lib/ui/viewer/search_tab/search_tab.dart b/mobile/lib/ui/viewer/search_tab/search_tab.dart
index bf78bb930c..efc9988edf 100644
--- a/mobile/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/lib/ui/viewer/search_tab/search_tab.dart
@@ -17,7 +17,6 @@ import "package:photos/ui/viewer/search/result/no_result_widget.dart";
import "package:photos/ui/viewer/search/search_suggestions.dart";
import "package:photos/ui/viewer/search/tab_empty_state.dart";
import 'package:photos/ui/viewer/search_tab/albums_section.dart';
-import "package:photos/ui/viewer/search_tab/contacts_section.dart";
import "package:photos/ui/viewer/search_tab/file_type_section.dart";
import "package:photos/ui/viewer/search_tab/locations_section.dart";
import "package:photos/ui/viewer/search_tab/magic_section.dart";
@@ -145,10 +144,11 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
as List<GenericSearchResult>,
);
case SectionType.contacts:
- return ContactsSection(
- snapshot.data!.elementAt(index)
- as List<GenericSearchResult>,
- );
+ // return ContactsSection(
+ // snapshot.data!.elementAt(index)
+ // as List<GenericSearchResult>,
+ // );
+ return const SizedBox.shrink();
case SectionType.fileTypesAndExtension:
return FileTypeSection(
snapshot.data!.elementAt(index)