π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
intercept 2
Manav Rathi6cf881dd60ee
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.tsindex a12047293d..4b39efa2fe 100644--- a/web/packages/gallery/components/viewer/photoswipe.ts+++ b/web/packages/gallery/components/viewer/photoswipe.ts@@ -842,6 +842,36 @@ export class FileViewerPhotoSwipe {if (currentFileAnnotation().showDownload) handleDownload();};+ /**+ * Toggle the settings menu by activating the menu button.+ *+ * This should be more robust than us trying to reverse engineer the+ * internal media chrome logic to open and close the menu. However, the+ * caveat is that this will only work for closing the menu (our goal)+ * if the menu is already open.+ */+ const toggleMediaChromeSettingsMenu = () => {+ const menuButton = document.querySelector(+ "media-settings-menu-button",+ );+ if (menuButton instanceof MediaChromeMenuButton) {+ menuButton.handleClick();++ // See: [Note: Media chrome focus workaround]+ //+ // Whatever media chrome is doing internally, it requires us to+ // drop the focus multiple times (Removing either of these calls+ // is not enough).+ const blurAllFocused = () =>+ document+ .querySelectorAll(":focus")+ .forEach((e) => e instanceof HTMLElement && e.blur());++ blurAllFocused();+ setTimeout(blurAllFocused, 0);+ }+ };+const onVideoQualityChange = (e: Event) => {if (shouldIgnoreNextVideoQualityChange) {// Ignore changes that we ourselves initiated on slide change.@@ -849,17 +879,25 @@ export class FileViewerPhotoSwipe {return;}+ // The menu is open at this point, so toggling it is equivalent to+ // closing it.+ toggleMediaChromeSettingsMenu();+const { file, itemData } = currentAnnotatedFile();const fileID = file.id;if (e.target instanceof MediaChromeMenu &&- e.target.value == pt("Original") &&+ // e.target.value will be the new value.+ e.target.value == pt("Auto") &&!itemData.videoPlaylistURL) {// The user is trying to switch to "auto" video quality, but// there is no streamable variant yet.- console.log("na", itemData);+ console.log("TODO(HLS)", itemData);+ // Revert.+ shouldIgnoreNextVideoQualityChange = true;+ e.target.value = pt("Original");return;}@@ -875,27 +913,6 @@ export class FileViewerPhotoSwipe {originalVideoFileIDs.add(fileID);}- // Close the menu.- const menuButton = document.querySelector(- "media-settings-menu-button",- );- if (menuButton instanceof MediaChromeMenuButton) {- menuButton.handleClick();-- // See: [Note: Media chrome focus workaround]- //- // Whatever media chrome is doing internally, it requires us to- // drop the focus multiple times (Removing either of these calls- // is not enough).- const blurAllFocused = () =>- document- .querySelectorAll(":focus")- .forEach((e) => e instanceof HTMLElement && e.blur());-- blurAllFocused();- setTimeout(blurAllFocused, 0);- }-// Refresh the slide so that the video is fetched afresh, but using// the updated `originalVideoFileIDs` value for it.pswp.refreshSlideContent(pswp.currIndex);