Compare commits

..

No commits in common. "6828809081c89eb4168bc8aa7e210c70a0a2c3d0" and "3d9f93e2044fc7881fd38480a726dd8d2b48f64c" have entirely different histories.

View file

@ -1,4 +1,3 @@
import { Capacitor } from "@capacitor/core";
import { CalendarDays, HeartPulse, Smartphone, Sparkles, Users } from "lucide-react"; import { CalendarDays, HeartPulse, Smartphone, Sparkles, Users } from "lucide-react";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -30,13 +29,6 @@ export function LandingPage() {
// whether the viewport is narrow (a resized desktop window shouldn't // whether the viewport is narrow (a resized desktop window shouldn't
// attempt a scheme navigation just because it's a small window). // attempt a scheme navigation just because it's a small window).
const isMobile = isAndroidPhoneBrowser(); 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() { function handleOpenApp() {
attemptOpenNativeApp({ onFallback: () => navigate("/telecharger") }); attemptOpenNativeApp({ onFallback: () => navigate("/telecharger") });
@ -77,7 +69,7 @@ export function LandingPage() {
* this button doesn't render at all (see the plain `/telecharger` * this button doesn't render at all (see the plain `/telecharger`
* link below instead, replacing the old direct-APK link). * link below instead, replacing the old direct-APK link).
*/} */}
{canOfferApp && ( {isMobile && (
<button <button
type="button" type="button"
className="landing__cta landing__cta--primary" className="landing__cta landing__cta--primary"
@ -89,7 +81,7 @@ export function LandingPage() {
)} )}
<Link <Link
className={ className={
canOfferApp isMobile
? "landing__cta landing__cta--secondary" ? "landing__cta landing__cta--secondary"
: "landing__cta landing__cta--primary" : "landing__cta landing__cta--primary"
} }
@ -102,16 +94,14 @@ export function LandingPage() {
</Link> </Link>
</div> </div>
{/* {/*
* Desktop browser only — a phone browser gets the scheme-open * Desktop only — a scheme-open attempt (the mobile button above)
* button above instead, and inside the packaged app "get the app" * has no meaning here. Routed through `/telecharger` (the same
* is meaningless (a tablet Capacitor WebView can lack "Mobile" in * fallback page a failed mobile attempt lands on) rather than
* its UA, so `!isMobile` isn't enough on its own — issue #103). * linking `${API_BASE_URL}/mobile/download` directly, so "get
* Routed through `/telecharger` (the same fallback page a failed * the app" has exactly one canonical destination app-wide
* mobile attempt lands on) rather than linking * instead of two slightly different mechanisms to keep in sync.
* `${API_BASE_URL}/mobile/download` directly, so "get the app"
* has exactly one canonical destination app-wide.
*/} */}
{!isMobile && !Capacitor.isNativePlatform() && ( {!isMobile && (
<Link className="landing__mobile-link" to="/telecharger"> <Link className="landing__mobile-link" to="/telecharger">
<Smartphone aria-hidden /> <Smartphone aria-hidden />
{t("landing.hero.mobileDownload")} {t("landing.hero.mobileDownload")}