diff --git a/app/main/index.ts b/app/main/index.ts index 40a3b405d..e04c59936 100644 --- a/app/main/index.ts +++ b/app/main/index.ts @@ -1,4 +1,4 @@ -import {clipboard, shell} from "electron/common"; +import {clipboard} from "electron/common"; import { BrowserWindow, type IpcMainEvent, @@ -157,8 +157,6 @@ function createMainWindow(): BrowserWindow { } await app.whenReady(); - // Register custom protocol handler - app.setAsDefaultProtocolClient("zulip"); if (process.env.GDK_BACKEND !== GDK_BACKEND) { console.warn( @@ -176,7 +174,7 @@ function createMainWindow(): BrowserWindow { remoteMain.initialize(); - app.on("second-instance", (event, commandLine) => { + app.on("second-instance", () => { if (mainWindow) { if (mainWindow.isMinimized()) { mainWindow.restore(); @@ -184,12 +182,6 @@ function createMainWindow(): BrowserWindow { mainWindow.show(); } - // Handle deep link when opened from protocol - - const url = commandLine.find((argument) => argument.startsWith("zulip://")); - if (url) { - mainWindow.webContents.send("open-url", url); - } }); ipcMain.on( @@ -204,24 +196,6 @@ function createMainWindow(): BrowserWindow { app.on("activate", () => { mainWindow.show(); }); - // Handle deep linking when app is already running (macOS) - app.on("open-url", async (event, url) => { - event.preventDefault(); - - const response = await dialog.showMessageBox({ - type: "question", - buttons: ["Open in App", "Open in Browser"], - defaultId: 0, - message: `Do you want to open this link in the desktop app or browser?`, - detail: url, - }); - - if (response.response === 0) { - mainWindow.webContents.send("open-url", url); - } else { - await shell.openExternal(url); // Open in browser - } - }); app.on("web-contents-created", (_event, contents: WebContents) => { contents.setWindowOpenHandler((details) => {