From b8faf0d22d13bddb6e56362ed35d0106fca75426 Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 31 Jan 2023 13:01:11 +0530 Subject: [PATCH] Implemented Keep photos collection action --- .../Collections/CollectionOptions/index.tsx | 13 +++++++++++-- src/utils/strings/englishConstants.tsx | 10 ++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/Collections/CollectionOptions/index.tsx b/src/components/Collections/CollectionOptions/index.tsx index faf5b7e0b..7dad0770e 100644 --- a/src/components/Collections/CollectionOptions/index.tsx +++ b/src/components/Collections/CollectionOptions/index.tsx @@ -40,6 +40,7 @@ export enum CollectionActions { UNARCHIVE, CONFIRM_DELETE, DELETE, + KEEP_PHOTOS, SHOW_SHARE_DIALOG, CONFIRM_EMPTY_TRASH, EMPTY_TRASH, @@ -90,6 +91,9 @@ const CollectionOptions = (props: CollectionOptionsProps) => { case CollectionActions.DELETE: callback = deleteCollection; break; + case CollectionActions.KEEP_PHOTOS: + callback = keepPhotos; + break; case CollectionActions.SHOW_SHARE_DIALOG: callback = showCollectionShareModal; break; @@ -138,7 +142,12 @@ const CollectionOptions = (props: CollectionOptionsProps) => { }; const deleteCollection = async () => { - await CollectionAPI.deleteCollection(activeCollection.id); + await CollectionAPI.deleteCollection(activeCollection.id, false); + redirectToAll(); + }; + + const keepPhotos = async () => { + await CollectionAPI.deleteCollection(activeCollection.id, true); redirectToAll(); }; @@ -177,7 +186,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => { const confirmDeleteCollection = () => { setDialogMessage({ title: constants.DELETE_COLLECTION_TITLE, - content: constants.DELETE_COLLECTION_MESSAGE, + content: constants.DELETE_COLLECTION_MESSAGE(), proceed: { text: constants.DELETE_COLLECTION, action: handleCollectionAction(CollectionActions.DELETE), diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index 5c1bbf53d..25493c3b4 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/src/utils/strings/englishConstants.tsx @@ -368,8 +368,14 @@ const englishConstants = { DELETE_COLLECTION_TITLE: 'Delete album?', DELETE_COLLECTION: 'Delete album', DELETE_COLLECTION_FAILED: 'Album deletion failed, please try again', - DELETE_COLLECTION_MESSAGE: - 'Files that are unique to this album will be moved to trash, and this album would be deleted.', + DELETE_COLLECTION_MESSAGE: () => ( +

+ Also delete the photos (and videos) present in this album from + all other albums they are part of? +

+ ), + DELETE_PHOTOS: 'Delete photos', + KEEP_PHOTOS: 'Keep photos', SHARE: 'Share', SHARE_COLLECTION: 'Share album', SHARE_WITH_PEOPLE: 'Share with your loved ones',