From 95eec1f3d63ef06f23117492dcd352463bd78419 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 27 Mar 2024 20:29:11 +0530 Subject: [PATCH] Remove brew special casing Brew Formulae support an `auto_updates true` flag which tells brew's auto update mechanism to stay out of the way. Ref: https://docs.brew.sh/FAQ#why-arent-some-apps-included-during-brew-upgrade Will need to open a PR to update our Formula though. https://github.com/Homebrew/homebrew-cask/blob/9241d331b69abd5af47332488ba1857075cb99fd/Casks/e/ente.rb#L9 --- desktop/src/main.ts | 5 +++-- desktop/src/main/init.ts | 16 +--------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/desktop/src/main.ts b/desktop/src/main.ts index 505d5f1cc..dc27c7435 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -19,7 +19,6 @@ import { handleDockIconHideOnAutoLaunch, handleDownloads, handleExternalLinks, - handleUpdates, logStartupBanner, setupMacWindowOnDockIconClick, setupMainMenu, @@ -27,6 +26,8 @@ import { } from "./main/init"; import { attachFSWatchIPCHandlers, attachIPCHandlers } from "./main/ipc"; import log, { initLogging } from "./main/log"; +import { isDev } from "./main/util"; +import { setupAutoUpdater } from "./services/appUpdater"; import { initWatcher } from "./services/chokidar"; let appIsQuitting = false; @@ -170,7 +171,7 @@ const main = () => { setupMainMenu(mainWindow); attachIPCHandlers(); attachFSWatchIPCHandlers(watcher); - await handleUpdates(mainWindow); + if (!isDev) setupAutoUpdater(mainWindow); handleDownloads(mainWindow); handleExternalLinks(mainWindow); addAllowOriginHeader(mainWindow); diff --git a/desktop/src/main/init.ts b/desktop/src/main/init.ts index df4363bac..270609bf7 100644 --- a/desktop/src/main/init.ts +++ b/desktop/src/main/init.ts @@ -9,7 +9,7 @@ import { getHideDockIconPreference } from "../services/userPreference"; import { isPlatform } from "../utils/common/platform"; import { buildContextMenu, buildMenuBar } from "../utils/menu"; import log from "./log"; -import { execAsync, isDev } from "./util"; +import { isDev } from "./util"; /** * Create an return the {@link BrowserWindow} that will form our app's UI. @@ -79,10 +79,6 @@ export const createWindow = async () => { }; export async function handleUpdates(mainWindow: BrowserWindow) { - const isInstalledViaBrew = await checkIfInstalledViaBrew(); - if (!isDev && !isInstalledViaBrew) { - setupAutoUpdater(mainWindow); - } } export const setupTrayItem = (mainWindow: BrowserWindow) => { @@ -170,16 +166,6 @@ export function logStartupBanner() { log.debug(() => ({ platform, osRelease, systemVersion })); } -async function checkIfInstalledViaBrew() { - if (process.platform != "darwin") return false; - try { - await execAsync("brew list --cask ente"); - return true; - } catch (e) { - return false; - } -} - function lowerCaseHeaders(responseHeaders: Record) { const headers: Record = {}; for (const key of Object.keys(responseHeaders)) {