mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-21 22:57:17 +01:00
chore(env-utils): narrow down types of is platform functions
This commit is contained in:
committed by
Jiri Zbytovsky
parent
5f431c0d01
commit
35c943abd9
@@ -71,14 +71,14 @@ const getProcessPlatform = () => (typeof process !== 'undefined' ? process.platf
|
||||
|
||||
const isMacOs = () => {
|
||||
if (getProcessPlatform() === 'darwin') return true;
|
||||
if (typeof window === 'undefined') return;
|
||||
if (typeof window === 'undefined') return false;
|
||||
|
||||
return getPlatform().toLowerCase().startsWith('mac');
|
||||
};
|
||||
|
||||
const isWindows = () => {
|
||||
if (getProcessPlatform() === 'win32') return true;
|
||||
if (typeof window === 'undefined') return;
|
||||
if (typeof window === 'undefined') return false;
|
||||
|
||||
return getPlatform().toLowerCase().startsWith('win');
|
||||
};
|
||||
@@ -87,7 +87,7 @@ const isIOs = () => ['iPhone', 'iPad', 'iPod'].includes(getPlatform());
|
||||
|
||||
const isLinux = () => {
|
||||
if (getProcessPlatform() === 'linux') return true;
|
||||
if (typeof window === 'undefined') return;
|
||||
if (typeof window === 'undefined') return false;
|
||||
|
||||
// exclude Android and Chrome OS as window.navigator.platform of those OS is Linux
|
||||
if (isAndroid() || isChromeOs()) return false;
|
||||
|
||||
@@ -24,10 +24,10 @@ export interface EnvUtils {
|
||||
getLocationOrigin: () => string;
|
||||
getLocationHostname: () => string;
|
||||
getProcessPlatform: () => string;
|
||||
isMacOs: () => boolean | undefined;
|
||||
isWindows: () => boolean | undefined;
|
||||
isMacOs: () => boolean;
|
||||
isWindows: () => boolean;
|
||||
isIOs: () => boolean;
|
||||
isLinux: () => boolean | undefined;
|
||||
isLinux: () => boolean;
|
||||
isCodesignBuild: () => boolean;
|
||||
getOsName: () => '' | 'android' | 'linux' | 'windows' | 'macos' | 'chromeos' | 'ios';
|
||||
getOsNameWeb: () => string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user