π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
sp
Manav Rathi183000526c3b
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex ff33edb855..8363af1c4d 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -945,6 +945,7 @@ const Shortcuts: React.FC<ModalVisibilityProps> = ({ open, onClose }) => (shortcut="H, Tap outside image"/><Shortcut action="Pan" shortcut="W / A / S / D, Drag" />+ <Shortcut action="Toggle live" shortcut="Space" /><Shortcut action="Toggle favorite" shortcut="L" /><Shortcut action="View info" shortcut="I" /><Shortcut action="Download" shortcut="K" />diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.tsindex 5c1fe203c3..cb999fb8cc 100644--- a/web/packages/gallery/components/viewer/photoswipe.ts+++ b/web/packages/gallery/components/viewer/photoswipe.ts@@ -388,20 +388,20 @@ export class FileViewerPhotoSwipe {*/let livePhotoToggleButtonElement: HTMLButtonElement | undefined;- // Update the state of the given `videoElement` and the- // `livePhotoToggleButtonElement` to reflect `livePhotoPlay`.- //- // Note that "contentAppend" can get called both before, or after,- // "change", so we need to handle both potential sequences for the- // initial display of the video.-+ /**+ * Update the state of the given `videoElement` and the+ * `livePhotoToggleButtonElement` to reflect `livePhotoPlay`.+ *+ * Note that "contentAppend" can get called both before, or after,+ * "change", so we need to handle both potential sequences for the+ * initial display of the video.+ */const livePhotoUpdatePlayback = (video: HTMLVideoElement) => {const button = livePhotoToggleButtonElement;+ if (button) showIf(button, true);+if (livePhotoPlay) {- if (button) {- showIf(button, true);- button.classList.remove("pswp-ente-off");- }+ button?.classList.remove("pswp-ente-off");video.play();video.style.display = "initial";} else {@@ -411,6 +411,19 @@ export class FileViewerPhotoSwipe {}};+ /**+ * Toggle the playback, if possible, of a live photo that's being shown+ * on the current slide.+ */+ const livePhotoTogglePlaybackIfPossible = () => {+ const buttonElement = livePhotoToggleButtonElement;+ const video = livePhotoVideoOnSlide(pswp.currSlide);+ if (!buttonElement || !video) return;++ livePhotoPlay = !livePhotoPlay;+ livePhotoUpdatePlayback(video);+ };+pswp.on("contentAppend", (e) => {const { fileType, videoURL } = e.content.data;if (fileType !== FileType.livePhoto) return;@@ -637,13 +650,7 @@ export class FileViewerPhotoSwipe {livePhotoUpdatePlayback(video);});},- onClick: (e) => {- const buttonElement = e.target;- const video = livePhotoVideoOnSlide(pswp.currSlide)!;-- livePhotoPlay = !livePhotoPlay;- livePhotoUpdatePlayback(video);- },+ onClick: livePhotoTogglePlaybackIfPossible,});pswp.ui.registerElement({@@ -836,11 +843,21 @@ export class FileViewerPhotoSwipe {slide.panTo(slide.pan.x, slide.pan.y);};+ // Actions we handle ourselves.+const handleToggleUIControls = () => {toggleUIControls();lastActivityDate = new Date();};+ const handleTogglePlaybackIfPossible = () => {+ switch (currentAnnotatedFile().itemData.fileType) {+ case FileType.livePhoto:+ livePhotoTogglePlaybackIfPossible();+ return;+ }+ };+// Some actions routed via the delegateconst handleDelete = () => delegate.performKeyAction("delete");@@ -885,6 +902,9 @@ export class FileViewerPhotoSwipe {if (lkey == "c") cb = handleCopy;} else {switch (key) {+ case " ":+ cb = handleTogglePlaybackIfPossible;+ break;case "Backspace":case "Delete":cb = handleDelete;