π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Include shared albums in Ente filter
laurenspriem2692001c3c2b
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dartindex 6fdbe219e1..1804ea41d7 100644--- a/mobile/apps/photos/lib/services/collections_service.dart+++ b/mobile/apps/photos/lib/services/collections_service.dart@@ -419,6 +419,11 @@ class CollectionsService {Iterable<Collection> collections,) async {final sorted = collections.toList();+ final userID = _config.getUserID();+ bool isPinnedForCurrentUser(Collection collection) =>+ userID != null && !collection.isOwner(userID)+ ? collection.hasShareePinned()+ : collection.isPinned;await sortCollectionsByAlbumPreferences(sorted);return [...sorted.where(@@ -426,11 +431,13 @@ class CollectionsService {),...sorted.where((collection) =>- collection.type != CollectionType.favorites && collection.isPinned,+ collection.type != CollectionType.favorites &&+ isPinnedForCurrentUser(collection),),...sorted.where((collection) =>- collection.type != CollectionType.favorites && !collection.isPinned,+ collection.type != CollectionType.favorites &&+ !isPinnedForCurrentUser(collection),),];}@@ -671,7 +678,7 @@ class CollectionsService {Future<List<Collection>> getCollectionForOnEnteSection() async {final bool hasFavorites = FavoritesService.instance.hasFavorites();return orderCollectionsForAlbums(- getCollectionsForUI().where(+ getCollectionsForUI(includedShared: true).where((collection) =>collection.type != CollectionType.uncategorized &&!collection.isQuickLinkCollection() &&diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dartindex d71ec311fe..01dd635e29 100644--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart@@ -273,11 +273,15 @@ class _AlbumsTabState extends State<AlbumsTab>if (!RemoteSyncService.instance.isFirstRemoteSyncDone()) {return false;}+ final userID = Configuration.instance.getUserID();+ if (userID == null) {+ return false;+ }final collectionIDToLatestTimeCount = await CollectionsService.instance.getCollectionIDToNewestFileTime();final emptyAlbumCount = collections.where((collection) {final latestTimeCount = collectionIDToLatestTimeCount[collection.id];- return latestTimeCount == null;+ return collection.isOwner(userID) && latestTimeCount == null;}).length;return emptyAlbumCount > 2;}diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dartindex 8b69633ff7..3f701b8847 100644--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart@@ -71,9 +71,24 @@ class _AlbumSelectionActionWidgetStatefinal hasUnpinnedAlbum = widget.selectedAlbums.albums.any((album) => !album.isPinned,);-- if (widget.sectionType == UISectionType.homeCollections ||- widget.sectionType == UISectionType.outgoingCollections) {+ final userID = Configuration.instance.getUserID()!;+ final isHomeSection = widget.sectionType == UISectionType.homeCollections;+ final ownsAllSelectedAlbums = widget.selectedAlbums.albums.every(+ (album) => album.isOwner(userID),+ );+ final receivesAllSelectedAlbums = widget.selectedAlbums.albums.every(+ (album) => !album.isOwner(userID),+ );+ final showOwnerActions =+ widget.sectionType == UISectionType.outgoingCollections ||+ isHomeSection && ownsAllSelectedAlbums;+ final showReceivedActions =+ widget.sectionType == UISectionType.incomingCollections ||+ isHomeSection && receivesAllSelectedAlbums;+ final showMixedEnteActions =+ isHomeSection && !ownsAllSelectedAlbums && !receivesAllSelectedAlbums;++ if (showOwnerActions) {items.add(SelectionActionButton(labelText: context.strings.share,@@ -118,6 +133,16 @@ class _AlbumSelectionActionWidgetState);}+ if (showMixedEnteActions) {+ items.add(+ SelectionActionButton(+ labelText: context.strings.hide,+ hugeIcon: HugeIcons.strokeRoundedViewOffSlash,+ onTap: _onHideOrUnHideClick,+ ),+ );+ }+if (widget.sectionType == UISectionType.archivedCollections) {items.add(SelectionActionButton(@@ -160,7 +185,7 @@ class _AlbumSelectionActionWidgetState);}- if (widget.sectionType == UISectionType.incomingCollections) {+ if (showReceivedActions) {if (flagService.enableShareePin) {final hasShareePinnedAlbum = widget.selectedAlbums.albums.any((album) => album.hasShareePinned(),@@ -434,8 +459,7 @@ class _AlbumSelectionActionWidgetStatereturn;}- final isUnarchiving =- widget.sectionType == UISectionType.incomingCollections+ final isUnarchiving = _usesShareeMetadata(collections.first)? collections.first.hasShareeArchived(): collections.first.isArchived();final dialog = createProgressDialog(@@ -446,7 +470,7 @@ class _AlbumSelectionActionWidgetStatetry {for (final collection in collections) {- if (widget.sectionType == UISectionType.incomingCollections) {+ if (_usesShareeMetadata(collection)) {final hasShareeArchived = collection.hasShareeArchived();final int prevVisiblity = hasShareeArchived? archiveVisibility@@ -507,6 +531,12 @@ class _AlbumSelectionActionWidgetStatewidget.selectedAlbums.clearAll();}+ bool _usesShareeMetadata(Collection collection) {+ return widget.sectionType == UISectionType.incomingCollections ||+ widget.sectionType == UISectionType.homeCollections &&+ !collection.isOwner(Configuration.instance.getUserID()!);+ }+Future<void> _leaveAlbum() async {final actionResult = await showActionSheet(context: context,