Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace remote for hiding window #652

Merged
merged 11 commits into from
Oct 10, 2023
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ menubarApp.on('ready', () => {
});

ipcMain.on('reopen-window', () => menubarApp.showWindow());
ipcMain.on('hide-window', () => menubarApp.hideWindow());
ipcMain.on('app-quit', () => menubarApp.app.quit());
ipcMain.on('update-icon', (_, arg) => {
if (!menubarApp.tray.isDestroyed()) {
Expand Down
5 changes: 2 additions & 3 deletions src/utils/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { generateGitHubAPIUrl } from './helpers';

const { BrowserWindow } = require('@electron/remote');
import { BrowserWindow } from '@electron/remote';

import { generateGitHubAPIUrl } from './helpers';
import { apiRequest, apiRequestAuth } from '../utils/api-requests';
import { AuthResponse, AuthState, AuthTokenResponse } from '../types';
import { Constants } from '../utils/constants';
Expand Down
6 changes: 2 additions & 4 deletions src/utils/comms.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { ipcRenderer, shell } from 'electron';
import remote from '@electron/remote';
import {
updateTrayIcon,
openExternalLink,
setAutoLaunch,
restoreSetting,
} from './comms';

const { ipcRenderer, shell } = require('electron');

const remote = require('@electron/remote');

describe('utils/comms.ts', () => {
beforeEach(function () {
jest.spyOn(ipcRenderer, 'send');
Expand Down
4 changes: 2 additions & 2 deletions src/utils/comms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ipcRenderer, shell } = require('electron');
const remote = require('@electron/remote');
import { ipcRenderer, shell } from 'electron';
import remote from '@electron/remote';

export function openExternalLink(url: string): void {
shell.openExternal(url);
Expand Down
4 changes: 1 addition & 3 deletions src/utils/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ipcRenderer } from 'electron';
const remote = require('@electron/remote');

import { openInBrowser } from '../utils/helpers';
import { updateTrayIcon } from './comms';
import { Notification } from '../typesGithub';
Expand Down Expand Up @@ -84,7 +82,7 @@ export const raiseNativeNotification = (

nativeNotification.onclick = function () {
if (notifications.length === 1) {
remote.getCurrentWindow().hide();
ipcRenderer.send('hide-window');
openInBrowser(notifications[0], accounts);
} else {
ipcRenderer.send('reopen-window');
Expand Down