Merge pull request #870 from ente-io/archived_albums
Show archived albums inside archive section
This commit is contained in:
commit
fd79f91260
4 changed files with 60 additions and 13 deletions
|
@ -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<List<CollectionWithThumbnail>> getArchivedCollectionWithThumb() async {
|
||||
final allCollections = await getCollectionsWithThumbnails();
|
||||
return allCollections
|
||||
.where((element) => element.collection.isArchived())
|
||||
.toList();
|
||||
}
|
||||
|
||||
Set<int> getHiddenCollections() {
|
||||
return _collectionIDToCollections.values
|
||||
.toList()
|
||||
|
|
|
@ -85,9 +85,12 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|||
final List<CollectionWithThumbnail> 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<CollectionWithThumbnail> favMathResult =
|
||||
collectionsWithThumbnail.splitMatch(
|
||||
(element) => element.collection.type == CollectionType.favorites,
|
||||
|
|
|
@ -123,15 +123,6 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
|
|||
),
|
||||
);
|
||||
}
|
||||
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),
|
||||
|
|
|
@ -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<CollectionWithThumbnail>;
|
||||
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(
|
||||
|
|
Loading…
Add table
Reference in a new issue