feat: R27-2 R27-5 优化企微入口与 Portal 体验

这个提交包含在:
2026-03-22 19:52:54 +08:00
父节点 eaef213d22
当前提交 312200ec1b
共修改 16 个文件,包含 1213 行新增和 315 行删除
+2 -11
查看文件
@@ -1,17 +1,10 @@
import { registerSW } from "virtual:pwa-register";
import { canUseWindow, isEnterpriseMessengerContainer, matchesMedia } from "./lib/runtimeContext";
const MOBILE_APPROVAL_TASK_PATH = /^\/workflow\/tasks\/([^/]+)$/i;
const OFFLINE_ALLOWED_PATHS = ["/mobile/approvals"];
const RUNTIME_CACHE_NAMES = ["app-api-runtime"];
function canUseWindow() {
return typeof window !== "undefined";
}
function matchesMedia(query: string) {
return canUseWindow() && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
}
export function registerPwaIfEnabled() {
if (import.meta.env.DEV) {
return;
@@ -59,12 +52,10 @@ export function shouldPreferMobileApprovalExperience() {
return false;
}
const userAgent = window.navigator.userAgent.toLowerCase();
const isStandalone = matchesMedia("(display-mode: standalone)") || (window.navigator as Navigator & { standalone?: boolean }).standalone === true;
const isImContainer = /(wxwork|wecom|wechatwork|dingtalk|aliapp\(dingtalk\))/i.test(userAgent);
const isTouchSmallScreen = window.navigator.maxTouchPoints > 0 && matchesMedia("(max-width: 1024px)");
return isStandalone || isImContainer || isTouchSmallScreen;
return isStandalone || isEnterpriseMessengerContainer() || isTouchSmallScreen;
}
export async function clearPwaRuntimeCaches() {