From 3c2b633dadffb98f83079a9e2529238c7999e3f1 Mon Sep 17 00:00:00 2001 From: Rei Date: Wed, 9 Sep 2026 13:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8B=B9=E6=9E=9C=E4=B8=8E?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=86=85=E5=9C=B0=E5=9D=80=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/Footer.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/Layout/Footer.tsx b/src/components/Layout/Footer.tsx index c803673..2256014 100644 --- a/src/components/Layout/Footer.tsx +++ b/src/components/Layout/Footer.tsx @@ -22,9 +22,20 @@ export default function Footer() { window.location.href = `geo:0,0?q=${destination}` } else if (/iPhone|iPad|iPod/i.test(ua)) { event.preventDefault() - // Apple Maps Link is an HTTPS URL, which Safari and most iOS webviews - // handle more reliably than the blocked custom `maps://` scheme. - window.location.href = appleMapsLink + if (/MicroMessenger/i.test(ua)) { + // WeChat blocks third-party app schemes on iOS. Give the visitor a useful + // next step instead of leaving the tap with no visible response. + void window.navigator.clipboard?.writeText(address).catch(() => undefined) + window.alert('微信内无法直接唤起地图 App,地址已复制。请点击右上角“···”,选择“在 Safari 中打开”后再点击导航。') + return + } + // AMap's iOS scheme opens the installed AMap app and uses its current + // location as the starting point when only dname is supplied. + const openedAt = Date.now() + window.location.href = `iosamap://path?sourceApplication=ameiba&dname=${destination}&t=0` + window.setTimeout(() => { + if (!document.hidden && Date.now() - openedAt >= 1_000) window.location.href = appleMapsLink + }, 1_200) } } return (