electron config is modified
This commit is contained in:
parent
ae413a3843
commit
cf45005574
|
@ -12,19 +12,19 @@
|
||||||
},
|
},
|
||||||
"mac": {
|
"mac": {
|
||||||
"target": ["default"],
|
"target": ["default"],
|
||||||
"icon": "./resources/installer/woori.icns"
|
"icon": "./dist/ucap-webmessenger-electron/resources/installer/woori.icns"
|
||||||
},
|
},
|
||||||
"dmg": {
|
"dmg": {
|
||||||
"title": "UCapMessenger",
|
"title": "UCapMessenger",
|
||||||
"icon": "./resources/installer/woori.icns"
|
"icon": "./dist/ucap-webmessenger-electron/resources/installer/woori.icns"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": ["zip", "nsis"],
|
"target": ["zip", "nsis"],
|
||||||
"icon": "./resources/installer/woori_256x256.ico"
|
"icon": "./dist/ucap-webmessenger-electron/resources/installer/woori_256x256.ico"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": ["AppImage", "deb", "rpm", "zip", "tar.gz"],
|
"target": ["AppImage", "deb", "rpm", "zip", "tar.gz"],
|
||||||
"icon": "./resources/linuxicon"
|
"icon": "./dist/ucap-webmessenger-electron/resources/linuxicon"
|
||||||
},
|
},
|
||||||
"nsis": {
|
"nsis": {
|
||||||
"oneClick": false,
|
"oneClick": false,
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
"differentialPackage": true
|
"differentialPackage": true
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"buildResources": "./resources/installer/",
|
"buildResources": "./dist/ucap-webmessenger-electron/resources/installer/",
|
||||||
"output": "./dist/electron/",
|
"output": "./dist/electron/",
|
||||||
"app": "."
|
"app": "."
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ export class AppWindow {
|
||||||
private minWidth = 960;
|
private minWidth = 960;
|
||||||
private minHeight = 660;
|
private minHeight = 660;
|
||||||
|
|
||||||
public constructor() {
|
public constructor(private appIconPath: string) {
|
||||||
const savedWindowState = windowStateKeeper({
|
const savedWindowState = windowStateKeeper({
|
||||||
defaultWidth: this.minWidth,
|
defaultWidth: this.minWidth,
|
||||||
defaultHeight: this.minHeight
|
defaultHeight: this.minHeight
|
||||||
|
@ -52,7 +52,7 @@ export class AppWindow {
|
||||||
nodeIntegration: true
|
nodeIntegration: true
|
||||||
},
|
},
|
||||||
acceptFirstMouse: true,
|
acceptFirstMouse: true,
|
||||||
icon: path.join(__dirname, 'resources/image', 'ico_64_64.png')
|
icon: this.appIconPath
|
||||||
};
|
};
|
||||||
|
|
||||||
if (__DARWIN__) {
|
if (__DARWIN__) {
|
||||||
|
@ -60,7 +60,6 @@ export class AppWindow {
|
||||||
} else if (__WIN32__) {
|
} else if (__WIN32__) {
|
||||||
windowOptions.frame = false;
|
windowOptions.frame = false;
|
||||||
} else if (__LINUX__) {
|
} else if (__LINUX__) {
|
||||||
windowOptions.icon = path.join(__dirname, 'static', 'icon-logo.png');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.window = new BrowserWindow(windowOptions);
|
this.window = new BrowserWindow(windowOptions);
|
||||||
|
@ -81,6 +80,8 @@ export class AppWindow {
|
||||||
// renderer.
|
// renderer.
|
||||||
if (__DARWIN__) {
|
if (__DARWIN__) {
|
||||||
this.window.on(ElectronBrowserWindowChannel.Close, e => {
|
this.window.on(ElectronBrowserWindowChannel.Close, e => {
|
||||||
|
this.window.hide();
|
||||||
|
|
||||||
if (!quitting) {
|
if (!quitting) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
@ -200,6 +201,10 @@ export class AppWindow {
|
||||||
this.window.show();
|
this.window.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hide() {
|
||||||
|
this.window.hide();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time (in milliseconds) spent loading the page.
|
* Get the time (in milliseconds) spent loading the page.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
import { app, ipcMain, IpcMainEvent, remote } from 'electron';
|
import {
|
||||||
|
app,
|
||||||
|
ipcMain,
|
||||||
|
IpcMainEvent,
|
||||||
|
remote,
|
||||||
|
Tray,
|
||||||
|
Menu,
|
||||||
|
dialog
|
||||||
|
} from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
import * as fse from 'fs-extra';
|
import * as fse from 'fs-extra';
|
||||||
|
@ -13,7 +21,7 @@ import {
|
||||||
FileChannel,
|
FileChannel,
|
||||||
IdleStateChannel,
|
IdleStateChannel,
|
||||||
NotificationChannel,
|
NotificationChannel,
|
||||||
ChatChannel,
|
ChatChannel
|
||||||
} from '@ucap-webmessenger/native-electron';
|
} from '@ucap-webmessenger/native-electron';
|
||||||
import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification';
|
import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification';
|
||||||
|
|
||||||
|
@ -25,7 +33,12 @@ import { IdleChecker } from './lib/idle-checker';
|
||||||
import { NotificationRequest } from '@ucap-webmessenger/native';
|
import { NotificationRequest } from '@ucap-webmessenger/native';
|
||||||
import { ElectronAppChannel } from '@ucap-webmessenger/electron-core';
|
import { ElectronAppChannel } from '@ucap-webmessenger/electron-core';
|
||||||
|
|
||||||
|
const appIconPath = __LINUX__
|
||||||
|
? path.join(__dirname, 'static', 'icon-logo.png')
|
||||||
|
: path.join(__dirname, 'resources/image', 'ico_64_64.png');
|
||||||
|
|
||||||
let appWindow: AppWindow | null = null;
|
let appWindow: AppWindow | null = null;
|
||||||
|
let appTray: Tray | null = null;
|
||||||
|
|
||||||
const launchTime = now();
|
const launchTime = now();
|
||||||
let readyTime: number | null = null;
|
let readyTime: number | null = null;
|
||||||
|
@ -91,7 +104,7 @@ if (isDuplicateInstance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
const window = new AppWindow();
|
const window = new AppWindow(appIconPath);
|
||||||
|
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
// const {
|
// const {
|
||||||
|
@ -106,7 +119,7 @@ function createWindow() {
|
||||||
import('electron-devtools-installer').then(edi => {
|
import('electron-devtools-installer').then(edi => {
|
||||||
const ChromeLens = {
|
const ChromeLens = {
|
||||||
id: 'idikgljglpfilbhaboonnpnnincjhjkd',
|
id: 'idikgljglpfilbhaboonnpnnincjhjkd',
|
||||||
electron: '>=1.2.1',
|
electron: '>=1.2.1'
|
||||||
};
|
};
|
||||||
|
|
||||||
const extensions = [edi.REDUX_DEVTOOLS, ChromeLens];
|
const extensions = [edi.REDUX_DEVTOOLS, ChromeLens];
|
||||||
|
@ -155,6 +168,51 @@ app.on(ElectronAppChannel.Ready, () => {
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
||||||
|
appTray = new Tray(appIconPath);
|
||||||
|
|
||||||
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: '로그아웃',
|
||||||
|
// accelerator: 'Q',
|
||||||
|
// selector: 'terminate:',
|
||||||
|
click: () => {
|
||||||
|
// 로그아웃 후 로그인화면.
|
||||||
|
const options = {
|
||||||
|
type: 'question',
|
||||||
|
buttons: ['취소', '로그아웃'],
|
||||||
|
defaultId: 2,
|
||||||
|
title: 'Question',
|
||||||
|
message: '로그아웃',
|
||||||
|
detail: '로그아웃 하시겠습니까?'
|
||||||
|
// checkboxLabel: 'Remember my answer',
|
||||||
|
// checkboxChecked: true,
|
||||||
|
};
|
||||||
|
const choice = dialog.showMessageBoxSync(null, options);
|
||||||
|
if (1 === choice) {
|
||||||
|
// logout
|
||||||
|
appWindow.browserWindow.webContents.send(ChatChannel.OpenRoom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label: '버전', submenu: [{ label: 'Ver. ' + app.getVersion() }] },
|
||||||
|
{
|
||||||
|
label: '종료',
|
||||||
|
// accelerator: 'Q',
|
||||||
|
// selector: 'terminate:',
|
||||||
|
click: () => {
|
||||||
|
// 메신저에 로그아웃 후 종료
|
||||||
|
appWindow = null;
|
||||||
|
app.exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
appTray.setToolTip('WooriTalk');
|
||||||
|
appTray.setContextMenu(contextMenu);
|
||||||
|
|
||||||
|
appTray.on('click', () => {
|
||||||
|
appWindow.isVisible() ? appWindow.hide() : appWindow.show();
|
||||||
|
});
|
||||||
|
|
||||||
notificationService = new ElectronNotificationService({
|
notificationService = new ElectronNotificationService({
|
||||||
width: 340,
|
width: 340,
|
||||||
height: 100,
|
height: 100,
|
||||||
|
@ -166,7 +224,7 @@ app.on(ElectronAppChannel.Ready, () => {
|
||||||
defaultStyleAppIcon: { display: 'none' },
|
defaultStyleAppIcon: { display: 'none' },
|
||||||
defaultStyleImage: {},
|
defaultStyleImage: {},
|
||||||
defaultStyleClose: {},
|
defaultStyleClose: {},
|
||||||
defaultStyleText: {},
|
defaultStyleText: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationService.options.defaultWindow.webPreferences.preload = path.join(
|
notificationService.options.defaultWindow.webPreferences.preload = path.join(
|
||||||
|
@ -298,7 +356,7 @@ ipcMain.on(
|
||||||
);
|
);
|
||||||
appWindow.show();
|
appWindow.show();
|
||||||
e.close();
|
e.close();
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
"build:main:development": "cross-env NODE_ENV=development TS_NODE_PROJECT='./config/tsconfig.webpack.json' parallel-webpack --config=config/main.webpack.config.ts",
|
"build:main:development": "cross-env NODE_ENV=development TS_NODE_PROJECT='./config/tsconfig.webpack.json' parallel-webpack --config=config/main.webpack.config.ts",
|
||||||
"build:main:production": "cross-env NODE_ENV=production TS_NODE_PROJECT='./config/tsconfig.webpack.json' NODE_OPTIONS='--max_old_space_size=4096' parallel-webpack --config=config/main.webpack.config.ts",
|
"build:main:production": "cross-env NODE_ENV=production TS_NODE_PROJECT='./config/tsconfig.webpack.json' NODE_OPTIONS='--max_old_space_size=4096' parallel-webpack --config=config/main.webpack.config.ts",
|
||||||
"electron:windows": "electron-builder build --windows",
|
"electron:windows": "electron-builder build --windows",
|
||||||
|
"electron:mac": "electron-builder build --mac",
|
||||||
|
"electron:linux": "electron-builder build --linux",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e"
|
"e2e": "ng e2e"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user