Remove more Cider Update stuff
This commit is contained in:
parent
79019f2fb9
commit
cc2a1d65d5
3 changed files with 0 additions and 79 deletions
|
@ -1290,16 +1290,6 @@ export class BrowserWindow {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('check-for-update', async (_event) => {
|
|
||||||
await utils.checkForUpdate();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
ipcMain.on('disable-update', (event) => {
|
|
||||||
// Check if using app store builds so people don't get pissy wen button go bonk
|
|
||||||
event.returnValue = !(app.isPackaged && !process.mas || !process.windowsStore);
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
ipcMain.on('share-menu', async (_event, url) => {
|
ipcMain.on('share-menu', async (_event, url) => {
|
||||||
if (process.platform != 'darwin') return;
|
if (process.platform != 'darwin') return;
|
||||||
|
|
|
@ -23,7 +23,6 @@ export class Store {
|
||||||
},
|
},
|
||||||
"language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future
|
"language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future
|
||||||
"playbackNotifications": true,
|
"playbackNotifications": true,
|
||||||
"update_branch": "main",
|
|
||||||
"resumeOnStartupBehavior": "local",
|
"resumeOnStartupBehavior": "local",
|
||||||
"privateEnabled": false,
|
"privateEnabled": false,
|
||||||
"themeUpdateNotification": true,
|
"themeUpdateNotification": true,
|
||||||
|
|
|
@ -145,72 +145,4 @@ export class utils {
|
||||||
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
|
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the application for updates
|
|
||||||
*/
|
|
||||||
static async checkForUpdate(): Promise<void> {
|
|
||||||
if (!app.isPackaged) {
|
|
||||||
new Notification({ title: "Application Update", body: "Can't update as app is in DEV mode. Please build or grab a copy by clicking me"})
|
|
||||||
.on('click', () => {shell.openExternal('https://download.cider.sh/?utm_source=app&utm_medium=dev-mode-warning')})
|
|
||||||
.show()
|
|
||||||
bw.win.webContents.send('update-response', "update-error")
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const options: any = {
|
|
||||||
provider: 'github',
|
|
||||||
protocol: 'https',
|
|
||||||
owner: 'ciderapp',
|
|
||||||
repo: 'cider-releases',
|
|
||||||
allowDowngrade: true,
|
|
||||||
}
|
|
||||||
let autoUpdater: any = null
|
|
||||||
if (process.platform === 'win32') { //Windows
|
|
||||||
autoUpdater = await new NsisUpdater(options)
|
|
||||||
} else {
|
|
||||||
autoUpdater = await new AppImageUpdater(options) //Linux and Mac (AppImages work on macOS btw)
|
|
||||||
}
|
|
||||||
|
|
||||||
autoUpdater.on('checking-for-update', () => {
|
|
||||||
new Notification({ title: "Cider Update", body: "Cider is currently checking for updates."}).show()
|
|
||||||
})
|
|
||||||
|
|
||||||
autoUpdater.on('error', (error: any) => {
|
|
||||||
console.error(`[AutoUpdater] Error: ${error}`)
|
|
||||||
bw.win.webContents.send('update-response', "update-error")
|
|
||||||
})
|
|
||||||
|
|
||||||
autoUpdater.on('update-not-available', () => {
|
|
||||||
console.log('[AutoUpdater] Update not available.')
|
|
||||||
bw.win.webContents.send('update-response', "update-not-available");
|
|
||||||
})
|
|
||||||
autoUpdater.on('download-progress', (event: any, progress: any) => {
|
|
||||||
bw.win.setProgressBar(progress.percent / 100)
|
|
||||||
})
|
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', (info: any) => {
|
|
||||||
console.log('[AutoUpdater] Update downloaded.')
|
|
||||||
bw.win.webContents.send('update-response', "update-downloaded");
|
|
||||||
const dialogOpts = {
|
|
||||||
type: 'info',
|
|
||||||
buttons: ['Restart', 'Later'],
|
|
||||||
title: 'Application Update',
|
|
||||||
message: info,
|
|
||||||
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
|
||||||
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
|
||||||
})
|
|
||||||
new Notification({ title: "Application Update", body: info}).on('click', () => {
|
|
||||||
bw.win.show()
|
|
||||||
}).show()
|
|
||||||
})
|
|
||||||
|
|
||||||
log.transports.file.level = "debug"
|
|
||||||
autoUpdater.logger = log
|
|
||||||
await autoUpdater.checkForUpdatesAndNotify()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue