Skip to content

Commit

Permalink
chore: Replace remote for hiding window (#652)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com>
  • Loading branch information
3 people committed Oct 10, 2023
1 parent ede8030 commit d8a35aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
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

0 comments on commit d8a35aa

Please sign in to comment.