π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add option to clean up uncaterogized album
Neeraj Gupta2a24d2f03190
diff --git a/lib/ui/actions/collection/collection_sharing_actions.dart b/lib/ui/actions/collection/collection_sharing_actions.dartindex 9428c56da3..21d4543a2b 100644--- a/lib/ui/actions/collection/collection_sharing_actions.dart+++ b/lib/ui/actions/collection/collection_sharing_actions.dart@@ -1,3 +1,5 @@+import "dart:async";+import 'package:flutter/material.dart';import 'package:logging/logging.dart';import 'package:photos/core/configuration.dart';@@ -257,8 +259,10 @@ class CollectionActions {labelText: S.of(context).sendInvite,isInAlert: true,onTap: () async {- shareText(- S.of(context).shareTextRecommendUsingEnte,+ unawaited(+ shareText(+ S.of(context).shareTextRecommendUsingEnte,+ ),);},),@@ -384,6 +388,23 @@ class CollectionActions {await collectionsService.trashEmptyCollection(collection);}+ Future<void> removeFromUncatIfPresentInOtherAlbum(+ Collection collection,+ BuildContext bContext,+ ) async {+ try {+ final List<EnteFile> files =+ await FilesDB.instance.getAllFilesCollection(collection.id);+ await moveFilesFromCurrentCollection(bContext, collection, files);+ } catch (e) {+ logger.severe("Failed to remove files from uncategorized", e);+ await showErrorDialogForException(+ context: bContext,+ exception: e as Exception,+ );+ }+ }+// _confirmSharedAlbumDeletion should be shown when user tries to delete an// album shared with other ente users.Future<bool> _confirmSharedAlbumDeletion(@@ -446,7 +467,9 @@ class CollectionActions {}if (!isCollectionOwner && split.ownedByOtherUsers.isNotEmpty) {- showShortToast(context, S.of(context).canOnlyRemoveFilesOwnedByYou);+ unawaited(+ showShortToast(context, S.of(context).canOnlyRemoveFilesOwnedByYou),+ );return;}@@ -528,7 +551,20 @@ class CollectionActions {for (MapEntry<int, List<EnteFile>> entryin destCollectionToFilesMap.entries) {- await collectionsService.move(entry.key, collection.id, entry.value);+ if (collection.type == CollectionType.uncategorized &&+ entry.key == collection.id) {+ // skip moving files to uncategorized collection from uncategorized+ // this flow is triggered while cleaning up uncategerized collection+ logger.info(+ 'skipping moving ${entry.value.length} files to uncategorized collection',+ );+ } else {+ await collectionsService.move(+ entry.key,+ collection.id,+ entry.value,+ );+ }}}diff --git a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 848535ee60..58f94ba3b0 100644--- a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -71,6 +71,7 @@ enum AlbumPopupAction {addPhotos,pinAlbum,removeLink,+ cleanUncategorized,}class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {@@ -385,6 +386,25 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {),);}++ if (galleryType == GalleryType.uncategorized) {+ items.add(+ PopupMenuItem(+ value: AlbumPopupAction.cleanUncategorized,+ child: Row(+ children: [+ const Icon(Icons.crop_original_outlined),+ const Padding(+ padding: EdgeInsets.all(8),+ ),+ Text(+ "Clean Uncategorized",+ ),+ ],+ ),+ ),+ );+ }if (galleryType.canPin()) {items.add(PopupMenuItem(@@ -588,6 +608,11 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {}} else if (value == AlbumPopupAction.map) {await showOnMap();+ } else if (value == AlbumPopupAction.cleanUncategorized) {+ await collectionActions.removeFromUncatIfPresentInOtherAlbum(+ widget.collection!,+ context,+ );} else {unawaited(showToast(context, S.of(context).somethingWentWrong));}