Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Commit 72212f3

Browse files
test137E29BBarbosicks
authored andcommitted
Add Download percentage and installing text
1 parent 9d3ec7a commit 72212f3

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

source/assets/js/backend.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,20 +979,21 @@ $("#preset-name").on("input", function () {
979979

980980
$(document).ready(function () {
981981
ipcRenderer.on("check-for-updates-response-none", function() {
982-
console.log("renderer on check none");
983982
$("#button-check-for-updates").text("No Updates!");
984983
setTimeout(function() {
985984
$("#button-check-for-updates").text("Update!");
986985
}, 2000);
987986
});
988987

989-
ipcRenderer.on("check-for-updates-response-updating", function() {
990-
console.log("renderer on check updating");
991-
$("#button-check-for-updates").text("Updating...");
988+
ipcRenderer.on("check-for-updates-response-download", function(event, downloadPercentage) {
989+
$("#button-check-for-updates").text(`${downloadPercentage} downloaded`);
990+
});
991+
992+
ipcRenderer.on("check-for-updates-response-downloaded", function() {
993+
$("#button-check-for-updates").text(`Installing...`);
992994
});
993995

994996
ipcRenderer.on("check-for-updates-response-checking", function() {
995-
console.log("renderer on check search");
996997
$("#button-check-for-updates").text("Searching...");
997998
});
998999

source/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ autoUpdater.on("checking-for-update", function (_arg1) {
1818
return log.info("Checking for update...");
1919
});
2020
autoUpdater.on("update-available", function (_arg2) {
21-
mainWindow.webContents.send("check-for-updates-response-updating");
21+
mainWindow.webContents.send("check-for-updates-response-download", "0%");
2222
return log.info("Update available.");
2323
});
2424
autoUpdater.on("update-not-available", function (_arg3) {
@@ -29,11 +29,11 @@ autoUpdater.on("error", function (err) {
2929
return log.info("Error in auto-updater. " + err);
3030
});
3131
autoUpdater.on("download-progress", function (progressObj) {
32-
mainWindow.webContents.send("check-for-updates-response-updating");
32+
mainWindow.webContents.send("check-for-updates-response-download", `${progressObj.percent.toFixed(0)}%`);
3333
return log.info("Downloading update.");
3434
});
3535
autoUpdater.on("update-downloaded", function (_arg4) {
36-
mainWindow.webContents.send("check-for-updates-response-updating");
36+
mainWindow.webContents.send("check-for-updates-response-downloaded");
3737
autoUpdater.quitAndInstall();
3838
return log.info("Update downloaded.");
3939
});

0 commit comments

Comments
 (0)