diff --git a/src-electron/main-process/auto-updater.js b/src-electron/main-process/auto-updater.js deleted file mode 100644 index de97057..0000000 --- a/src-electron/main-process/auto-updater.js +++ /dev/null @@ -1,84 +0,0 @@ -import { dialog } from "electron" -import isDev from "electron-is-dev" -import { autoUpdater } from "electron-updater" -import ProgressBar from "electron-progressbar" - -let progressBar = null -let isUpdating = false -let downloadAndInstall = false - -function checkForUpdate (onQuitAndInstall) { - // Disable for development - if (isDev) { - return - } - - autoUpdater.logger = console - autoUpdater.autoDownload = false - - autoUpdater.on("error", (err) => { - if (isUpdating) { - dialog.showErrorBox("Update Error: ", err == null ? "unknown" : err.message) - isUpdating = false - console.error("Error in auto-updater.", err.message) - } - }) - - autoUpdater.on("update-available", info => { - console.log(`Update available: ${info.version}`) - - const message = `Update ${info.version} found. Do you want to download the update?` - const detail = `View the release notes at: https://github.com/Bigslimvdub/AeonLW/releases/tag/v${info.version}` - - dialog.showMessageBox({ - type: "info", - title: "Update available", - message, - detail, - buttons: ["Download and Install", "Download and Install Later", "No"], - defaultId: 0 - }, (buttonIndex) => { - // Download and install - if (buttonIndex === 0) { - downloadAndInstall = true - if (!progressBar) { - progressBar = new ProgressBar({ - indeterminate: false, - title: "Downloading...", - text: `Downloading wallet v${info.version}` - }) - } - } - - // Download - if (buttonIndex !== 2) { - isUpdating = true - autoUpdater.downloadUpdate() - } - }) - }) - - autoUpdater.on("download-progress", progress => { - progressBar.value = progress.percent - }) - - autoUpdater.on("update-downloaded", () => { - console.log("Update downloaded") - isUpdating = false - - if (progressBar) { - progressBar.setCompleted() - progressBar = null - } - - // If download and install was selected then quit and install - if (downloadAndInstall && onQuitAndInstall) { - onQuitAndInstall(autoUpdater) - downloadAndInstall = false - } - }) - - autoUpdater.checkForUpdates() -} - -export { checkForUpdate } diff --git a/src-electron/main-process/modules/backend.js b/src-electron/main-process/modules/backend.js index dd173c7..e5304e3 100755 --- a/src-electron/main-process/modules/backend.js +++ b/src-electron/main-process/modules/backend.js @@ -9,7 +9,7 @@ const fs = require("fs"); const path = require("path"); export class Backend { - constructor (mainWindow) { + constructor(mainWindow) { this.mainWindow = mainWindow this.daemon = null this.walletd = null @@ -22,7 +22,8 @@ export class Backend { } init(config) { - if (os.platform() === "win32") { + + if(os.platform() == "win32") { this.config_dir = "C:\\ProgramData\\Aeon"; //this.config_dir = path.join(os.homedir(), "Aeon"); } else { @@ -148,29 +149,15 @@ export class Backend { if(i == "appearance") return Object.keys(this.config_data[i]).map(j => { if(this.config_data[i][j] !== params[i][j]) - {config_changed = true} + config_changed = true }) }) case "save_config_init": Object.keys(params).map(key => { this.config_data[key] = Object.assign(this.config_data[key], params[key]) - }) - - const validated = Object.keys(this.defaults) - .filter(k => k in this.config_data) - .map(k => [k, this.validate_values(this.config_data[k], this.defaults[k])]) - .reduce((map, obj) => { - map[obj[0]] = obj[1] - return map - }, {}) - - // Validate deamon data - this.config_data = { - ...this.config_data, - ...validated - } - + }); fs.writeFile(this.config_file, JSON.stringify(this.config_data, null, 4), 'utf8', () => { + if(data.method == "save_config_init") { this.startup(); } else { @@ -326,20 +313,25 @@ export class Backend { } }); }).catch(error => { - this.daemon.killProcess() - this.send("show_notification", { type: "negative", message: error.message, timeout: 3000 }) + this.daemon.killProcess(); + this.send("show_notification", { + type: "negative", + message: error.message, + timeout: 2000 + }) this.send("set_app_data", { status: { code: -1 // Return to config screen } }); + return; }); }).catch(error => { if(this.config_data.daemon.type == "remote") { - this.send("show_notification", {type: "negative", message: "Remote daemon cannot be reached", timeout: 3000}) + this.send("show_notification", {type: "negative", message: "Remote daemon cannot be reached", timeout: 2000}) } else { - this.send("show_notification", {type: "negative", message: "Local daemon internal error", timeout: 3000}) + this.send("show_notification", {type: "negative", message: "Local daemon internal error", timeout: 2000}) } this.send("set_app_data", { status: { diff --git a/src-electron/main-process/modules/wallet-rpc.js b/src-electron/main-process/modules/wallet-rpc.js index 5ceb900..0f85247 100755 --- a/src-electron/main-process/modules/wallet-rpc.js +++ b/src-electron/main-process/modules/wallet-rpc.js @@ -1229,7 +1229,7 @@ export class WalletRPC { sendGateway(method, data) { // if wallet is closed, do not send any wallet data to gateway - // this is for the case that we close the wallet at the same + // this is for the case that we close the wallet at the same time // after another action has started, but before it has finished if(!this.wallet_state.open && method == "set_wallet_data") return