MCPcopy
hub / github.com/Dimillian/CodexMonitor / isMobilePlatform

Function isMobilePlatform

src/utils/platformPaths.ts:31–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31export function isMobilePlatform(): boolean {
32 if (typeof navigator === "undefined") {
33 return false;
34 }
35 const platform =
36 (navigator as Navigator & { userAgentData?: { platform?: string } })
37 .userAgentData?.platform ?? navigator.platform ?? "";
38 const normalizedPlatform = platform.toLowerCase();
39 const userAgent = (navigator.userAgent ?? "").toLowerCase();
40 const maxTouchPoints =
41 typeof (navigator as Navigator).maxTouchPoints === "number"
42 ? (navigator as Navigator).maxTouchPoints
43 : 0;
44 const hasTouch = maxTouchPoints > 0;
45 const hasMobileUserAgentToken =
46 userAgent.includes("mobile") ||
47 userAgent.includes("iphone") ||
48 userAgent.includes("ipad") ||
49 userAgent.includes("ipod") ||
50 userAgent.includes("android");
51 const iPadDesktopMode =
52 normalizedPlatform.includes("mac") &&
53 hasTouch &&
54 (hasMobileUserAgentToken || userAgent.includes("like mac os x"));
55 return (
56 normalizedPlatform.includes("iphone") ||
57 normalizedPlatform.includes("ipad") ||
58 normalizedPlatform.includes("android") ||
59 hasMobileUserAgentToken ||
60 iPadDesktopMode
61 );
62}
63
64export function fileManagerName(): string {
65 const platform = platformKind();

Callers 11

syncMobileViewportHeightFunction · 0.90
useLayoutModeFunction · 0.90
useComposerKeyDownFunction · 0.90
useSettingsServerSectionFunction · 0.90
buildDefaultSettingsFunction · 0.90
useAppBootstrapFunction · 0.90
useWorkspaceDialogsFunction · 0.90
useWorkspaceControllerFunction · 0.90
useMobileServerSetupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected