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

Aman Raj Singh Mourya3d4ff93e65c4
diff --git a/mobile/lib/ui/tabs/shared_collections_tab.dart b/mobile/lib/ui/tabs/shared_collections_tab.dart
index 54df06a517..8cec6359ab 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/theme/ente_theme.dart";
import "package:photos/ui/collections/album/row_item.dart";
import "package:photos/ui/collections/collection_list_page.dart";
@@ -21,6 +24,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/navigation_util.dart";
import "package:photos/utils/standalone/debouncer.dart";
@@ -304,6 +308,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/search_tab.dart b/mobile/lib/ui/viewer/search_tab/search_tab.dart
index ec616f7ec4..64643232c3 100644
--- a/mobile/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/lib/ui/viewer/search_tab/search_tab.dart
@@ -16,7 +16,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";
@@ -142,10 +141,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
as List<GenericSearchResult>,
);
case SectionType.contacts:
- return ContactsSection(
- snapshot.data!.elementAt(index)
- as List<GenericSearchResult>,
- );
+ return const SizedBox.shrink();
case SectionType.fileTypesAndExtension:
return FileTypeSection(
snapshot.data!.elementAt(index)