From 0273ae85373c11934953fd8d7e38ac16cc1b4969 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 14 Nov 2023 00:40:04 -0800 Subject: [PATCH] feat: allow multi-share with sel manager (close #472) Signed-off-by: Varun Patil --- src/App.vue | 3 + src/components/modal/AlbumCollaborators.vue | 20 ++--- src/components/modal/AlbumShareModal.vue | 93 ++++++++++++++++++-- src/components/modal/ShareModal.vue | 70 +++++++++++++-- src/components/top-matter/AlbumTopMatter.vue | 10 +-- src/globals.d.ts | 1 + src/services/dav/base.ts | 3 +- 7 files changed, 170 insertions(+), 30 deletions(-) diff --git a/src/App.vue b/src/App.vue index 504daecd..dcb2ee1a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -62,6 +62,7 @@ + @@ -91,6 +92,7 @@ import NodeShareModal from '@components/modal/NodeShareModal.vue'; import ShareModal from '@components/modal/ShareModal.vue'; import MoveToFolderModal from '@components/modal/MoveToFolderModal.vue'; import FaceMoveModal from '@components/modal/FaceMoveModal.vue'; +import AlbumShareModal from '@components/modal/AlbumShareModal.vue'; import * as utils from '@services/utils'; import * as nativex from '@native'; @@ -139,6 +141,7 @@ export default defineComponent({ ShareModal, MoveToFolderModal, FaceMoveModal, + AlbumShareModal, ImageMultiple, FolderIcon, diff --git a/src/components/modal/AlbumCollaborators.vue b/src/components/modal/AlbumCollaborators.vue index 51785bdf..9d91ca6d 100644 --- a/src/components/modal/AlbumCollaborators.vue +++ b/src/components/modal/AlbumCollaborators.vue @@ -334,6 +334,12 @@ export default defineComponent({ }, async createPublicLinkForAlbum() { + // Check if link already exists + if (this.isPublicLinkSelected) { + return await this.copyPublicLink(); + } + + // Create new link this.selectEntity(`${Type.SHARE_TYPE_LINK}`); await this.updateAlbumCollaborators(); try { @@ -343,9 +349,7 @@ export default defineComponent({ if (!utils.uid) return; const album = await dav.getAlbum(utils.uid, this.albumName); this.populateCollaborators(album.collaborators); - - // Direct share if native share is available - if (nativex.has()) this.copyPublicLink(); + await this.copyPublicLink(); } catch (error) { if (error.response?.status === 404) { this.errorFetchingAlbum = 404; @@ -396,16 +400,12 @@ export default defineComponent({ await navigator.clipboard.writeText(link); this.publicLinkCopied = true; - setTimeout(() => { - this.publicLinkCopied = false; - }, 10000); + await new Promise((resolve) => setTimeout(resolve, 2000)); + this.publicLinkCopied = false; }, selectEntity(collaboratorKey: string) { - if (this.selectedCollaboratorsKeys.includes(collaboratorKey)) { - return; - } - + if (this.selectedCollaboratorsKeys.includes(collaboratorKey)) return; this.refs.popover?.$refs.popover.hide(); this.selectedCollaboratorsKeys.push(collaboratorKey); }, diff --git a/src/components/modal/AlbumShareModal.vue b/src/components/modal/AlbumShareModal.vue index 09df467e..b1c92aa1 100644 --- a/src/components/modal/AlbumShareModal.vue +++ b/src/components/modal/AlbumShareModal.vue @@ -4,8 +4,24 @@ {{ t('memories', 'Share Album') }} + +