feat(auto-update): improve auto-update toggle functionality (#5215)

* feat(auto-update): improve auto-update toggle functionality

- Added setAutoUpdate method in AppUpdater to control auto-update behavior.
- Updated IPC handler to set auto-update status based on user preference.
- Modified AboutSettings component to conditionally display update options based on auto-check setting.

* update autoupdate position
This commit is contained in:
beyondkmp 2025-04-23 16:13:55 +08:00 committed by GitHub
parent 4fe99cddce
commit 7fb6eb1949
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View File

@ -104,6 +104,7 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
// auto update
ipcMain.handle(IpcChannel.App_SetAutoUpdate, (_, isActive: boolean) => {
appUpdater.setAutoUpdate(isActive)
configManager.setAutoUpdate(isActive)
})

View File

@ -55,6 +55,11 @@ export default class AppUpdater {
this.autoUpdater = autoUpdater
}
public setAutoUpdate(isActive: boolean) {
autoUpdater.autoDownload = isActive
autoUpdater.autoInstallOnAppQuit = isActive
}
public async showUpdateDialog(mainWindow: BrowserWindow) {
if (!this.releaseInfo) {
return

View File

@ -168,7 +168,7 @@ const AboutSettings: FC = () => {
</>
)}
</SettingGroup>
{hasNewVersion && update.info && (
{autoCheckUpdate && hasNewVersion && update.info && (
<SettingGroup theme={theme}>
<SettingRow>
<SettingRowTitle>