mirror of
https://github.com/element-hq/element-desktop.git
synced 2025-12-05 01:10:21 +00:00
@@ -218,3 +218,10 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
||||
});
|
||||
|
||||
ipcMain.handle("getConfig", () => global.vectorConfig);
|
||||
|
||||
const initialisePromiseWithResolvers = Promise.withResolvers<void>();
|
||||
export const initialisePromise = initialisePromiseWithResolvers.promise;
|
||||
|
||||
ipcMain.once("initialise", () => {
|
||||
initialisePromiseWithResolvers.resolve();
|
||||
});
|
||||
|
||||
@@ -60,6 +60,7 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
*/
|
||||
supportsBadgeOverlay: boolean;
|
||||
}> {
|
||||
ipcRenderer.emit("initialise");
|
||||
const [{ protocol, sessionId }, config, supportedSettings] = await Promise.all([
|
||||
ipcRenderer.invoke("getProtocol"),
|
||||
ipcRenderer.invoke("getConfig"),
|
||||
|
||||
@@ -11,6 +11,7 @@ import os from "node:os";
|
||||
|
||||
import { getSquirrelExecutable } from "./squirrelhooks.js";
|
||||
import { _t } from "./language-helper.js";
|
||||
import { initialisePromise } from "./ipc.js";
|
||||
|
||||
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
|
||||
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
|
||||
@@ -113,6 +114,12 @@ export async function start(updateBaseUrl: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if auto update is available on this platform.
|
||||
* Has a side effect of firing showToast on EOL platforms so must only be called once!
|
||||
* @param updateBaseUrl The base URL for updates
|
||||
* @returns True if auto update is available
|
||||
*/
|
||||
async function available(updateBaseUrl?: string): Promise<boolean> {
|
||||
if (process.platform === "linux") {
|
||||
// Auto update is not supported on Linux
|
||||
@@ -143,17 +150,21 @@ async function available(updateBaseUrl?: string): Promise<boolean> {
|
||||
if (major < 21) {
|
||||
// If the macOS version is too old for modern Electron support then disable auto update to prevent the app updating and bricking itself.
|
||||
// The oldest macOS version supported by Chromium/Electron 38 is Monterey (12.x) which started with Darwin 21.0
|
||||
ipcMain.emit("showToast", {
|
||||
title: _t("eol|title"),
|
||||
description: _t("eol|no_more_updates", { brand: global.trayConfig.brand }),
|
||||
initialisePromise.then(() => {
|
||||
ipcMain.emit("showToast", {
|
||||
title: _t("eol|title"),
|
||||
description: _t("eol|no_more_updates", { brand: global.trayConfig.brand }),
|
||||
});
|
||||
});
|
||||
return false;
|
||||
} else if (major < 22) {
|
||||
// If the macOS version is EOL then show a warning message.
|
||||
// The oldest macOS version still supported by Apple is Ventura (13.x) which started with Darwin 22.0
|
||||
ipcMain.emit("showToast", {
|
||||
title: _t("eol|title"),
|
||||
description: _t("eol|warning", { brand: global.trayConfig.brand }),
|
||||
initialisePromise.then(() => {
|
||||
ipcMain.emit("showToast", {
|
||||
title: _t("eol|title"),
|
||||
description: _t("eol|warning", { brand: global.trayConfig.brand }),
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"rootDir": "./src",
|
||||
"declaration": true,
|
||||
"typeRoots": ["src/@types", "node_modules/@types"],
|
||||
"lib": ["es2022"],
|
||||
"lib": ["es2022", "es2024.promise"],
|
||||
"types": ["node"],
|
||||
"strict": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user