From ddfa12d2abff1c8a995e03e9c8726e89bd91e6a5 Mon Sep 17 00:00:00 2001 From: ayang <473033518@qq.com> Date: Thu, 20 Feb 2025 11:05:06 +0800 Subject: [PATCH] feat: add methods for detecting Windows and Linux platforms --- src/utils/platform.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/platform.ts b/src/utils/platform.ts index 27332f9..0e0cbee 100644 --- a/src/utils/platform.ts +++ b/src/utils/platform.ts @@ -1,9 +1,13 @@ import { family as osFamily, platform } from "@tauri-apps/plugin-os"; export const isWeb = !("__TAURI_OS_PLUGIN_INTERNALS__" in window); -export const isMobile = isWeb ? navigator.userAgent.toLowerCase().includes("mobile") : platform() === "android"; +export const isMobile = isWeb + ? navigator.userAgent.toLowerCase().includes("mobile") + : platform() === "android"; export const isDesktop = !isMobile; export const isMac = !isWeb && platform() === "macos"; +export const isWin = !isWeb && platform() === "windows"; +export const isLinux = !isWeb && platform() === "linux"; export const appScale = isMobile ? 0.5 : 1; export function family() { @@ -17,4 +21,4 @@ export function family() { } else { return osFamily(); } -} \ No newline at end of file +}