-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Auto-update): Enables auto-updates for the Thorium Nova app.
- Loading branch information
1 parent
48b254a
commit 264ac55
Showing
7 changed files
with
231 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {autoUpdater} from "electron-updater"; | ||
import {BrowserWindow} from "electron"; | ||
|
||
let win: BrowserWindow | null = null; | ||
export function initWin(newWin: BrowserWindow) { | ||
win = newWin; | ||
} | ||
function sendStatusToWindow(text: string) { | ||
win?.webContents.send("update-message", text); | ||
} | ||
autoUpdater.on("checking-for-update", () => { | ||
sendStatusToWindow("Checking for update..."); | ||
}); | ||
autoUpdater.on("update-available", info => { | ||
sendStatusToWindow("Update available."); | ||
}); | ||
autoUpdater.on("update-not-available", info => { | ||
sendStatusToWindow(""); | ||
}); | ||
autoUpdater.on("error", err => { | ||
sendStatusToWindow("Error in auto-updater. " + err); | ||
}); | ||
autoUpdater.on("download-progress", progressObj => { | ||
let log_message = "Download speed: " + progressObj.bytesPerSecond; | ||
log_message = log_message + " - Downloaded " + progressObj.percent + "%"; | ||
log_message = | ||
log_message + | ||
" (" + | ||
progressObj.transferred + | ||
"/" + | ||
progressObj.total + | ||
")"; | ||
sendStatusToWindow(log_message); | ||
}); | ||
autoUpdater.on("update-downloaded", info => { | ||
sendStatusToWindow("Update downloaded - restart to apply"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.