From cc2a1d65d5e4170177cd70f638ad4558798f928b Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Tue, 24 May 2022 23:23:44 +0200 Subject: [PATCH] Remove more Cider Update stuff --- src/main/base/browserwindow.ts | 10 ----- src/main/base/store.ts | 1 - src/main/base/utils.ts | 68 ---------------------------------- 3 files changed, 79 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 30607ae0..5df0fe99 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -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) => { if (process.platform != 'darwin') return; diff --git a/src/main/base/store.ts b/src/main/base/store.ts index 69208a4e..97635911 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -23,7 +23,6 @@ export class Store { }, "language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future "playbackNotifications": true, - "update_branch": "main", "resumeOnStartupBehavior": "local", "privateEnabled": false, "themeUpdateNotification": true, diff --git a/src/main/base/utils.ts b/src/main/base/utils.ts index e010cfe0..538c95d9 100644 --- a/src/main/base/utils.ts +++ b/src/main/base/utils.ts @@ -145,72 +145,4 @@ export class utils { bw.win.webContents.executeJavaScript("MusicKitInterop.previous()") } } - - /** - * Checks the application for updates - */ - static async checkForUpdate(): Promise { - 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() - } - - }