Fixed the update modal dialog poping off for new clients

master
WolverinDEV 2021-04-25 15:37:46 +02:00
parent b9f23ca6cc
commit 81a1380d37
2 changed files with 15 additions and 4 deletions

View File

@ -1,10 +1,10 @@
import {LogCategory, logError, logTrace} from "./log";
import {LogCategory, logError, logInfo, logTrace} from "./log";
import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import {Registry} from "./events";
import {tr} from "./i18n/localize";
import {CallOnce, ignorePromise} from "tc-shared/proto";
import {getStorageAdapter} from "tc-shared/StorageAdapter";
import * as loader from "tc-loader";
/*
* TODO: Sync settings across renderer instances
@ -936,7 +936,12 @@ export class Settings {
const json = await getStorageAdapter().get("settings.global");
try {
if(json === null) {
logInfo(LogCategory.GENERAL, tr("Found no settings. Creating new client settings."));
this.settingsCache = {};
} else {
this.settingsCache = JSON.parse(json);
}
} catch(error) {
this.settingsCache = {};
logError(LogCategory.GENERAL, tr("Failed to load global settings!\nJson: %s\nError: %o"), json, error);

View File

@ -140,7 +140,13 @@ class WebUpdater implements Updater {
}
getLastUsedVersion(): string {
return settings.getValue(Settings.KEY_UPDATER_LAST_USED_UI, undefined);
const result = settings.getValue(Settings.KEY_UPDATER_LAST_USED_UI, undefined);
if(result === undefined) {
this.updateUsedVersion();
return this.getCurrentVersion();
}
return result;
}
updateUsedVersion() {