diff options
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/types.ts | 10 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 2e4cf84d0..324ba5b39 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -567,6 +567,16 @@ export enum BrowserType { Other = 'Other', } +export enum OperatingSystemType { + Android = 'Android', + iOS = 'iOS', + Mac = 'Mac', + Windows = 'Windows', + WindowsPhone = 'WindowsPhone', + Linux = 'Linux', + Other = 'Other', +} + export enum AccountState { Disconnected = 'Disconnected', Ready = 'Ready', diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index fc7901463..e0f9d8e42 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -24,6 +24,7 @@ import { Token, TokenByAddress, TokenState, + OperatingSystemType, } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; @@ -418,6 +419,23 @@ export const utils = { return BrowserType.Other; } }, + getOperatingSystem(): OperatingSystemType { + if (bowser.android) { + return OperatingSystemType.Android; + } else if (bowser.ios) { + return OperatingSystemType.iOS; + } else if (bowser.mac) { + return OperatingSystemType.Mac; + } else if (bowser.windows) { + return OperatingSystemType.Windows; + } else if (bowser.windowsphone) { + return OperatingSystemType.WindowsPhone; + } else if (bowser.linux) { + return OperatingSystemType.Linux; + } else { + return OperatingSystemType.Other; + } + }, isTokenTracked(token: Token): boolean { return !_.isUndefined(token.trackedTimestamp); }, |