aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-04 03:45:28 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-04 03:45:28 +0800
commitab0055d5c68bea1dec6a4bbbe4a76822783d3a2c (patch)
tree9010115fb537b90d01eafff88ae00ab950c635d1 /packages/website
parenta858e2870b0aa3fee46159f4b58981c513bbf8b8 (diff)
downloaddexon-0x-contracts-ab0055d5c68bea1dec6a4bbbe4a76822783d3a2c.tar.gz
dexon-0x-contracts-ab0055d5c68bea1dec6a4bbbe4a76822783d3a2c.tar.zst
dexon-0x-contracts-ab0055d5c68bea1dec6a4bbbe4a76822783d3a2c.zip
Add OperatingSystemType and get OS util
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/ts/types.ts10
-rw-r--r--packages/website/ts/utils/utils.ts18
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);
},