Move open-url handling to first instance block

This commit is contained in:
Fedor Indutny 2023-12-11 22:03:07 +01:00 committed by GitHub
parent 21956ca27b
commit 5e30757d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -270,6 +270,14 @@ if (!process.mas) {
}
return true;
});
app.on('open-url', (event, incomingHref) => {
event.preventDefault();
const route = parseSignalRoute(incomingHref);
if (route != null) {
handleSignalRoute(route);
}
});
}
}
/* eslint-enable no-console */
@ -2244,18 +2252,6 @@ app.on(
app.setAsDefaultProtocolClient('sgnl');
app.setAsDefaultProtocolClient('signalcaptcha');
app.on('will-finish-launching', () => {
// open-url must be set from within will-finish-launching for macOS
// https://stackoverflow.com/a/43949291
app.on('open-url', (event, incomingHref) => {
event.preventDefault();
const route = parseSignalRoute(incomingHref);
if (route != null) {
handleSignalRoute(route);
}
});
});
ipc.on(
'set-badge',
(_event: Electron.Event, badge: number | 'marked-unread') => {