notification: Set the AppUserModelId from the main process.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-02-03 22:55:15 -08:00
parent a41a771923
commit 4b93298b58
3 changed files with 3 additions and 12 deletions

View File

@@ -142,6 +142,9 @@ function createMainWindow(): Electron.BrowserWindow {
} }
} }
// Used for notifications on Windows
app.setAppUserModelId("org.zulip.zulip-electron");
app.on("second-instance", () => { app.on("second-instance", () => {
if (mainWindow) { if (mainWindow) {
if (mainWindow.isMinimized()) { if (mainWindow.isMinimized()) {

View File

@@ -1,8 +1,5 @@
import {ipcRenderer} from "../typed-ipc-renderer"; import {ipcRenderer} from "../typed-ipc-renderer";
// Do not change this
export const appId = "org.zulip.zulip-electron";
// This function will focus the server that sent // This function will focus the server that sent
// the notification. Main function implemented in main.js // the notification. Main function implemented in main.js
export function focusCurrentServer(): void { export function focusCurrentServer(): void {

View File

@@ -1,13 +1,4 @@
import {remote} from "electron";
import DefaultNotification from "./default-notification"; import DefaultNotification from "./default-notification";
import {appId} from "./helpers";
const {app} = remote;
// From https://github.com/felixrieseberg/electron-windows-notifications#appusermodelid
// On windows 8 we have to explicitly set the appUserModelId otherwise notification won't work.
app.setAppUserModelId(appId);
export interface NotificationData { export interface NotificationData {
close: () => void; close: () => void;