Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Keep archived Favorites behind pinned albums

r4khule0a19c77a11d
diff --git a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
index 6cc8e5d01e..a081aef57c 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
@@ -4,6 +4,7 @@ import "package:ente_components/ente_components.dart";
import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
import "package:hugeicons/hugeicons.dart";
+import "package:photos/core/configuration.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/album_sort_order_change_event.dart";
import "package:photos/events/collection_meta_event.dart";
@@ -304,12 +305,24 @@ class _CollectionListPageState extends State<CollectionListPage> {
}
if (widget.sectionType == UISectionType.archivedCollections) {
final collectionsToOrder = collections!;
- final sortedCollections = await CollectionsService.instance
- .orderCollectionsForAlbums(collectionsToOrder);
+ final sortedCollections = collectionsToOrder.toList();
+ await CollectionsService.instance.sortCollectionsByAlbumPreferences(
+ sortedCollections,
+ sortKey: sortKey,
+ sortDirection: albumSortDirection,
+ );
if (!mounted || !identical(collections, collectionsToOrder)) {
return;
}
- collections = sortedCollections;
+ final userID = Configuration.instance.getUserID();
+ bool isPinnedForCurrentUser(Collection collection) =>
+ userID != null && !collection.isOwner(userID)
+ ? collection.hasShareePinned()
+ : collection.isPinned;
+ collections = [
+ ...sortedCollections.where(isPinnedForCurrentUser),
+ ...sortedCollections.where((c) => !isPinnedForCurrentUser(c)),
+ ];
} else if (widget.sectionType == UISectionType.hiddenCollections) {
await CollectionsService.instance.sortCollectionsByAlbumPreferences(
collections!,