fix status being called continuosly after startup

This commit is contained in:
Sean Yesmunt 2019-10-17 11:37:57 -04:00
parent 4e70642163
commit 18c5743f89

View file

@ -130,41 +130,39 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
if (launchedModal === false && !modal) { if (launchedModal === false && !modal) {
this.setState({ launchedModal: true }, () => notifyUnlockWallet()); 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();
}
} else { } else {
Lbry.resolve({ urls: 'lbry://one' }).then(() => { return Lbry.resolve({ urls: 'lbry://one' }).then(() => {
return this.setState({ isRunning: true }, () => this.continueAppLaunch()); this.setState({ isRunning: true }, () => this.continueAppLaunch());
}); });
} }
}); });
} else if (blockchainHeaders) { } else {
const blockChainHeaders = blockchainHeaders; if (blockchainHeaders) {
if (blockChainHeaders.download_progress < 100) { const blockChainHeaders = blockchainHeaders;
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...')} (${blockchainHeaders.download_progress}%)`, 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...',
}); });
} }
} else if (wallet && wallet.blocks_behind > 0) {
const amountBehind = wallet.blocks_behind === 1 ? '%amountBehind% block behind' : '%amountBehind% blocks behind';
this.setState({
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(() => { setTimeout(() => {
this.updateStatus(); this.updateStatus();
}, 500); }, 500);
}
} }
runWithIncompatibleDaemon() { runWithIncompatibleDaemon() {