[Splash > Backend] Clean up source further

This commit is contained in:
Ducko 2022-02-16 16:02:58 +00:00
parent d4e14ae35a
commit b860068286
1 changed files with 8 additions and 8 deletions

View File

@ -72,6 +72,8 @@ const launchMainWindow = () => {
for (const e in modulesListeners) moduleUpdater.events.removeListener(e, modulesListeners[e]); // Remove updater v1 listeners for (const e in modulesListeners) moduleUpdater.events.removeListener(e, modulesListeners[e]); // Remove updater v1 listeners
if (!launchedMainWindow && splashWindow != null) { if (!launchedMainWindow && splashWindow != null) {
sendState(LAUNCHING);
launchedMainWindow = true; launchedMainWindow = true;
events.emit(APP_SHOULD_LAUNCH); events.emit(APP_SHOULD_LAUNCH);
} }
@ -157,10 +159,10 @@ class UIProgress { // Generic class to track updating and sent states to splash
record(id, state, percent) { record(id, state, percent) {
this.total.add(id); this.total.add(id);
if (state !== updater.TASK_STATE_WAITING) { if (state !== 'Waiting') {
this.progress.set(id, percent); this.progress.set(id, percent);
if (state === updater.TASK_STATE_COMPLETE) this.done.add(id); if (state === 'Complete') this.done.add(id);
} }
} }
@ -199,13 +201,14 @@ const updateUntilCurrent = async () => {
installedAnything = true; installedAnything = true;
if (download != null) downloads.record(download.package_sha256, state, percent); const simpleRecord = (tracker, x) => tracker.record(x.package_sha256, state, percent);
if (download != null) simpleRecord(downloads, download);
if (!downloads.send()) installs.send(); if (!downloads.send()) installs.send();
if (install == null) return; if (install == null) return;
simpleRecord(installs, install);
installs.record(install.package_sha256, state, percent);
if (task.HostInstall != null) { if (task.HostInstall != null) {
retryOptions.skip_host_delta = true; retryOptions.skip_host_delta = true;
@ -215,8 +218,6 @@ const updateUntilCurrent = async () => {
}); });
if (!installedAnything) { if (!installedAnything) {
sendState(LAUNCHING);
await newUpdater.startCurrentVersion(); await newUpdater.startCurrentVersion();
newUpdater.setRunningInBackground(); newUpdater.setRunningInBackground();
newUpdater.collectGarbage(); newUpdater.collectGarbage();
@ -278,7 +279,6 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
} else if (updateCount === 0) { } else if (updateCount === 0) {
moduleUpdater.setInBackground(); moduleUpdater.setInBackground();
launchMainWindow(); launchMainWindow();
sendState(LAUNCHING);
} }
}); });