diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-15 08:27:27 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-16 04:41:49 +0800 |
commit | f9e012398606a85d286087f3e94bf8b95a52df55 (patch) | |
tree | 48cd81751217bc0877faa73de2174052734dacb5 /packages/instant/src/containers/connected_account_payment_method.ts | |
parent | f4cc152cfb6da5c13d2d95ccd2f1a022af9b91a0 (diff) | |
download | dexon-0x-contracts-f9e012398606a85d286087f3e94bf8b95a52df55.tar.gz dexon-0x-contracts-f9e012398606a85d286087f3e94bf8b95a52df55.tar.zst dexon-0x-contracts-f9e012398606a85d286087f3e94bf8b95a52df55.zip |
feat: make onUnlockWalletClick different based on ON
Diffstat (limited to 'packages/instant/src/containers/connected_account_payment_method.ts')
-rw-r--r-- | packages/instant/src/containers/connected_account_payment_method.ts | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/packages/instant/src/containers/connected_account_payment_method.ts b/packages/instant/src/containers/connected_account_payment_method.ts index 69c2ddf19..beaaccf2f 100644 --- a/packages/instant/src/containers/connected_account_payment_method.ts +++ b/packages/instant/src/containers/connected_account_payment_method.ts @@ -3,10 +3,16 @@ import { connect } from 'react-redux'; import { Dispatch } from 'redux'; import { PaymentMethod, PaymentMethodProps } from '../components/payment_method'; +import { + COINBASE_WALLET_ANDROID_APP_STORE_URL, + COINBASE_WALLET_IOS_APP_STORE_URL, + COINBASE_WALLET_SITE_URL, +} from '../constants'; import { Action, actions } from '../redux/actions'; import { asyncData } from '../redux/async_data'; import { State } from '../redux/reducer'; -import { Network, Omit, ProviderState, StandardSlidingPanelContent } from '../types'; +import { Network, Omit, OperatingSystem, ProviderState, StandardSlidingPanelContent } from '../types'; +import { envUtil } from '../util/env'; export interface ConnectedAccountPaymentMethodProps {} @@ -49,7 +55,24 @@ const mergeProps = ( onInstallWalletClick: connectedDispatch.onInstallWalletClick, walletName: connectedState.providerState.name, onUnlockWalletClick: () => { - connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState); + const isMobile = envUtil.isMobileOperatingSystem(); + if (!isMobile) { + connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState); + return; + } + const operatingSystem = envUtil.getOperatingSystem(); + let url = COINBASE_WALLET_SITE_URL; + switch (operatingSystem) { + case OperatingSystem.Android: + url = COINBASE_WALLET_ANDROID_APP_STORE_URL; + break; + case OperatingSystem.iOS: + url = COINBASE_WALLET_IOS_APP_STORE_URL; + break; + default: + break; + } + window.open(url, '_blank'); }, }); |