mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-21 22:57:17 +01:00
feat(env-utils): add getCpuArch
This commit is contained in:
committed by
Jiri Zbytovsky
parent
1973c02f62
commit
b3deeb546b
@@ -28,6 +28,8 @@ const getDeviceType = () => '';
|
||||
const getOsVersion = () => Promise.resolve(`${Platform.Version}`);
|
||||
const getDeprecatedOsVersion = () => `${Platform.Version}`;
|
||||
|
||||
const getCpuArch = () => Promise.resolve('');
|
||||
|
||||
const getSuiteVersion = () => Constants.expoConfig?.version || '';
|
||||
|
||||
const getCommitHash = () => Constants.expoConfig?.extra?.commitHash;
|
||||
@@ -94,6 +96,7 @@ export const envUtils: EnvUtils = {
|
||||
getDeviceType,
|
||||
getOsVersion,
|
||||
getDeprecatedOsVersion,
|
||||
getCpuArch,
|
||||
getSuiteVersion,
|
||||
isFirefox,
|
||||
getPlatform,
|
||||
|
||||
@@ -50,6 +50,15 @@ const getOsVersion = async () => {
|
||||
/** @deprecated: Use the async getOsVersion instead. */
|
||||
const getDeprecatedOsVersion = () => getUserAgentParser().getOS().version || '';
|
||||
|
||||
/**
|
||||
* Similar to `getOsVersion`. Here, the sync fn works everywhere but macOS, hence we use async.
|
||||
*/
|
||||
const getCpuArch = async () => {
|
||||
const { architecture } = await getUserAgentParser().getCPU().withClientHints();
|
||||
|
||||
return architecture ?? '';
|
||||
};
|
||||
|
||||
const getSuiteVersion = () => process.env.VERSION || '';
|
||||
|
||||
const getBrowserName = () => {
|
||||
@@ -147,6 +156,7 @@ export const envUtils: EnvUtils = {
|
||||
isChromeOs,
|
||||
getOsVersion,
|
||||
getDeprecatedOsVersion,
|
||||
getCpuArch,
|
||||
getBrowserName,
|
||||
getBrowserVersion,
|
||||
getCommitHash,
|
||||
|
||||
@@ -16,6 +16,7 @@ export const {
|
||||
getDeviceType,
|
||||
getOsVersion,
|
||||
getDeprecatedOsVersion,
|
||||
getCpuArch,
|
||||
getSuiteVersion,
|
||||
isFirefox,
|
||||
getPlatform,
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface EnvUtils {
|
||||
getDeviceType: () => string | undefined;
|
||||
getOsVersion: () => Promise<string>;
|
||||
getDeprecatedOsVersion: () => string;
|
||||
getCpuArch: () => Promise<string>;
|
||||
getSuiteVersion: () => string;
|
||||
isFirefox: () => boolean;
|
||||
getPlatform: () => string;
|
||||
|
||||
Reference in New Issue
Block a user