mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-01 20:43:33 +00:00
Avoid use of null when accessing electron.remote.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -7,24 +7,14 @@ import {JsonDB} from "node-json-db";
|
||||
import * as EnterpriseUtil from "./enterprise-util";
|
||||
import Logger from "./logger-util";
|
||||
|
||||
/* To make the util runnable in both main and renderer process */
|
||||
const {app, dialog} = process.type === "renderer" ? electron.remote : electron;
|
||||
|
||||
const logger = new Logger({
|
||||
file: "config-util.log",
|
||||
timestamp: true,
|
||||
});
|
||||
|
||||
let dialog: Electron.Dialog = null;
|
||||
let app: Electron.App = null;
|
||||
|
||||
/* To make the util runnable in both main and renderer process */
|
||||
if (process.type === "renderer") {
|
||||
const {remote} = electron;
|
||||
dialog = remote.dialog;
|
||||
app = remote.app;
|
||||
} else {
|
||||
dialog = electron.dialog;
|
||||
app = electron.app;
|
||||
}
|
||||
|
||||
let db: JsonDB;
|
||||
|
||||
reloadDB();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import electron from "electron";
|
||||
import fs from "fs";
|
||||
|
||||
const app = process.type === "renderer" ? electron.remote.app : electron.app;
|
||||
const {app} = process.type === "renderer" ? electron.remote : electron;
|
||||
|
||||
let setupCompleted = false;
|
||||
|
||||
const zulipDir = app.getPath("userData");
|
||||
|
||||
@@ -6,6 +6,8 @@ import os from "os";
|
||||
import {initSetUp} from "./default-util";
|
||||
import {sentryInit, captureException} from "./sentry-util";
|
||||
|
||||
const {app} = process.type === "renderer" ? electron.remote : electron;
|
||||
|
||||
interface LoggerOptions {
|
||||
timestamp?: true | (() => string);
|
||||
file?: string;
|
||||
@@ -15,11 +17,8 @@ interface LoggerOptions {
|
||||
|
||||
initSetUp();
|
||||
|
||||
let app: Electron.App = null;
|
||||
let reportErrors = true;
|
||||
if (process.type === "renderer") {
|
||||
app = electron.remote.app;
|
||||
|
||||
// Report Errors to Sentry only if it is enabled in settings
|
||||
// Gets the value of reportErrors from config-util for renderer process
|
||||
// For main process, sentryInit() is handled in index.js
|
||||
@@ -34,8 +33,6 @@ if (process.type === "renderer") {
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
app = electron.app;
|
||||
}
|
||||
|
||||
const logDir = `${app.getPath("userData")}/Logs`;
|
||||
|
||||
Reference in New Issue
Block a user