fix(pwa): suppress install dialog in in-app browsers

This commit is contained in:
2026-06-17 16:19:21 +08:00
parent 62468ffc6a
commit f39e7e0672
3 changed files with 2 additions and 10 deletions
@@ -14,6 +14,7 @@
*/
import { useEffect } from "react";
import { BrowserDetector } from "@/utils/browser-detect";
import { SpAsyncUtil } from "@/utils/storage";
import { pwaUtil } from "@/utils/pwa";
@@ -32,6 +33,7 @@ export function PwaInstallOverlay() {
// isInstalled() 检查 standalone display-mode(避免给已安装用户再弹)
if (!pwaUtil.isSupported()) return;
if (pwaUtil.isInstalled()) return;
if (BrowserDetector.isInAppBrowser()) return;
// 提前挂 beforeinstallprompt 监听,避免用户点 OK 时事件已在更早时机丢失。
pwaUtil.prepareInstallPrompt();