quick fix for splash screen unlocking

This commit is contained in:
Sean Yesmunt 2019-10-17 13:49:00 -04:00
parent 70a6b7b056
commit 98ee0b1500

View file

@ -119,50 +119,54 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
// 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) { if (status.is_running) {
// Clear the error timeout, it might sit on this step for a while until someone enters their password return Lbry.wallet_status().then(walletStatus => {
if (this.timeout) {
clearTimeout(this.timeout);
}
Lbry.wallet_status().then(walletStatus => {
if (walletStatus.is_locked) { if (walletStatus.is_locked) {
// Clear the error timeout, it might sit on this step for a while until someone enters their password
if (this.timeout) {
clearTimeout(this.timeout);
}
// Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON) // Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON)
if (launchedModal === false && !modal) { if (launchedModal === false && !modal) {
this.setState({ launchedModal: true }, () => notifyUnlockWallet()); this.setState({ launchedModal: true }, () => notifyUnlockWallet());
setTimeout(() => {
this.updateStatus();
}, 500);
} }
} else { } else {
return Lbry.resolve({ urls: 'lbry://one' }).then(() => { if (!this.timeout) {
this.adjustErrorTimeout();
}
Lbry.resolve({ urls: 'lbry://one' }).then(() => {
this.setState({ isRunning: true }, () => this.continueAppLaunch()); this.setState({ isRunning: true }, () => this.continueAppLaunch());
}); });
} }
}); });
} else { } else if (blockchainHeaders) {
if (blockchainHeaders) { const blockChainHeaders = blockchainHeaders;
const blockChainHeaders = blockchainHeaders; if (blockChainHeaders.download_progress < 100) {
if (blockChainHeaders.download_progress < 100) {
this.setState({
message: __('Blockchain Sync'),
details: `${__('Catching up...')} (${blockchainHeaders.download_progress}%)`,
});
}
} else if (wallet && wallet.blocks_behind > 0) {
const amountBehind =
wallet.blocks_behind === 1 ? '%amountBehind% block behind' : '%amountBehind% blocks behind';
this.setState({ this.setState({
message: __('Blockchain Sync'), message: __('Blockchain Sync'),
details: `${__('Catching up...')} (${__(amountBehind, { amountBehind: wallet.blocks_behind })})`, details: `${__('Catching up...')} (${blockchainHeaders.download_progress}%)`,
});
} else if (wallet && wallet.blocks_behind === 0 && !status.is_running && startupStatus.database) {
this.setState({
message: 'Finalizing',
details: 'Almost ready...',
}); });
} }
} else if (wallet && wallet.blocks_behind > 0) {
setTimeout(() => { const amountBehind = wallet.blocks_behind === 1 ? '%amountBehind% block behind' : '%amountBehind% blocks behind';
this.updateStatus(); this.setState({
}, 500); message: __('Blockchain Sync'),
details: `${__('Catching up...')} (${__(amountBehind, { amountBehind: wallet.blocks_behind })})`,
});
} else if (wallet && wallet.blocks_behind === 0 && !status.is_running && startupStatus.database) {
this.setState({
message: 'Finalizing',
details: 'Almost ready...',
});
} }
setTimeout(() => {
this.updateStatus();
}, 500);
} }
runWithIncompatibleDaemon() { runWithIncompatibleDaemon() {