check Lbry.wallet_status for unlocked status instead of Lbry.status

This commit is contained in:
Sean Yesmunt 2019-10-16 14:11:00 -04:00
parent d74f573763
commit 09d32f2da5
2 changed files with 22 additions and 22 deletions

View file

@ -1,7 +1,9 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import classnames from 'classnames'; import classnames from 'classnames';
import Icon from 'component/common/icon';
type Props = { type Props = {
removeSnack: any => void, removeSnack: any => void,
@ -48,7 +50,9 @@ class SnackBar extends React.PureComponent<Props> {
})} })}
> >
<div className="snack-bar__message"> <div className="snack-bar__message">
<div>&#9432;</div> <div>
<Icon icon={ICONS.ALERT} size={20} />
</div>
<div>{message}</div> <div>{message}</div>
</div> </div>
{linkText && linkTarget && ( {linkText && linkTarget && (

View file

@ -118,27 +118,29 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
const { wallet, startup_status: startupStatus, blockchain_headers: blockchainHeaders } = status; const { wallet, startup_status: startupStatus, blockchain_headers: blockchainHeaders } = status;
// If the wallet is locked, stop doing anything and make the user input their password // If the wallet is locked, stop doing anything and make the user input their password
if (status.is_running && wallet && wallet.is_locked) { if (status.is_running) {
// Clear the error timeout, it might sit on this step for a while until someone enters their password // Clear the error timeout, it might sit on this step for a while until someone enters their password
if (this.timeout) { if (this.timeout) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
// Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON) Lbry.wallet_status().then(walletStatus => {
if (launchedModal === false && !modal) { if (walletStatus.is_locked) {
this.setState({ launchedModal: true }, () => notifyUnlockWallet()); // Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON)
} if (launchedModal === false && !modal) {
} else if (status.is_running) { this.setState({ launchedModal: true }, () => notifyUnlockWallet());
// If we cleared the error timeout due to a wallet being locked, make sure to start it back up }
if (!this.timeout) {
this.adjustErrorTimeout();
}
Lbry.resolve({ urls: 'lbry://one' }).then(() => { // If we cleared the error timeout due to a wallet being locked, make sure to start it back up
this.setState({ isRunning: true }, () => this.continueAppLaunch()); if (!this.timeout) {
this.adjustErrorTimeout();
}
} else {
Lbry.resolve({ urls: 'lbry://one' }).then(() => {
this.setState({ isRunning: true }, () => this.continueAppLaunch());
});
}
}); });
return;
} else if (blockchainHeaders) { } else if (blockchainHeaders) {
const blockChainHeaders = blockchainHeaders; const blockChainHeaders = blockchainHeaders;
if (blockChainHeaders.download_progress < 100) { if (blockChainHeaders.download_progress < 100) {
@ -153,13 +155,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
message: __('Blockchain Sync'), message: __('Blockchain Sync'),
details: `${__('Catching up...')} (${__(amountBehind, { amountBehind: wallet.blocks_behind })})`, details: `${__('Catching up...')} (${__(amountBehind, { amountBehind: wallet.blocks_behind })})`,
}); });
} else if ( } else if (wallet && wallet.blocks_behind === 0 && !status.is_running && startupStatus.database) {
wallet &&
wallet.blocks_behind === 0 &&
!wallet.is_locked &&
!status.is_running &&
startupStatus.database
) {
this.setState({ this.setState({
message: 'Finalizing', message: 'Finalizing',
details: 'Almost ready...', details: 'Almost ready...',