Skip to content

Commit 6ebb9be

Browse files
committedFeb 22, 2025·
Removing some extra code #820
Remove some extra code and which is added on previous commit
1 parent 309efc2 commit 6ebb9be

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed
 

‎app/main/index.ts

+2-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {clipboard, shell} from "electron/common";
1+
import {clipboard} from "electron/common";
22
import {
33
BrowserWindow,
44
type IpcMainEvent,
@@ -157,8 +157,6 @@ function createMainWindow(): BrowserWindow {
157157
}
158158

159159
await app.whenReady();
160-
// Register custom protocol handler
161-
app.setAsDefaultProtocolClient("zulip");
162160

163161
if (process.env.GDK_BACKEND !== GDK_BACKEND) {
164162
console.warn(
@@ -176,20 +174,14 @@ function createMainWindow(): BrowserWindow {
176174

177175
remoteMain.initialize();
178176

179-
app.on("second-instance", (event, commandLine) => {
177+
app.on("second-instance", () => {
180178
if (mainWindow) {
181179
if (mainWindow.isMinimized()) {
182180
mainWindow.restore();
183181
}
184182

185183
mainWindow.show();
186184
}
187-
// Handle deep link when opened from protocol
188-
189-
const url = commandLine.find((argument) => argument.startsWith("zulip://"));
190-
if (url) {
191-
mainWindow.webContents.send("open-url", url);
192-
}
193185
});
194186

195187
ipcMain.on(
@@ -204,24 +196,6 @@ function createMainWindow(): BrowserWindow {
204196
app.on("activate", () => {
205197
mainWindow.show();
206198
});
207-
// Handle deep linking when app is already running (macOS)
208-
app.on("open-url", async (event, url) => {
209-
event.preventDefault();
210-
211-
const response = await dialog.showMessageBox({
212-
type: "question",
213-
buttons: ["Open in App", "Open in Browser"],
214-
defaultId: 0,
215-
message: `Do you want to open this link in the desktop app or browser?`,
216-
detail: url,
217-
});
218-
219-
if (response.response === 0) {
220-
mainWindow.webContents.send("open-url", url);
221-
} else {
222-
await shell.openExternal(url); // Open in browser
223-
}
224-
});
225199

226200
app.on("web-contents-created", (_event, contents: WebContents) => {
227201
contents.setWindowOpenHandler((details) => {

0 commit comments

Comments
 (0)