Add OperatingSystemType and get OS util

This commit is contained in:
fragosti 2018-07-03 12:45:28 -07:00
parent a858e2870b
commit ab0055d5c6
2 changed files with 28 additions and 0 deletions

View File

@ -567,6 +567,16 @@ export enum BrowserType {
Other = 'Other', Other = 'Other',
} }
export enum OperatingSystemType {
Android = 'Android',
iOS = 'iOS',
Mac = 'Mac',
Windows = 'Windows',
WindowsPhone = 'WindowsPhone',
Linux = 'Linux',
Other = 'Other',
}
export enum AccountState { export enum AccountState {
Disconnected = 'Disconnected', Disconnected = 'Disconnected',
Ready = 'Ready', Ready = 'Ready',

View File

@ -24,6 +24,7 @@ import {
Token, Token,
TokenByAddress, TokenByAddress,
TokenState, TokenState,
OperatingSystemType,
} from 'ts/types'; } from 'ts/types';
import { configs } from 'ts/utils/configs'; import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants'; import { constants } from 'ts/utils/constants';
@ -418,6 +419,23 @@ export const utils = {
return BrowserType.Other; 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 { isTokenTracked(token: Token): boolean {
return !_.isUndefined(token.trackedTimestamp); return !_.isUndefined(token.trackedTimestamp);
}, },