mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 05:23:17 +00:00
Untangle Sentry initialization.
Thanks to upstream for the helpful advice at https://github.com/getsentry/sentry-electron/issues/427. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import * as remoteMain from "@electron/remote/main";
|
||||
import windowStateKeeper from "electron-window-state";
|
||||
|
||||
import * as ConfigUtil from "../common/config-util";
|
||||
import {sentryInit} from "../common/sentry-util";
|
||||
import type {RendererMessage} from "../common/typed-ipc";
|
||||
import type {MenuProps} from "../common/types";
|
||||
|
||||
@@ -14,11 +13,15 @@ import {appUpdater} from "./autoupdater";
|
||||
import * as BadgeSettings from "./badge-settings";
|
||||
import * as AppMenu from "./menu";
|
||||
import {_getServerSettings, _isOnline, _saveServerIcon} from "./request";
|
||||
import {sentryInit} from "./sentry";
|
||||
import {setAutoLaunch} from "./startup";
|
||||
import {ipcMain, send} from "./typed-ipc-main";
|
||||
|
||||
const {GDK_BACKEND} = process.env;
|
||||
|
||||
// Initialize sentry for main process
|
||||
sentryInit();
|
||||
|
||||
let mainWindowState: windowStateKeeper.State;
|
||||
|
||||
// Prevent window being garbage collected
|
||||
@@ -199,12 +202,6 @@ function createMainWindow(): Electron.BrowserWindow {
|
||||
mainWindow.setMenuBarVisibility(!shouldHideMenu);
|
||||
}
|
||||
|
||||
// Initialize sentry for main process
|
||||
const errorReporting = ConfigUtil.getConfigItem("errorReporting", true);
|
||||
if (errorReporting) {
|
||||
sentryInit();
|
||||
}
|
||||
|
||||
const page = mainWindow.webContents;
|
||||
|
||||
page.on("dom-ready", () => {
|
||||
@@ -460,12 +457,6 @@ ${error}`,
|
||||
},
|
||||
);
|
||||
|
||||
// Using event.sender.send instead of page.send here to
|
||||
// make sure the value of errorReporting is sent only once on load.
|
||||
ipcMain.on("error-reporting", (event: Electron.IpcMainEvent) => {
|
||||
send(event.sender, "error-reporting-val", errorReporting);
|
||||
});
|
||||
|
||||
ipcMain.on(
|
||||
"save-last-tab",
|
||||
(_event: Electron.IpcMainEvent, index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user