From 8f5152a60a54076084e04d0786320e3b437c9869 Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 12 Feb 2020 17:08:46 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?251?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialogs/notice/notice-detail.dialog.component.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.html index 73ea8e4e..8fd03370 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.html @@ -20,7 +20,10 @@ {{ data.notice.regDate }} -

+

From 43601951a4f9e2bf70a4f383f46289632799a3d7 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Wed, 12 Feb 2020 17:25:06 +0900 Subject: [PATCH 2/4] open browser --- .../ucap-webmessenger-electron/src/index.ts | 40 ++++++++++++- package-lock.json | 56 +++++++++++++++++-- package.json | 2 + .../native/components/top-bar.component.ts | 5 +- .../lib/services/browser-native.service.ts | 5 +- .../lib/services/electron-native.service.ts | 11 +++- .../src/lib/types/channel.type.ts | 4 ++ .../src/lib/services/native.service.ts | 5 +- 8 files changed, 116 insertions(+), 12 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 1ae23473..0a3914b9 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -14,6 +14,8 @@ import fse from 'fs-extra'; import semver from 'semver'; import os from 'os'; import ChildProcess from 'child_process'; +import * as url from 'url'; +import * as tmp from 'tmp'; import AutoLaunch from 'auto-launch'; @@ -31,7 +33,8 @@ import { MessengerChannel, MessageChannel, AppChannel, - ClipboardChannel + ClipboardChannel, + ExternalChannel } from '@ucap-webmessenger/native-electron'; import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification'; import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window'; @@ -92,6 +95,8 @@ let preventQuit = false; let notificationService: ElectronNotificationService | null; let updateWindowService: ElectronUpdateWindowService | null; +tmp.setGracefulCleanup(); + function handleUncaughtException(error: Error) { preventQuit = true; @@ -771,6 +776,39 @@ ipcMain.on(AppChannel.Exit, (event: IpcMainEvent, ...args: any[]) => { appExit(); }); +ipcMain.on(ExternalChannel.OpenUrl, (event: IpcMainEvent, ...args: any[]) => { + const targetUrl = args[0]; + const options = JSON.stringify(args[1] || {}); + + tmp.file({ postfix: '.html' }, (err, name, fd, cb) => { + fse.writeFileSync( + name, + ` + + + + DS Talk Link + + + + + + + + ` + ); + + shell.openExternal(name); + }); +}); + autoUpdater.on('checking-for-update', () => { log.info('Checking for update...'); }); diff --git a/package-lock.json b/package-lock.json index ef621c0c..d1bd62ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ucap-webmessenger", - "version": "0.0.17", + "version": "0.0.19", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3494,6 +3494,12 @@ "integrity": "sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==", "dev": true }, + "@types/tmp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA==", + "dev": true + }, "@types/tween.js": { "version": "17.2.0", "resolved": "https://registry.npmjs.org/@types/tween.js/-/tween.js-17.2.0.tgz", @@ -7615,6 +7621,17 @@ "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "dependencies": { + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + } } }, "extglob": { @@ -10449,6 +10466,15 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-regex-range": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", @@ -15119,12 +15145,23 @@ } }, "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", "dev": true, "requires": { - "os-tmpdir": "~1.0.2" + "rimraf": "^2.6.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "to-array": { @@ -15694,6 +15731,15 @@ "yallist": "^2.1.2" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/package.json b/package.json index 1ae32ab1..2a428e9e 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "@types/moment-timezone": "^0.5.12", "@types/node": "^10.17.13", "@types/semver": "^6.2.0", + "@types/tmp": "^0.1.0", "@types/uglifyjs-webpack-plugin": "^1.1.0", "@types/webpack": "^4.41.2", "@types/webpack-merge": "^4.1.5", @@ -142,6 +143,7 @@ "protractor": "~5.4.0", "queueing-subject": "^0.3.4", "rimraf": "^3.0.0", + "tmp": "^0.1.0", "ts-node": "~7.0.0", "tsickle": "^0.37.1", "tslib": "^1.10.0", diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts index 52616bd7..a2ad1c78 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts @@ -409,7 +409,10 @@ export class TopBarComponent implements OnInit, OnDestroy { .replace(/(\(%USER_ID%\))/g, loginId) .replace(/(\(%USER_PASS%\))/g, loginPw); - this.nativeService.openDefaultBrowser(url); + this.nativeService.openDefaultBrowser(url, { + features: + 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=400,height=400' + }); } onClosedProfileMenu() { diff --git a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts index 0bf8371d..cb833db0 100644 --- a/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts +++ b/projects/ucap-webmessenger-native-browser/src/lib/services/browser-native.service.ts @@ -277,7 +277,10 @@ export class BrowserNativeService extends NativeService { return new TranslateLoaderService(this, prefix, suffix); } - openDefaultBrowser(url: string): void { + openDefaultBrowser( + url: string, + options?: { name?: string; features?: string; replace?: boolean } + ): void { open(url); } diff --git a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts index 90aa84fc..1895b446 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/services/electron-native.service.ts @@ -24,7 +24,8 @@ import { MessageChannel, ProcessChannel, AppChannel, - ClipboardChannel + ClipboardChannel, + ExternalChannel } from '../types/channel.type'; import { Injectable } from '@angular/core'; import { TranslateLoaderService } from '../translate/electron-loader'; @@ -467,8 +468,12 @@ export class ElectronNativeService implements NativeService { return new TranslateLoaderService(this, prefix, suffix); } - openDefaultBrowser(url: string): void { - this.shell.openExternal(url); + openDefaultBrowser( + url: string, + options?: { name?: string; features?: string; replace?: boolean } + ): void { + // shell.openExternal(url); + this.ipcRenderer.send(ExternalChannel.OpenUrl, url, options); } readFromClipboard(): Promise<{ diff --git a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts index 1348c92a..a944bf11 100644 --- a/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts +++ b/projects/ucap-webmessenger-native-electron/src/lib/types/channel.type.ts @@ -62,3 +62,7 @@ export enum ClipboardChannel { export enum AppChannel { Exit = 'UCAP::app::exit' } + +export enum ExternalChannel { + OpenUrl = 'UCAP::external::openUrl' +} diff --git a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts index 80ec8fde..03f97d15 100644 --- a/projects/ucap-webmessenger-native/src/lib/services/native.service.ts +++ b/projects/ucap-webmessenger-native/src/lib/services/native.service.ts @@ -87,7 +87,10 @@ export abstract class NativeService { suffix?: string ): TranslateLoader; - abstract openDefaultBrowser(url: string): void; + abstract openDefaultBrowser( + url: string, + options?: { name?: string; features?: string; replace?: boolean } + ): void; abstract readFromClipboard(): Promise<{ text?: string; From 31c0c9ff0563341fae3149a4ffb0145924026a0e Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 12 Feb 2020 17:33:07 +0900 Subject: [PATCH 3/4] version update to 0.0.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1ae32ab1..9e14c6e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucap-webmessenger", - "version": "0.0.19", + "version": "0.0.20", "author": { "name": "LG CNS", "email": "lgucap@lgcns.com" From 4711ff4f8b07654b4d5996400bbfcb81ad12552c Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Wed, 12 Feb 2020 17:37:01 +0900 Subject: [PATCH 4/4] bug fixed --- electron-projects/ucap-webmessenger-electron/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index c26df031..758ab763 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -794,15 +794,16 @@ ipcMain.on(ExternalChannel.OpenUrl, (event: IpcMainEvent, ...args: any[]) => { - +