Commit abfb9863 authored by Tasso Evangelista's avatar Tasso Evangelista

Move about window code to background process

parent fc152300
......@@ -3,7 +3,7 @@ import querystring from 'querystring';
import url from 'url';
import jetpack from 'fs-jetpack';
import idle from '@paulcbetts/system-idle-time';
import { app, ipcMain, Menu } from 'electron';
import { app, ipcMain, BrowserWindow, Menu } from 'electron';
import autoUpdate from './background/autoUpdate';
import certificate from './background/certificate';
......@@ -108,3 +108,22 @@ app.on('window-all-closed', () => {
ipcMain.on('getSystemIdleTime', (event) => {
event.returnValue = idle.getIdleTime();
});
ipcMain.on('show-about-dialog', () => {
getMainWindow().then((mainWindow) => {
const win = new BrowserWindow({
title: i18n.__('About', app.getName()),
parent: mainWindow,
width: 310,
height: 240,
resizable: false,
maximizable: false,
minimizable: false,
center: true,
show: false,
});
win.setMenuBarVisibility(false);
win.loadURL(`file://${ __dirname }/public/about.html`);
win.once('ready-to-show', () => win.show());
});
});
import { remote } from 'electron';
import { remote, ipcRenderer } from 'electron';
import i18n from '../../i18n/index.js';
const APP_NAME = remote.app.getName();
const appName = remote.app.getName();
const isMac = process.platform === 'darwin';
const appTemplate = [
{
label: i18n.__('About', APP_NAME),
click() {
const win = new remote.BrowserWindow({
width: 310,
height: 240,
resizable: false,
show: false,
center: true,
maximizable: false,
minimizable: false,
title: 'About Rocket.Chat',
});
win.loadURL(`file://${ __dirname }/about.html`);
win.setMenuBarVisibility(false);
win.show();
},
label: i18n.__('About', appName),
click: () => ipcRenderer.send('show-about-dialog'),
},
{
type: 'separator',
id: 'about-sep',
},
{
label: i18n.__('Quit_App', APP_NAME),
label: i18n.__('Quit_App', appName),
accelerator: 'CommandOrControl+Q',
click() {
remote.app.quit();
},
click: () => remote.app.quit(),
},
];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment