Code cleanup, update eslint from webapp, add ts-prune (#1884)

This commit is contained in:
Devin Binnie
2021-12-03 16:01:49 -05:00
committed by GitHub
parent 875a0f8bfd
commit 73056d2649
19 changed files with 383 additions and 336 deletions

View File

@@ -150,8 +150,6 @@ export function getMainWindow(ensureCreated?: boolean) {
return status.mainWindow;
}
export const on = status.mainWindow?.on;
function handleMaximizeMainWindow() {
sendToRenderer(MAXIMIZE_CHANGE, true);
}
@@ -204,15 +202,6 @@ export function sendToRenderer(channel: string, ...args: any[]) {
}
}
export function sendToAll(channel: string, ...args: any[]) {
sendToRenderer(channel, ...args);
if (status.settingsWindow) {
status.settingsWindow.webContents.send(channel, ...args);
}
// TODO: should we include popups?
}
export function sendToMattermostViews(channel: string, ...args: any[]) {
if (status.viewManager) {
status.viewManager.sendToAllViews(channel, ...args);
@@ -321,10 +310,6 @@ export async function setOverlayIcon(badgeText: string | undefined, description:
}
}
export function isMainWindow(window: BrowserWindow) {
return status.mainWindow && status.mainWindow === window;
}
export function handleDoubleClick(e: IpcMainEvent, windowType?: string) {
let action = 'Maximize';
if (process.platform === 'darwin') {
@@ -446,11 +431,6 @@ export function updateLoadingScreenDarkMode(darkMode: boolean) {
}
}
export function getViewNameByWebContentsId(webContentsId: number) {
const view = status.viewManager?.findViewByWebContent(webContentsId);
return view?.name;
}
export function getServerNameByWebContentsId(webContentsId: number) {
const view = status.viewManager?.findViewByWebContent(webContentsId);
return view?.tab.server.name;
@@ -497,7 +477,7 @@ export function sendToFind() {
}
}
export function handleHistory(event: IpcMainEvent, offset: number) {
function handleHistory(event: IpcMainEvent, offset: number) {
if (status.viewManager) {
const activeView = status.viewManager.getCurrentView();
if (activeView && activeView.view.webContents.canGoToOffset(offset)) {
@@ -606,7 +586,8 @@ function handleAppLoggedOut(event: IpcMainEvent, viewName: string) {
}
function handleGetViewName(event: IpcMainInvokeEvent) {
return getViewNameByWebContentsId(event.sender.id);
const view = status.viewManager?.findViewByWebContent(event.sender.id);
return view?.name;
}
function handleGetWebContentsId(event: IpcMainInvokeEvent) {
return event.sender.id;