π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Add native share support to TripLayout mobile view
anandbaburajancf2ad5a98ea4
diff --git a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsxindex 1cd92b6f4b..d875e73694 100644--- a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx+++ b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx@@ -13,21 +13,35 @@ interface MobileNavBarProps {onAddPhotos?: () => void;downloadAllFiles: () => void;enableDownload?: boolean;+ collectionTitle?: string;}export const MobileNavBar: React.FC<MobileNavBarProps> = ({onAddPhotos,downloadAllFiles,enableDownload,+ collectionTitle,}) => {const [showCopiedMessage, setShowCopiedMessage] = useState(false);const isTouchscreen = useIsTouchscreen();- const handleShare = () => {+ const handleShare = async () => {if (typeof window !== "undefined") {- void navigator.clipboard.writeText(window.location.href);- setShowCopiedMessage(true);- setTimeout(() => setShowCopiedMessage(false), 2000);+ try {+ await navigator.share({+ title: collectionTitle || "Trip",+ url: window.location.href,+ });+ } catch (error) {+ if (+ !error ||+ (error instanceof Error && error.name !== "AbortError")+ ) {+ void navigator.clipboard.writeText(window.location.href);+ setShowCopiedMessage(true);+ setTimeout(() => setShowCopiedMessage(false), 2000);+ }+ }}};diff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsxindex 74af4e10bc..503fd47f64 100644--- a/web/apps/photos/src/components/TripLayout/index.tsx+++ b/web/apps/photos/src/components/TripLayout/index.tsx@@ -336,6 +336,7 @@ export const TripLayout: React.FC<TripLayoutProps> = ({onAddPhotos={onAddPhotos}downloadAllFiles={downloadAllFiles}enableDownload={enableDownload}+ collectionTitle={collectionTitle}/>) : (<TopNavButtons