fix: show save guide on mobile only
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 27s

This commit is contained in:
TerryM
2026-06-01 23:13:25 +08:00
parent 097c12bab5
commit 5a5acfcbc2

View File

@@ -53,6 +53,13 @@ export function mediaSaveKindFromType(
type SavePlatform = "ios" | "android" | "desktop";
const saveAlbumGuideMobileMediaQuery = "(max-width: 760px)";
function shouldShowSaveAlbumGuide(): boolean {
if (typeof window === "undefined" || !window.matchMedia) return false;
return window.matchMedia(saveAlbumGuideMobileMediaQuery).matches;
}
function detectSavePlatform(): SavePlatform {
if (typeof navigator === "undefined") return "desktop";
const ua = navigator.userAgent || "";
@@ -92,6 +99,7 @@ export function SaveToAlbumGuideProvider({
const platform = useMemo(() => detectSavePlatform(), []);
const showSaveToAlbumGuide = useCallback((kind: SaveToAlbumMediaKind) => {
if (!shouldShowSaveAlbumGuide()) return;
setMediaKind(kind);
}, []);