π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Surface shared albums in move-to-album flow
Neeraj Gupta3a32570dce98
diff --git a/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart b/mobile/apps/photos/lib/ui/collections/album/vertical_list.dartindex fd2a3fe85e..1e9a62f04e 100644--- a/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart+++ b/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart@@ -20,6 +20,7 @@ import "package:photos/ui/actions/collection/collection_sharing_actions.dart";import "package:photos/ui/collections/album/column_item.dart";import "package:photos/ui/collections/album/new_list_item.dart";import 'package:photos/ui/collections/collection_action_sheet.dart';+import "package:photos/ui/components/buttons/button_widget.dart";import 'package:photos/ui/notification/toast.dart';import "package:photos/ui/sharing/share_collection_page.dart";import 'package:photos/ui/viewer/gallery/collection_page.dart';@@ -31,6 +32,7 @@ import 'package:receive_sharing_intent/receive_sharing_intent.dart';class AlbumVerticalListWidget extends StatefulWidget {final List<Collection> collections;final List<Collection> recentCollections;+ final List<Collection> sharedCollections;final CollectionActionType actionType;final SelectedFiles? selectedFiles;final List<SharedMediaFile>? sharedFiles;@@ -51,6 +53,7 @@ class AlbumVerticalListWidget extends StatefulWidget {this.shouldShowCreateAlbum, {required this.selectedCollections,this.recentCollections = const [],+ this.sharedCollections = const [],this.enableSelection = false,this.onSelectionChanged,super.key,@@ -76,8 +79,11 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {: widget.selectedFiles?.files.length ?? 0;final hasRecentCollections = widget.recentCollections.isNotEmpty;+ final hasSharedCollections = widget.sharedCollections.isNotEmpty;- if (widget.collections.isEmpty && !hasRecentCollections) {+ if (widget.collections.isEmpty &&+ !hasRecentCollections &&+ !hasSharedCollections) {if (widget.shouldShowCreateAlbum) {return _getNewAlbumWidget(context, filesCount);}@@ -90,17 +96,23 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {// - Recent collections// - Divider (if recent collections exist and regular collections exist)// - All collections+ // - Shared header (if shared collections exist)+ // - Shared collectionsfinal createAlbumOffset = widget.shouldShowCreateAlbum ? 1 : 0;final recentHeaderOffset = hasRecentCollections ? 1 : 0;final recentItemsCount = widget.recentCollections.length;final showDivider = hasRecentCollections && widget.collections.isNotEmpty;final dividerOffset = showDivider ? 1 : 0;+ final sharedHeaderOffset = hasSharedCollections ? 1 : 0;+ final sharedItemsCount = widget.sharedCollections.length;final totalItemCount = createAlbumOffset +recentHeaderOffset +recentItemsCount +dividerOffset +- widget.collections.length;+ widget.collections.length ++ sharedHeaderOffset ++ sharedItemsCount;return ListView.separated(itemBuilder: (context, index) {@@ -138,9 +150,33 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {// Regular collectionsfinal collectionsStartIndex =recentStartIndex + recentItemsCount + dividerOffset;- final collectionIndex = adjustedIndex - collectionsStartIndex;- final item = widget.collections[collectionIndex];- return _buildCollectionItem(context, item);+ final collectionsEndIndex =+ collectionsStartIndex + widget.collections.length;+ if (adjustedIndex >= collectionsStartIndex &&+ adjustedIndex < collectionsEndIndex) {+ final collectionIndex = adjustedIndex - collectionsStartIndex;+ final item = widget.collections[collectionIndex];+ return _buildCollectionItem(context, item);+ }++ // Shared header+ final sharedHeaderIndex = collectionsEndIndex;+ if (hasSharedCollections && adjustedIndex == sharedHeaderIndex) {+ return _buildSectionHeader(+ context,+ "Shared with you",+ );+ }++ // Shared collections+ final sharedStartIndex = sharedHeaderIndex + sharedHeaderOffset;+ if (hasSharedCollections && adjustedIndex >= sharedStartIndex) {+ final sharedIndex = adjustedIndex - sharedStartIndex;+ final item = widget.sharedCollections[sharedIndex];+ return _buildSharedCollectionItem(context, item);+ }++ return const SizedBox.shrink();},separatorBuilder: (context, index) => const SizedBox(height: 8),itemCount: totalItemCount,@@ -186,6 +222,52 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {);}+ Widget _buildSharedCollectionItem(BuildContext context, Collection item) {+ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () => _sharedAlbumOnTap(context, item),+ child: AlbumColumnItemWidget(+ item,+ selectedCollections: widget.selectedCollections,+ ),+ );+ }++ Future<void> _sharedAlbumOnTap(+ BuildContext context,+ Collection item,+ ) async {+ // Show dialog asking if user wants to add instead of move+ final result = await showChoiceActionSheet(+ context,+ title: "Can't move to shared albums",+ body:+ "Items can only be added to shared albums, not moved. Would you like to add instead?\n\n(i) This option is shown for internal users only",+ icon: Icons.info_outline,+ firstButtonLabel: AppLocalizations.of(context).add,+ secondButtonLabel: AppLocalizations.of(context).cancel,+ );+ if (result?.action == ButtonAction.first) {+ // Perform add operation after dialog is dismissed+ final success = await _addToCollection(context, item.id, true);+ if (success) {+ showShortToast(+ context,+ AppLocalizations.of(context)+ .addedSuccessfullyTo(albumName: item.displayName),+ );+ Navigator.pop(context);+ await _navigateToCollection(context, item);+ }+ } else if (result?.action == ButtonAction.error &&+ result?.exception != null) {+ await showGenericErrorDialog(+ context: context,+ error: result!.exception,+ );+ }+ }+Future<void> _toggleCollectionSelection(Collection collection,) async {diff --git a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dartindex f14f0c1c09..b1c4dd9a96 100644--- a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart+++ b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart@@ -355,6 +355,23 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {collections.removeWhere((c) => recentIds.contains(c.id));}+ // Get shared collections for move action (internal users only)+ List<Collection> sharedCollections = [];+ if (widget.actionType == CollectionActionType.moveFiles &&+ flagService.showSharedAlbumsInMoveSheet) {+ sharedCollections = _getSharedCollections();+ // Filter shared collections by search query+ if (_searchQuery.isNotEmpty) {+ sharedCollections = sharedCollections+ .where(+ (c) => c.displayName+ .toLowerCase()+ .contains(_searchQuery.toLowerCase()),+ )+ .toList();+ }+ }+final searchResults = _searchQuery.isNotEmpty? collections.where(@@ -379,6 +396,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {_searchQuery,shouldShowCreateAlbum,recentCollections: recentCollections,+ sharedCollections: sharedCollections,enableSelection: _enableSelection,selectedCollections: _selectedCollections,onSelectionChanged: () {@@ -396,6 +414,31 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {);}+ List<Collection> _getSharedCollections() {+ final userID = Configuration.instance.getUserID()!;+ // Get collections where user is collaborator/admin (can add files)+ final allCollections = CollectionsService.instance.getCollectionsForUI(+ includeCollab: true,+ includeUncategorized: false,+ );+ // Filter to only non-owner collections (incoming shared albums)+ final sharedCollections = allCollections+ .where(+ (c) =>+ !c.isOwner(userID) &&+ !c.isQuickLinkCollection() &&+ c.type != CollectionType.favorites,+ )+ .toList();+ sharedCollections.sort((first, second) {+ return compareAsciiLowerCaseNatural(+ first.displayName,+ second.displayName,+ );+ });+ return sharedCollections;+ }+Future<List<Collection>> _getCollections() async {if (_showOnlyHiddenCollections) {final List<Collection> recentlyCreated = [];diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dartindex 866b2d21b1..5266f99c1e 100644--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart@@ -97,6 +97,8 @@ class FlagService {bool get enableShareePin => true;+ bool get showSharedAlbumsInMoveSheet => internalUser;+bool get isSocialEnabled =>internalUser || _isServerFlagEnabled(_commentsFlag);diff --git a/mobile/apps/photos/scripts/internal_changes.txt b/mobile/apps/photos/scripts/internal_changes.txtindex 775c8f9593..9e1ed63859 100644--- a/mobile/apps/photos/scripts/internal_changes.txt+++ b/mobile/apps/photos/scripts/internal_changes.txt@@ -1,3 +1,4 @@+- Neeraj: (i) Surface shared albums in add/move-to-album flows with owner avatar- Neeraj: QOL: Priority debouncer for recent local photos (< 7 days) to reduce home gallery delay- Neeraj: QOL: Collage creator: swap photos via long-press select + tap to replace- Prateek: (i) Always enable video streaming