[Splash] Rewrite state handling to add retry state and make messages same format as Discord's
This commit is contained in:
parent
4e4ab5cd47
commit
e371d6b106
1 changed files with 13 additions and 3 deletions
|
@ -114,9 +114,19 @@
|
|||
DiscordSplash.signalReady();
|
||||
|
||||
const outOfStates = [ 'downloading-updates', 'installing-updates' ];
|
||||
DiscordSplash.onStateUpdate(({ status, current, total, progress }) => {
|
||||
text.textContent = status.replaceAll('-', ' ') + '...';
|
||||
if (outOfStates.includes(state)) text.textContent += ` (${current}/${total})`;
|
||||
const retryStates = [ 'update-failure' ];
|
||||
DiscordSplash.onStateUpdate(({ status, current, total, progress, seconds }) => {
|
||||
let text = status.replaceAll('-', ' ') + '...';
|
||||
|
||||
if (outOfStates.includes(status)) { // X out of Y states
|
||||
text = text.slice(0, -4) + ` ${current} of ${total}`; // Remove "s..." and concat
|
||||
}
|
||||
if (retryStates.includes(status)) { // Retrying in X states
|
||||
text = text.slice(0, -3) + ` - Retrying in ${seconds}`; // Remove "..." and concat
|
||||
}
|
||||
|
||||
text.textContent = text;
|
||||
|
||||
|
||||
if (progress) {
|
||||
barContainer.style.visibility = 'visible';
|
||||
|
|
Loading…
Reference in a new issue