improve update check indicator

This commit is contained in:
SrGooglo 2024-02-02 14:44:41 +01:00
parent e528a854bb
commit b772dd12f7
4 changed files with 33 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "rs-bundler", "name": "rs-bundler",
"version": "0.11.0", "version": "0.11.1",
"description": "RageStudio Bundler Utility GUI", "description": "RageStudio Bundler Utility GUI",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "RageStudio", "author": "RageStudio",

View File

@ -264,18 +264,21 @@ class ElectronApp {
if (!isDev) { if (!isDev) {
autoUpdater.on("update-available", (ev, info) => { autoUpdater.on("update-available", (ev, info) => {
console.log(info) console.log(info)
sendToRender("app:checking_update_downloading", info)
}) })
autoUpdater.on("error", (ev, err) => { autoUpdater.on("error", (ev, err) => {
console.error(err) console.error(err)
sendToRender("app:checking_update_error")
}) })
autoUpdater.on("update-downloaded", (ev, info) => { autoUpdater.on("update-downloaded", (ev, info) => {
console.log(info) console.log(info)
sendToRender("app:update_available", info) sendToRender("app:update_available", info)
}) })
sendToRender("app:checking_update")
await autoUpdater.checkForUpdates() await autoUpdater.checkForUpdates()
} }
} }

View File

@ -52,7 +52,9 @@ class App extends React.Component {
loading: true, loading: true,
pkg: null, pkg: null,
initializing: false, initializing: false,
updateAvailable: false, updateAvailable: false,
updateText: null,
authorizedServices: { authorizedServices: {
drive: false, drive: false,
@ -110,7 +112,22 @@ class App extends React.Component {
}) })
message.success("Google Drive API unauthorized") message.success("Google Drive API unauthorized")
} },
"app:checking_update_downloading": (event, data) => {
this.setState({
updateText: "Downloading update..."
})
},
"app:checking_update": (event, data) => {
this.setState({
updateText: "Checking for updates..."
})
},
"app:checking_update_error": (event, data) => {
this.setState({
updateText: null
})
},
} }
onUpdateAvailable = () => { onUpdateAvailable = () => {

View File

@ -24,6 +24,16 @@ const Header = (props) => {
/> />
} }
{
ctx.updateText && <antd.Button
size="small"
icon={<Icons.MdRefresh />}
disabled
>
{ctx.updateText}
</antd.Button>
}
{ {
ctx.updateAvailable && <antd.Button ctx.updateAvailable && <antd.Button
size="small" size="small"