From ab0055d5c68bea1dec6a4bbbe4a76822783d3a2c Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 3 Jul 2018 12:45:28 -0700 Subject: Add OperatingSystemType and get OS util --- packages/website/ts/types.ts | 10 ++++++++++ packages/website/ts/utils/utils.ts | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'packages/website') 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); }, -- cgit v1.2.3