Skip to content

Commit

Permalink
Attempt to unlock MetaMask onClick, and provide existing flow with no…
Browse files Browse the repository at this point in the history
…tification when unlock fails.
  • Loading branch information
dternyak committed Dec 29, 2017
1 parent 901c99e commit 4fd3330
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions common/components/WalletDecrypt/WalletDecrypt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ interface BaseWalletInfo {
unlock: any;
helpLink?: string;
isReadOnly?: boolean;
attemptUnlock?: boolean;
}

export interface SecureWalletInfo extends BaseWalletInfo {
Expand Down Expand Up @@ -105,6 +106,7 @@ export class WalletDecrypt extends Component<Props, State> {
component: Web3Decrypt,
initialParams: {},
unlock: this.props.unlockWeb3,
attemptUnlock: true,
helpLink: `${knowledgeBaseURL}/migration/moving-from-private-key-to-metamask`
},
'ledger-nano-s': {
Expand Down Expand Up @@ -282,10 +284,19 @@ export class WalletDecrypt extends Component<Props, State> {
return;
}

this.setState({
selectedWalletKey: walletType,
value: wallet.initialParams
});
let timeout = 0;

if (wallet.attemptUnlock) {
timeout = 250;
wallet.unlock();
}

setTimeout(() => {
this.setState({
selectedWalletKey: walletType,
value: wallet.initialParams
});
}, timeout);
};

public clearWalletChoice = () => {
Expand Down

0 comments on commit 4fd3330

Please sign in to comment.