diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-11-16 06:35:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 06:35:13 +0800 |
commit | 312dfb957267d5c96fa7d922d2f21112019fb6fa (patch) | |
tree | b4d17a68db63cc788b4980848be99d9a42acd5b0 /packages/instant/src/containers | |
parent | 34d86647bfc56dbf8221b08b3d7bdeba08f46ca1 (diff) | |
parent | 587739f8e1eb397ed0ec81ad4b3aec6403e96d11 (diff) | |
download | dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar.gz dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar.bz2 dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar.lz dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar.xz dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.tar.zst dexon-sol-tools-312dfb957267d5c96fa7d922d2f21112019fb6fa.zip |
Merge pull request #1266 from 0xProject/feature/instant/fix-mobile-specific-content
[instant] Fix mobile specific content
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r-- | packages/instant/src/containers/connected_account_payment_method.ts | 35 |
1 files changed, 29 insertions, 6 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..eacbadfca 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 {} @@ -16,7 +22,7 @@ interface ConnectedState { } interface ConnectedDispatch { - onInstallWalletClick: () => void; + openInstallWalletPanel: () => void; unlockWalletAndDispatchToStore: (providerState: ProviderState) => void; } @@ -33,7 +39,7 @@ const mapDispatchToProps = ( dispatch: Dispatch<Action>, ownProps: ConnectedAccountPaymentMethodProps, ): ConnectedDispatch => ({ - onInstallWalletClick: () => dispatch(actions.openStandardSlidingPanel(StandardSlidingPanelContent.InstallWallet)), + openInstallWalletPanel: () => dispatch(actions.openStandardSlidingPanel(StandardSlidingPanelContent.InstallWallet)), unlockWalletAndDispatchToStore: async (providerState: ProviderState) => asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true), }); @@ -46,10 +52,27 @@ const mergeProps = ( ...ownProps, network: connectedState.network, account: connectedState.providerState.account, - onInstallWalletClick: connectedDispatch.onInstallWalletClick, walletName: connectedState.providerState.name, - onUnlockWalletClick: () => { - connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState); + onUnlockWalletClick: () => connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState), + onInstallWalletClick: () => { + const isMobile = envUtil.isMobileOperatingSystem(); + if (!isMobile) { + connectedDispatch.openInstallWalletPanel(); + 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'); }, }); |