mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 17:08:57 +01:00
Mac: Fix signal link handling when app is not open
This commit is contained in:
+17
-1
@@ -180,6 +180,8 @@ nativeThemeNotifier.initialize();
|
||||
|
||||
let appStartInitialSpellcheckSetting = true;
|
||||
|
||||
let macInitialOpenUrlRoute: ParsedSignalRoute | undefined;
|
||||
|
||||
const cliParser = createParser({
|
||||
allowUnknown: true,
|
||||
options: [
|
||||
@@ -282,10 +284,19 @@ if (!process.mas) {
|
||||
return true;
|
||||
});
|
||||
|
||||
// This event is received in macOS packaged builds.
|
||||
app.on('open-url', (event, incomingHref) => {
|
||||
event.preventDefault();
|
||||
const route = parseSignalRoute(incomingHref);
|
||||
|
||||
if (route != null) {
|
||||
// When the app isn't open and you click a signal link to open the app, then
|
||||
// this event will emit before mainWindow is ready. We save the value for later.
|
||||
if (mainWindow == null || !mainWindow.webContents) {
|
||||
macInitialOpenUrlRoute = route;
|
||||
return;
|
||||
}
|
||||
|
||||
handleSignalRoute(route);
|
||||
}
|
||||
});
|
||||
@@ -1084,12 +1095,17 @@ async function readyForUpdates() {
|
||||
|
||||
isReadyForUpdates = true;
|
||||
|
||||
// First, install requested sticker pack
|
||||
// First, handle requested signal URLs
|
||||
const incomingHref = maybeGetIncomingSignalRoute(process.argv);
|
||||
if (incomingHref) {
|
||||
handleSignalRoute(incomingHref);
|
||||
} else if (macInitialOpenUrlRoute) {
|
||||
handleSignalRoute(macInitialOpenUrlRoute);
|
||||
}
|
||||
|
||||
// Discard value even if we don't handle a saved URL.
|
||||
macInitialOpenUrlRoute = undefined;
|
||||
|
||||
// Second, start checking for app updates
|
||||
try {
|
||||
strictAssert(
|
||||
|
||||
Reference in New Issue
Block a user