Skip to content

Commit d8a35aa

Browse files
Brendan Mulhollandrenovate[bot]afonsojramos
authored
chore: Replace remote for hiding window (#652)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Afonso Jorge Ramos <[email protected]>
1 parent ede8030 commit d8a35aa

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ menubarApp.on('ready', () => {
6767
});
6868

6969
ipcMain.on('reopen-window', () => menubarApp.showWindow());
70+
ipcMain.on('hide-window', () => menubarApp.hideWindow());
7071
ipcMain.on('app-quit', () => menubarApp.app.quit());
7172
ipcMain.on('update-icon', (_, arg) => {
7273
if (!menubarApp.tray.isDestroyed()) {

src/utils/auth.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { generateGitHubAPIUrl } from './helpers';
2-
3-
const { BrowserWindow } = require('@electron/remote');
1+
import { BrowserWindow } from '@electron/remote';
42

3+
import { generateGitHubAPIUrl } from './helpers';
54
import { apiRequest, apiRequestAuth } from '../utils/api-requests';
65
import { AuthResponse, AuthState, AuthTokenResponse } from '../types';
76
import { Constants } from '../utils/constants';

src/utils/comms.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
import { ipcRenderer, shell } from 'electron';
2+
import remote from '@electron/remote';
13
import {
24
updateTrayIcon,
35
openExternalLink,
46
setAutoLaunch,
57
restoreSetting,
68
} from './comms';
79

8-
const { ipcRenderer, shell } = require('electron');
9-
10-
const remote = require('@electron/remote');
11-
1210
describe('utils/comms.ts', () => {
1311
beforeEach(function () {
1412
jest.spyOn(ipcRenderer, 'send');

src/utils/comms.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const { ipcRenderer, shell } = require('electron');
2-
const remote = require('@electron/remote');
1+
import { ipcRenderer, shell } from 'electron';
2+
import remote from '@electron/remote';
33

44
export function openExternalLink(url: string): void {
55
shell.openExternal(url);

src/utils/notifications.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { ipcRenderer } from 'electron';
2-
const remote = require('@electron/remote');
3-
42
import { openInBrowser } from '../utils/helpers';
53
import { updateTrayIcon } from './comms';
64
import { Notification } from '../typesGithub';
@@ -84,7 +82,7 @@ export const raiseNativeNotification = (
8482

8583
nativeNotification.onclick = function () {
8684
if (notifications.length === 1) {
87-
remote.getCurrentWindow().hide();
85+
ipcRenderer.send('hide-window');
8886
openInBrowser(notifications[0], accounts);
8987
} else {
9088
ipcRenderer.send('reopen-window');

0 commit comments

Comments
 (0)