aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils/utils.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-04 05:28:49 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-04 05:28:49 +0800
commit931e7e7d71be4ec18081a2501dee0254b511f388 (patch)
tree05aea28a30ba1597e7f3437593fe57701ddd4640 /packages/website/ts/utils/utils.ts
parent3b78188fec8654ff9338afb22708279bf2335c70 (diff)
downloaddexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar.gz
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar.bz2
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar.lz
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar.xz
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.tar.zst
dexon-0x-contracts-931e7e7d71be4ec18081a2501dee0254b511f388.zip
Prompt user to download Toshi or MetaMask in install wallet onboarding step
Diffstat (limited to 'packages/website/ts/utils/utils.ts')
-rw-r--r--packages/website/ts/utils/utils.ts37
1 files changed, 36 insertions, 1 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index ffbf97f12..c47beb480 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -15,6 +15,7 @@ import {
BlockchainCallErrs,
BrowserType,
Environments,
+ OperatingSystemType,
Order,
Providers,
ProviderType,
@@ -24,7 +25,6 @@ import {
Token,
TokenByAddress,
TokenState,
- OperatingSystemType,
} from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
@@ -442,4 +442,39 @@ export const utils = {
isTokenTracked(token: Token): boolean {
return !_.isUndefined(token.trackedTimestamp);
},
+ // Returns a [downloadLink, isOnMobile] tuple.
+ getBestWalletDownloadLink(): [string, boolean] {
+ const browserType = utils.getBrowserType();
+ const isOnMobile = utils.isMobileOperatingSystem();
+ const operatingSystem = utils.getOperatingSystem();
+ let downloadLink;
+ if (isOnMobile) {
+ switch (operatingSystem) {
+ case OperatingSystemType.Android:
+ downloadLink = constants.URL_TOSHI_ANDROID_APP_STORE;
+ break;
+ case OperatingSystemType.iOS:
+ downloadLink = constants.URL_TOSHI_IOS_APP_STORE;
+ break;
+ default:
+ // Toshi is only supported on these mobile OSes - just default to iOS
+ downloadLink = constants.URL_TOSHI_IOS_APP_STORE;
+ }
+ } else {
+ switch (browserType) {
+ case BrowserType.Chrome:
+ downloadLink = constants.URL_METAMASK_CHROME_STORE;
+ break;
+ case BrowserType.Firefox:
+ downloadLink = constants.URL_METAMASK_FIREFOX_STORE;
+ break;
+ case BrowserType.Opera:
+ downloadLink = constants.URL_METAMASK_OPERA_STORE;
+ break;
+ default:
+ downloadLink = constants.URL_METAMASK_HOMEPAGE;
+ }
+ }
+ return [downloadLink, isOnMobile];
+ },
};