()
| 29 | } |
| 30 | |
| 31 | export 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 | |
| 64 | export function fileManagerName(): string { |
| 65 | const platform = platformKind(); |
no outgoing calls
no test coverage detected