diff --git a/lib/services/collections_service.dart b/lib/services/collections_service.dart index f35c29d63..5c7118ec3 100644 --- a/lib/services/collections_service.dart +++ b/lib/services/collections_service.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math'; -import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:dio/dio.dart'; @@ -183,6 +182,13 @@ class CollectionsService { .toSet(); } + Future> getArchivedCollectionWithThumb() async { + final allCollections = await getCollectionsWithThumbnails(); + return allCollections + .where((element) => element.collection.isArchived()) + .toList(); + } + Set getHiddenCollections() { return _collectionIDToCollections.values .toList() diff --git a/lib/ui/collections_gallery_widget.dart b/lib/ui/collections_gallery_widget.dart index caba0be0f..5358025c5 100644 --- a/lib/ui/collections_gallery_widget.dart +++ b/lib/ui/collections_gallery_widget.dart @@ -85,9 +85,12 @@ class _CollectionsGalleryWidgetState extends State final List collectionsWithThumbnail = await CollectionsService.instance.getCollectionsWithThumbnails(); - // Remove uncategorized collection - collectionsWithThumbnail - .removeWhere((t) => t.collection.type == CollectionType.uncategorized); + // Remove uncategorized collection and archived collections + collectionsWithThumbnail.removeWhere( + (t) => + t.collection.type == CollectionType.uncategorized || + t.collection.isArchived(), + ); final ListMatch favMathResult = collectionsWithThumbnail.splitMatch( (element) => element.collection.type == CollectionType.favorites, diff --git a/lib/ui/notification/update/change_log_page.dart b/lib/ui/notification/update/change_log_page.dart index 6973c2a83..03fdf3978 100644 --- a/lib/ui/notification/update/change_log_page.dart +++ b/lib/ui/notification/update/change_log_page.dart @@ -123,15 +123,6 @@ class _ChangeLogPageState extends State { ), ); } - items.add( - ChangeLogEntry( - "Object Detection (Beta)", - "This release comes packed with another goodie – the ability to " - "identify objects within a photo.\nYou can preview this feature " - "within the Info section of your files.\n\nPlease note that this " - "feature is in beta, and once fine tuned, you will be able to search through your photos based on their contents.", - ), - ); return Container( padding: const EdgeInsets.only(left: 16), diff --git a/lib/ui/viewer/gallery/archive_page.dart b/lib/ui/viewer/gallery/archive_page.dart index d2da570ae..19f2999b1 100644 --- a/lib/ui/viewer/gallery/archive_page.dart +++ b/lib/ui/viewer/gallery/archive_page.dart @@ -1,14 +1,19 @@ import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; +import "package:logging/logging.dart"; import 'package:photos/core/configuration.dart'; import 'package:photos/core/event_bus.dart'; import 'package:photos/db/files_db.dart'; import 'package:photos/events/files_updated_event.dart'; +import "package:photos/models/collection_items.dart"; import 'package:photos/models/gallery_type.dart'; import 'package:photos/models/magic_metadata.dart'; import 'package:photos/models/selected_files.dart'; import 'package:photos/services/collections_service.dart'; +import "package:photos/ui/collections/collection_item_widget.dart"; +import "package:photos/ui/common/loading_widget.dart"; import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart'; +import "package:photos/ui/viewer/gallery/empty_state.dart"; import 'package:photos/ui/viewer/gallery/gallery.dart'; import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart'; @@ -17,6 +22,7 @@ class ArchivePage extends StatelessWidget { final GalleryType appBarType; final GalleryType overlayType; final _selectedFiles = SelectedFiles(); + final Logger _logger = Logger("ArchivePage"); ArchivePage({ this.tagPrefix = "archived_page", @@ -61,6 +67,47 @@ class ArchivePage extends StatelessWidget { tagPrefix: tagPrefix, selectedFiles: _selectedFiles, initialFiles: null, + emptyState: const EmptyState( + text: "You don't have any archived items.", + ), + header: FutureBuilder( + future: CollectionsService.instance.getArchivedCollectionWithThumb(), + builder: (context, snapshot) { + if (snapshot.hasError) { + _logger.severe("failed to fetch archived albums", snapshot.error); + return const Text("Something went wrong"); + } else if (snapshot.hasData) { + final collectionsWithThumbnail = + snapshot.data as List; + return SizedBox( + height: 200, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: collectionsWithThumbnail.length, + padding: const EdgeInsets.fromLTRB(6, 6, 6, 6), + itemBuilder: (context, index) { + final item = collectionsWithThumbnail[index]; + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async {}, + child: Padding( + padding: const EdgeInsets.all(2.0), + child: CollectionItem( + item, + 120, + shouldRender: true, + ), + ), + ); + }, + ), + ); + } else { + return const EnteLoadingWidget(); + } + }, + ), ); return Scaffold( appBar: PreferredSize(