diff --git a/apps/web/src/pages/landing/LandingPage.tsx b/apps/web/src/pages/landing/LandingPage.tsx index 38b0f5c..366a15f 100644 --- a/apps/web/src/pages/landing/LandingPage.tsx +++ b/apps/web/src/pages/landing/LandingPage.tsx @@ -1,3 +1,4 @@ +import { Capacitor } from "@capacitor/core"; import { CalendarDays, HeartPulse, Smartphone, Sparkles, Users } from "lucide-react"; import type { ReactNode } from "react"; import { useTranslation } from "react-i18next"; @@ -29,6 +30,13 @@ export function LandingPage() { // whether the viewport is narrow (a resized desktop window shouldn't // attempt a scheme navigation just because it's a small window). const isMobile = isAndroidPhoneBrowser(); + // ...but the Capacitor WebView's UA *also* contains "Android"/"Mobile", + // so `isMobile` alone is true inside the packaged app too — where + // "Ouvrir dans l'application" is nonsense (you're already in it; tapping + // it just tries to re-launch via the scheme, fails, and lands on + // `/telecharger`). `canOfferApp` is the real "a phone *browser* where + // pushing the native app is worthwhile" flag (issue #103). + const canOfferApp = isMobile && !Capacitor.isNativePlatform(); function handleOpenApp() { attemptOpenNativeApp({ onFallback: () => navigate("/telecharger") }); @@ -69,7 +77,7 @@ export function LandingPage() { * this button doesn't render at all (see the plain `/telecharger` * link below instead, replacing the old direct-APK link). */} - {isMobile && ( + {canOfferApp && (