π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Add device folder maps and contextual menus
r4khul700fa543711b
diff --git a/mobile/apps/photos/changes/device-album-covers.md b/mobile/apps/photos/changes/device-album-covers.mdindex 6932f1878d..b3788b61cd 100644--- a/mobile/apps/photos/changes/device-album-covers.md+++ b/mobile/apps/photos/changes/device-album-covers.md@@ -1 +1 @@-- Added cover headers and smooth transitions to device albums, preserving backup status and gallery actions.+- Added cover headers and smooth transitions to device albums, with slideshow and map actions, backup status, and contextual menus.diff --git a/mobile/apps/photos/lib/models/gallery_type.dart b/mobile/apps/photos/lib/models/gallery_type.dartindex a84bb0bb6f..abe68d9c8e 100644--- a/mobile/apps/photos/lib/models/gallery_type.dart+++ b/mobile/apps/photos/lib/models/gallery_type.dart@@ -416,7 +416,6 @@ extension GalleryAppBarExtn on GalleryType {case GalleryType.archive:case GalleryType.hiddenSection:case GalleryType.trash:- case GalleryType.localFolder:case GalleryType.locationTag:case GalleryType.searchResults:case GalleryType.magic:@@ -424,6 +423,7 @@ extension GalleryAppBarExtn on GalleryType {case GalleryType.deleteSuggestions:case GalleryType.cleanupHiddenFromDevice:return false;+ case GalleryType.localFolder:case GalleryType.uncategorized:case GalleryType.cluster:case GalleryType.peopleTag:diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 60cc27c6fc..2e9de20558 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -588,15 +588,22 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {final strings = context.strings;if (!Configuration.instance.hasConfiguredAccount()) {- if (widget.showOverflowMenu && widget.deviceCollection != null) {+ if (!onCover &&+ widget.showOverflowMenu &&+ widget.deviceCollection != null) {actions.add(galleryAppBarPopupMenuAction<AlbumPopupAction>(tooltip: strings.more,icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),- optionsBuilder: () => [_slideshowMenuOption(strings)],+ optionsBuilder: () => [+ _slideshowMenuOption(strings),+ _mapMenuOption(strings),+ ],onSelected: (AlbumPopupAction value) async {if (value == AlbumPopupAction.albumSlideshow) {await _startAlbumSlideshow();+ } else if (value == AlbumPopupAction.map) {+ await showOnMap();}},),@@ -681,7 +688,12 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {final bool isHidden = widget.collection?.isHidden() ?? false;if (!widget.showOverflowMenu ||- !_hasOverflowMenuActions(userId, isArchived, isHidden)) {+ !_hasOverflowMenuActions(+ userId,+ isArchived,+ isHidden,+ onCover: onCover,+ )) {return actions;}@@ -807,7 +819,15 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {return actions;}- bool _hasOverflowMenuActions(int userId, bool isArchived, bool isHidden) {+ bool _hasOverflowMenuActions(+ int userId,+ bool isArchived,+ bool isHidden, {+ required bool onCover,+ }) {+ if (widget.deviceCollection != null && onCover) {+ return !_isICloudSharedAlbum || _canDisableDeviceFolderBackup;+ }return galleryType.canEditDetails() ||galleryType == GalleryType.quickLink ||galleryType.showMap() ||@@ -867,15 +887,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {size: IconSizes.small,),),- if (galleryType.showMap() && !onCover)- _menuOption(- AlbumPopupAction.map,- strings.map,- const HugeIcon(- icon: HugeIcons.strokeRoundedLocation01,- size: IconSizes.small,- ),- ),+ if (galleryType.showMap() && !onCover) _mapMenuOption(strings),if (galleryType.canSort())_menuOption(AlbumPopupAction.sort,@@ -1028,9 +1040,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {size: IconSizes.small,),),- if (_isAlbumSlideshowAvailable &&- (!onCover || widget.deviceCollection != null))- _slideshowMenuOption(strings),+ if (_isAlbumSlideshowAvailable && !onCover) _slideshowMenuOption(strings),if (canAutoAdd)_menuOption(AlbumPopupAction.autoAddPhotos,@@ -1110,6 +1120,19 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {bool get _isAlbumSlideshowAvailable =>widget.collection != null || widget.deviceCollection != null;+ EntePopupMenuOption<AlbumPopupAction> _mapMenuOption(+ StringsLocalizations strings,+ ) {+ return _menuOption(+ AlbumPopupAction.map,+ strings.map,+ const HugeIcon(+ icon: HugeIcons.strokeRoundedLocation01,+ size: IconSizes.small,+ ),+ );+ }+EntePopupMenuOption<AlbumPopupAction> _slideshowMenuOption(StringsLocalizations strings,) {@@ -1306,6 +1329,9 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {MaterialPageRoute(builder: (context) => MapScreen(filesFutureFn: () async {+ if (widget.deviceCollection != null) {+ return await _loadAllGalleryFiles() ?? [];+ }return FilesDB.instance.getAllFilesCollection(widget.collection!.id,);diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_actions_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_actions_sheet.dartindex 72a1b78e87..6ae2720789 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_actions_sheet.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_actions_sheet.dart@@ -41,16 +41,18 @@ Future<T?> showAlbumActionsSheet<T>(final columns = gridWidth >= minTileWidth * 4 + Spacing.xs * 3? 4: 2;+ final showTiles = options.length > 1;final tiles = [...options.where((option) =>+ showTiles &&option.labelColor == null &&option.secondaryLabel == null &&option.trailingWidget == null,).take(criticalIndex == -1 ? columns : columns - 1),- if (criticalIndex != -1) options[criticalIndex],+ if (showTiles && criticalIndex != -1) options[criticalIndex],];final rows = options.where((option) => !tiles.contains(option))@@ -67,24 +69,27 @@ Future<T?> showAlbumActionsSheet<T>(),),SizedBox(height: isLandscape ? Spacing.sm : Spacing.md),- Padding(- padding: const EdgeInsets.symmetric(horizontal: Spacing.md),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- spacing: Spacing.xs,- children: [- for (final option in tiles)- Expanded(- child: _AlbumActionTile(- option: option,- onTap: () =>- Navigator.of(context).pop(option.value),+ if (tiles.isNotEmpty)+ Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: Spacing.md,+ ),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ spacing: Spacing.xs,+ children: [+ for (final option in tiles)+ Expanded(+ child: _AlbumActionTile(+ option: option,+ onTap: () =>+ Navigator.of(context).pop(option.value),+ ),),- ),- ],+ ],+ ),),- ),- if (rows.isNotEmpty)+ if (tiles.isNotEmpty && rows.isNotEmpty)DividerComponent(padding: EdgeInsets.symmetric(horizontal: Spacing.lg,