aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/instant/src/components/payment_method.tsx22
-rw-r--r--packages/instant/src/containers/connected_account_payment_method.ts10
2 files changed, 6 insertions, 26 deletions
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index 21bb2902b..66ebe1f20 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -102,7 +102,7 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
);
case AccountState.None:
return (
- <WalletPrompt onClick={this._handleInstallWalletClick} image={logo} {...colors}>
+ <WalletPrompt onClick={this.props.onInstallWalletClick} image={logo} {...colors}>
{isMobile ? 'Install Coinbase Wallet' : 'Install MetaMask'}
</WalletPrompt>
);
@@ -116,24 +116,4 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
);
}
};
- private readonly _handleInstallWalletClick = (): void => {
- const isMobile = envUtil.isMobileOperatingSystem();
- if (!isMobile) {
- this.props.onInstallWalletClick();
- 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');
- };
}
diff --git a/packages/instant/src/containers/connected_account_payment_method.ts b/packages/instant/src/containers/connected_account_payment_method.ts
index beaaccf2f..eacbadfca 100644
--- a/packages/instant/src/containers/connected_account_payment_method.ts
+++ b/packages/instant/src/containers/connected_account_payment_method.ts
@@ -22,7 +22,7 @@ interface ConnectedState {
}
interface ConnectedDispatch {
- onInstallWalletClick: () => void;
+ openInstallWalletPanel: () => void;
unlockWalletAndDispatchToStore: (providerState: ProviderState) => void;
}
@@ -39,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),
});
@@ -52,12 +52,12 @@ const mergeProps = (
...ownProps,
network: connectedState.network,
account: connectedState.providerState.account,
- onInstallWalletClick: connectedDispatch.onInstallWalletClick,
walletName: connectedState.providerState.name,
- onUnlockWalletClick: () => {
+ onUnlockWalletClick: () => connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState),
+ onInstallWalletClick: () => {
const isMobile = envUtil.isMobileOperatingSystem();
if (!isMobile) {
- connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState);
+ connectedDispatch.openInstallWalletPanel();
return;
}
const operatingSystem = envUtil.getOperatingSystem();