Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update public album Try Ente URL behavior

Anand Baburajanc2b65c2062a5
diff --git a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
index 580862bfc1..d9f0c41916 100644
--- a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
+++ b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
@@ -5,7 +5,6 @@ import ShareIcon from "@mui/icons-material/Share";
import { Box, Button, IconButton, styled } from "@mui/material";
import { FeedIcon } from "components/Collections/CollectionHeader";
import { EnteLogo } from "ente-base/components/EnteLogo";
-import { useIsTouchscreen } from "ente-base/components/utils/hooks";
import type { PublicAlbumsCredentials } from "ente-base/http";
import type { Collection } from "ente-media/collection";
import { Notification } from "ente-new/photos/components/Notification";
@@ -38,7 +37,6 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({
credentials,
}) => {
const [showCopiedMessage, setShowCopiedMessage] = useState(false);
- const isTouchscreen = useIsTouchscreen();
const enableJoin = publicCollection?.publicURLs[0]?.enableJoin;
const { handleJoinAlbum } = useJoinAlbum({
@@ -118,12 +116,9 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({
onClick={
enableJoin
? handleJoinAlbum
- : () =>
- window.open(
- getEnteURL(isTouchscreen),
- "_blank",
- "noopener",
- )
+ : () => {
+ window.location.href = getEnteURL();
+ }
}
>
{enableJoin ? t("join_album") : t("try_ente")}
diff --git a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
index 9b4f93354d..9e03cb274e 100644
--- a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
+++ b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
@@ -4,7 +4,6 @@ import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import ShareIcon from "@mui/icons-material/Share";
import { Box, Button, IconButton, styled } from "@mui/material";
import { FeedIcon } from "components/Collections/CollectionHeader";
-import { useIsTouchscreen } from "ente-base/components/utils/hooks";
import type { PublicAlbumsCredentials } from "ente-base/http";
import type { Collection } from "ente-media/collection";
import { Notification } from "ente-new/photos/components/Notification";
@@ -35,7 +34,6 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
credentials,
}) => {
const [showCopiedMessage, setShowCopiedMessage] = useState(false);
- const isTouchscreen = useIsTouchscreen();
const enableJoin = publicCollection?.publicURLs[0]?.enableJoin;
const { handleJoinAlbum } = useJoinAlbum({
@@ -84,12 +82,9 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
onClick={
enableJoin
? handleJoinAlbum
- : () =>
- window.open(
- getEnteURL(isTouchscreen),
- "_blank",
- "noopener",
- )
+ : () => {
+ window.location.href = getEnteURL();
+ }
}
>
{enableJoin ? t("join_album") : t("try_ente")}
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 0934840fce..7d401a0554 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -28,10 +28,7 @@ import {
SingleInputForm,
type SingleInputFormProps,
} from "ente-base/components/SingleInputForm";
-import {
- useIsSmallWidth,
- useIsTouchscreen,
-} from "ente-base/components/utils/hooks";
+import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { useModalVisibility } from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import {
@@ -756,7 +753,6 @@ const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({
collectionKey,
credentials,
}) => {
- const isTouchscreen = useIsTouchscreen();
const { handleJoinAlbum } = useJoinAlbum({
publicCollection,
accessToken,
@@ -773,7 +769,7 @@ const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({
}
const handleGetEnte = () => {
- window.open(getEnteURL(isTouchscreen), "_blank", "noopener");
+ window.location.href = getEnteURL();
};
return (
diff --git a/web/apps/photos/src/utils/public-album.ts b/web/apps/photos/src/utils/public-album.ts
index b9c2740c2c..451538cf82 100644
--- a/web/apps/photos/src/utils/public-album.ts
+++ b/web/apps/photos/src/utils/public-album.ts
@@ -1,31 +1,4 @@
/**
- * Get the appropriate URL for "Get Ente" button based on platform.
- *
- * Returns app store URLs for iOS/Android devices, ente.io for desktop.
+ * Get the destination URL for "Try Ente" actions in public albums.
*/
-export const getEnteURL = (isTouchscreen: boolean): string => {
- if (isTouchscreen) {
- // For mobile devices, redirect to app stores
- const userAgent = navigator.userAgent || "";
- const isIOS =
- userAgent.includes("iPad") ||
- userAgent.includes("iPhone") ||
- userAgent.includes("iPod");
- const isAndroid = userAgent.includes("Android");
- const isAltAndroidOS =
- /LineageOS|Graphene|Calyx|\/e\/|eOS|HarmonyOS|Huawei|Fire OS|Silk\//i.test(
- userAgent,
- );
-
- if (isIOS) {
- return "https://apps.apple.com/app/id1542026904";
- } else if (isAndroid) {
- // Play Store links can bounce or fail on non-Play Android variants.
- if (isAltAndroidOS) return "https://web.ente.io";
- return "https://play.google.com/store/apps/details?id=io.ente.photos";
- }
- // For other touchscreen devices, fall back to web
- }
- // For desktop or other platforms, redirect to ente.io
- return "https://web.ente.io";
-};
+export const getEnteURL = (): string => "https://ente.io/get";