package script of daesang real is modified

This commit is contained in:
병준 박 2019-12-18 15:57:02 +09:00
parent 76dd6883d3
commit 70e17b4a3d
11 changed files with 53 additions and 26 deletions

View File

@ -36,5 +36,22 @@
"buildResources": "./dist/ucap-webmessenger-electron/resources/installer/", "buildResources": "./dist/ucap-webmessenger-electron/resources/installer/",
"output": "./dist/electron/", "output": "./dist/electron/",
"app": "." "app": "."
} },
"files": [
"**/*",
"!**/*.ts",
"!LICENSE.md",
"!package.json",
"!package-lock.json",
"!electron-projects/",
"!projects/",
"!.prettierrc",
"!angular.json",
"!**/.awcache",
"!**/.vscode",
"!config/",
"!docker/",
"!tsconfig.json",
"!tslint.json"
]
} }

View File

@ -1,6 +1,9 @@
import path from 'path'; import path from 'path';
import url from 'url'; import url from 'url';
import fse from 'fs-extra'; import fse from 'fs-extra';
import log from 'electron-log';
import { ElectronWebContentsChannel } from '@ucap-webmessenger/electron-core';
import { AnimationQueue } from '../utils/animation-queue'; import { AnimationQueue } from '../utils/animation-queue';
import { import {
@ -11,7 +14,6 @@ import { screen, BrowserWindow, ipcMain, IpcMainEvent, shell } from 'electron';
import { ElectronNotification } from '../models/electron-notification'; import { ElectronNotification } from '../models/electron-notification';
import { ElectronNotificationEventType } from '../types/event.type'; import { ElectronNotificationEventType } from '../types/event.type';
import { Channel } from '../types/channel.type'; import { Channel } from '../types/channel.type';
import { ElectronWebContentsChannel } from '@ucap-webmessenger/electron-core';
const onClickElectronNotification = 'onClickElectronNotification'; const onClickElectronNotification = 'onClickElectronNotification';
const onCloseElectronNotification = 'onCloseElectronNotification'; const onCloseElectronNotification = 'onCloseElectronNotification';
@ -220,12 +222,12 @@ export class ElectronNotificationService {
slashes: true slashes: true
}); });
} catch (e) { } catch (e) {
console.log( log.error(
'electron-notify: Could not find template ("' + 'electron-notify: Could not find template ("' +
this.customOptions.templatePath + this.customOptions.templatePath +
'").' '").'
); );
console.log( log.error(
'electron-notify: To use a different template you need to correct the config.templatePath or simply adapt config.htmlTemplate' 'electron-notify: To use a different template you need to correct the config.templatePath or simply adapt config.htmlTemplate'
); );
} }

View File

@ -1,3 +1,5 @@
import log from 'electron-log';
export interface AnimationQueueObject { export interface AnimationQueueObject {
context: any; context: any;
func: (...args: any[]) => Promise<any>; func: (...args: any[]) => Promise<any>;
@ -29,10 +31,10 @@ export class AnimationQueue {
} }
}) })
.catch(reason => { .catch(reason => {
console.log(reason); log.error(reason);
}); });
} catch (e) { } catch (e) {
console.log(e); log.error(e);
} }
} }

View File

@ -1,6 +1,7 @@
import { BrowserWindow, ipcMain } from 'electron'; import { BrowserWindow, ipcMain } from 'electron';
import url from 'url'; import url from 'url';
import fse from 'fs-extra'; import fse from 'fs-extra';
import log from 'electron-log';
import { import {
ElectronUpdateWindowOptions, ElectronUpdateWindowOptions,
DefaultElectronUpdateWindowOptions DefaultElectronUpdateWindowOptions
@ -112,7 +113,7 @@ export class ElectronUpdateWindowService {
slashes: true slashes: true
}); });
} catch (e) { } catch (e) {
console.log( log.error(
'electron-update-window: Could not find template ("' + 'electron-update-window: Could not find template ("' +
this.customOptions.templatePath + this.customOptions.templatePath +
'").' '").'

View File

@ -145,7 +145,7 @@ function createWindow() {
try { try {
edi.default(extension); edi.default(extension);
} catch (e) { } catch (e) {
console.log(e); log.error(e);
} }
} }
}); });
@ -357,7 +357,7 @@ ipcMain.on(
.enable() .enable()
.then(() => { .then(() => {
event.returnValue = true; event.returnValue = true;
console.log('AutoLaunch is enabled'); log.info('AutoLaunch is enabled');
}) })
.catch(reason => { .catch(reason => {
event.returnValue = false; event.returnValue = false;
@ -367,7 +367,7 @@ ipcMain.on(
.disable() .disable()
.then(() => { .then(() => {
event.returnValue = true; event.returnValue = true;
console.log('AutoLaunch is disabled'); log.info('AutoLaunch is disabled');
}) })
.catch(reason => { .catch(reason => {
event.returnValue = false; event.returnValue = false;
@ -409,15 +409,18 @@ ipcMain.on(
); );
ipcMain.on(FileChannel.ReadFile, (event: IpcMainEvent, ...args: any[]) => { ipcMain.on(FileChannel.ReadFile, (event: IpcMainEvent, ...args: any[]) => {
const filePath = root(args[0]);
try { try {
fse.readFile(root(args[0]), (err, data) => { fse.readFile(filePath, (err, data) => {
if (!!err) { if (!!err) {
event.returnValue = err; event.returnValue = err;
log.error(`File read failed path[${filePath}] err:`, err);
} else { } else {
event.returnValue = data; event.returnValue = data;
} }
}); });
} catch (error) { } catch (error) {
log.error(`File read failed path[${filePath}] err:`, error);
event.returnValue = null; event.returnValue = null;
} }
}); });
@ -539,7 +542,6 @@ ipcMain.on(
NotificationChannel.CloseAllNotify, NotificationChannel.CloseAllNotify,
(event: IpcMainEvent, ...args: any[]) => { (event: IpcMainEvent, ...args: any[]) => {
appWindow.browserWindow.flashFrame(false); appWindow.browserWindow.flashFrame(false);
console.log('Channel.closeAllNotify', args);
} }
); );

View File

@ -12,6 +12,7 @@ import zlib from 'zlib';
import { BrowserWindow, app } from 'electron'; import { BrowserWindow, app } from 'electron';
import { UpdaterChannel } from '@ucap-webmessenger/native-electron'; import { UpdaterChannel } from '@ucap-webmessenger/native-electron';
import { startWith } from 'rxjs/operators'; import { startWith } from 'rxjs/operators';
import log from 'electron-log';
export class RendererUpdater { export class RendererUpdater {
private checkSubscription: Subscription | undefined; private checkSubscription: Subscription | undefined;
@ -35,7 +36,7 @@ export class RendererUpdater {
startCheck() { startCheck() {
if (!semver.valid(this.config.currentVersion)) { if (!semver.valid(this.config.currentVersion)) {
console.log( log.error(
`RendererUpdater::error currentVersion[${this.config.currentVersion}] is not valid` `RendererUpdater::error currentVersion[${this.config.currentVersion}] is not valid`
); );
return; return;
@ -49,7 +50,7 @@ export class RendererUpdater {
.then(res => { .then(res => {
const appVersion = res.data.appVersion; const appVersion = res.data.appVersion;
if (!semver.valid(appVersion)) { if (!semver.valid(appVersion)) {
console.log( log.error(
`RendererUpdater::error appVersion[${appVersion}] is not valid` `RendererUpdater::error appVersion[${appVersion}] is not valid`
); );
return; return;
@ -60,7 +61,7 @@ export class RendererUpdater {
} }
}) })
.catch(reason => { .catch(reason => {
console.log('RendererUpdater', reason); log.error('RendererUpdater', reason);
}); });
}); });
} }
@ -83,14 +84,14 @@ export class RendererUpdater {
try { try {
fse.unlinkSync(this.appPath.slice(0, -1)); fse.unlinkSync(this.appPath.slice(0, -1));
} catch (error) { } catch (error) {
console.log('RendererUpdater::apply', error); log.error('RendererUpdater::apply', error);
return; return;
} }
try { try {
fse.renameSync(this.unzipPath, this.appPath.slice(0, -1)); fse.renameSync(this.unzipPath, this.appPath.slice(0, -1));
} catch (error) { } catch (error) {
console.log('RendererUpdater::apply', error); log.error('RendererUpdater::apply', error);
return; return;
} }
@ -104,7 +105,7 @@ export class RendererUpdater {
.then(res => { .then(res => {
fse.writeFile(this.downloadPath, res.data, err => { fse.writeFile(this.downloadPath, res.data, err => {
if (!!err) { if (!!err) {
console.log('RendererUpdater::download failed', err); log.error('RendererUpdater::download failed', err);
return; return;
} }
const updateInfo: UpdateInfo = { const updateInfo: UpdateInfo = {
@ -116,7 +117,7 @@ export class RendererUpdater {
}); });
}) })
.catch(reason => { .catch(reason => {
console.log('RendererUpdater::download failed', reason); log.error('RendererUpdater::download failed', reason);
}); });
} }
} }

View File

@ -3,7 +3,7 @@ import * as path from 'path';
// tslint:disable-next-line: variable-name // tslint:disable-next-line: variable-name
const _root = __DEV__ const _root = __DEV__
? path.resolve(__dirname, '..', '..') ? path.resolve(__dirname, '..', '..')
: path.resolve(__dirname); : path.resolve(__dirname, '..', '..');
export function root(...paths: string[]) { export function root(...paths: string[]) {
const args = Array.prototype.slice.call(paths, 0); const args = Array.prototype.slice.call(paths, 0);

View File

@ -17,7 +17,7 @@
"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",
"build:daesang": "npm-run-all -p build:daesang:renderer build:daesang:main:production", "build:daesang": "npm-run-all -p build:daesang:renderer build:daesang:main:production",
"build:daesang:renderer": "cross-env NODE_ENV=production ng build -c renderer-daesang-development --base-href ./", "build:daesang:renderer": "cross-env NODE_ENV=production ng build -c renderer-daesang-production --base-href ./",
"build:daesang:main:development": "cross-env NODE_ENV=development TS_NODE_PROJECT='./config/tsconfig.webpack.json' parallel-webpack --config=config/main.webpack.config.ts", "build:daesang:main:development": "cross-env NODE_ENV=development TS_NODE_PROJECT='./config/tsconfig.webpack.json' parallel-webpack --config=config/main.webpack.config.ts",
"build:daesang: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:daesang: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",
"run:daesang": "npm-run-all -p run:daesang:renderer run:daesang:main", "run:daesang": "npm-run-all -p run:daesang:renderer run:daesang:main",

View File

@ -9,7 +9,7 @@ import { environment } from '../environments/environment';
export function createTranslateLoader(nativeService: NativeService) { export function createTranslateLoader(nativeService: NativeService) {
const translateLoader = nativeService.getTranslateLoader( const translateLoader = nativeService.getTranslateLoader(
environment.production environment.production
? './assets/i18n/' ? '/dist/ucap-webmessenger-app/assets/i18n/'
: '/projects/ucap-webmessenger-app/src/assets/i18n/', : '/projects/ucap-webmessenger-app/src/assets/i18n/',
'.json' '.json'
); );

View File

@ -34,6 +34,7 @@ import {
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { DaesangApiService } from '@ucap-webmessenger/daesang'; import { DaesangApiService } from '@ucap-webmessenger/daesang';
import { NGXLogger } from 'ngx-logger';
@Component({ @Component({
selector: 'app-layout-native-top-bar', selector: 'app-layout-native-top-bar',
@ -60,7 +61,8 @@ export class TopBarComponent implements OnInit, OnDestroy {
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private localStorageService: LocalStorageService, private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private daesangApiService: DaesangApiService private daesangApiService: DaesangApiService,
private logger: NGXLogger
) {} ) {}
ngOnInit() { ngOnInit() {
@ -144,7 +146,7 @@ export class TopBarComponent implements OnInit, OnDestroy {
.pipe( .pipe(
take(1), take(1),
map(res => (this.webLinkBadgeMail = res.count)), map(res => (this.webLinkBadgeMail = res.count)),
catchError(error => of(console.log(error))) catchError(error => of(this.logger.log(error)))
) )
.subscribe(); .subscribe();
} }
@ -179,7 +181,7 @@ export class TopBarComponent implements OnInit, OnDestroy {
map(res => { map(res => {
this.webLinkBadgePayment = res.count; this.webLinkBadgePayment = res.count;
}), }),
catchError(error => of(console.log(error))) catchError(error => of(this.logger.log(error)))
) )
.subscribe(); .subscribe();
} }

View File

@ -12,7 +12,7 @@ import {
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
export const environment: Environment = { export const environment: Environment = {
production: false, production: true,
title: `DS Talk`, title: `DS Talk`,
companyConfig: { companyConfig: {