app exit is added

This commit is contained in:
richard-loafle 2020-01-23 11:23:31 +09:00
parent bbebd8bedc
commit 97499b0415
9 changed files with 233 additions and 189 deletions

View File

@ -28,7 +28,8 @@ import {
NotificationChannel, NotificationChannel,
ChatChannel, ChatChannel,
MessengerChannel, MessengerChannel,
MessageChannel MessageChannel,
AppChannel
} from '@ucap-webmessenger/native-electron'; } from '@ucap-webmessenger/native-electron';
import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification'; import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification';
import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window'; import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window';
@ -231,8 +232,7 @@ function createTray() {
// selector: 'terminate:', // selector: 'terminate:',
click: () => { click: () => {
// 메신저에 로그아웃 후 종료 // 메신저에 로그아웃 후 종료
appWindow = null; appExit();
app.exit();
} }
} }
]); ]);
@ -715,6 +715,10 @@ ipcMain.on(
} }
); );
ipcMain.on(AppChannel.Exit, (event: IpcMainEvent, ...args: any[]) => {
appExit();
});
autoUpdater.on('checking-for-update', () => { autoUpdater.on('checking-for-update', () => {
log.info('Checking for update...'); log.info('Checking for update...');
}); });
@ -748,3 +752,8 @@ autoUpdater.on('update-downloaded', info => {
updateWindowService.setDownloadComplete(); updateWindowService.setDownloadComplete();
autoUpdater.quitAndInstall(true, true); autoUpdater.quitAndInstall(true, true);
}); });
function appExit() {
appWindow = null;
app.exit();
}

View File

@ -257,27 +257,28 @@
yPosition="below" yPosition="below"
(closed)="onClosedProfileMenu($event)" (closed)="onClosedProfileMenu($event)"
> >
<div class="setting"> <ng-template matMenuContent>
<button mat-menu-item [matMenuTriggerFor]="presenseMenu"> <div class="setting" style="width: 200px;">
<ng-container [ngSwitch]="myStatus.pcStatus"> <button mat-menu-item [matMenuTriggerFor]="presenseMenu">
<ng-container *ngSwitchCase="StatusCode.OnLine"> <ng-container [ngSwitch]="myStatus.pcStatus">
{{ 'presence.online' | translate }} <ng-container *ngSwitchCase="StatusCode.OnLine">
{{ 'presence.online' | translate }}
</ng-container>
<ng-container *ngSwitchCase="StatusCode.Away">
{{ 'presence.away' | translate }}
</ng-container>
<ng-container *ngSwitchCase="StatusCode.Busy">
{{ myStatus.statusMessage }}
</ng-container>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="StatusCode.Away"> </button>
{{ 'presence.away' | translate }} </div>
</ng-container> <div class="setting">
<ng-container *ngSwitchCase="StatusCode.Busy"> <button mat-menu-item (click)="onClickOpenProfile($event)">
{{ myStatus.statusMessage }} {{ 'profile.open' | translate }}
</ng-container> </button>
</ng-container> </div>
</button> <!-- <div class="setting">
</div>
<div class="setting">
<button mat-menu-item (click)="onClickOpenProfile($event)">
{{ 'profile.open' | translate }}
</button>
</div>
<!-- <div class="setting">
<button <button
mat-menu-item mat-menu-item
class="zoom minus-square" class="zoom minus-square"
@ -293,183 +294,199 @@
확대 확대
</button> </button>
</div> --> </div> -->
<div class="setting"> <div class="setting">
<button mat-menu-item (click)="onClickNotice()"> <button mat-menu-item (click)="onClickNotice()">
{{ 'notice.label' | translate }} {{ 'notice.label' | translate }}
</button> </button>
</div> </div>
<div class="setting"> <div class="setting">
<button mat-menu-item (click)="onClickRemoteSupport($event)"> <button mat-menu-item (click)="onClickRemoteSupport($event)">
{{ 'profile.remoteSupport' | translate }} {{ 'profile.remoteSupport' | translate }}
</button> </button>
</div> </div>
<div class="setting"> <div class="setting">
<button mat-menu-item (click)="onClickSettings()"> <button mat-menu-item (click)="onClickSettings()">
{{ 'settings.label' | translate }} {{ 'settings.label' | translate }}
</button> </button>
</div> </div>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div class="setting"> <div class="setting">
<button <button
mat-menu-item mat-menu-item
[matMenuTriggerFor]="informationMenu" [matMenuTriggerFor]="informationMenu"
(menuOpened)="onMenuOpenedinformationMenu()" (menuOpened)="onMenuOpenedinformationMenu()"
> >
{{ 'information.checkForUpdates' | translate }} {{ 'information.checkForUpdates' | translate }}
</button> </button>
</div> </div>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div class="setting"> <div class="setting">
<button mat-menu-item (click)="onClickLogout()"> <button mat-menu-item (click)="onClickLogout()">
{{ 'accounts.logout' | translate }} {{ 'accounts.logout' | translate }}
</button> </button>
</div> </div>
<div class="setting">
<button mat-menu-item (click)="onClickQuit()">
{{ 'common.messages.quit' | translate }}
</button>
</div>
</ng-template>
</mat-menu> </mat-menu>
<mat-menu #presenseMenu="matMenu" class="status-pc-set"> <mat-menu #presenseMenu="matMenu" class="status-pc-set">
<div class="setting"> <ng-template matMenuContent>
<button mat-menu-item (click)="onClickStatusOnline($event)"> <div class="setting">
<span class="presence pcOn"> </span> <button mat-menu-item (click)="onClickStatusOnline($event)">
{{ 'presence.online' | translate }} <span class="presence pcOn"> </span>
</button> {{ 'presence.online' | translate }}
</div> </button>
<div class="setting"> </div>
<button mat-menu-item (click)="onClickStatusAway($event)"> <div class="setting">
<span class="presence pcOut"> </span> <button mat-menu-item (click)="onClickStatusAway($event)">
{{ 'presence.away' | translate }} <span class="presence pcOut"> </span>
</button> {{ 'presence.away' | translate }}
<button </button>
mat-menu-item <button
class="clock" mat-menu-item
[matMenuTriggerFor]="awayTimeMenu" class="clock"
></button> [matMenuTriggerFor]="awayTimeMenu"
</div> ></button>
<div class="setting"> </div>
<button mat-menu-item (click)="onClickStatusBusy($event, 1)"> <div class="setting">
<span class="presence pcOther"> </span> <button mat-menu-item (click)="onClickStatusBusy($event, 1)">
<ucap-inline-edit-input <span class="presence pcOther"> </span>
(apply)=" <ucap-inline-edit-input
$event.stopPropagation(); (apply)="
onApplyStatusMessage(1, statusMessage1.value) $event.stopPropagation();
" onApplyStatusMessage(1, statusMessage1.value)
(edit)="$event.stopPropagation()" "
(cancel)="$event.stopPropagation()" (edit)="$event.stopPropagation()"
class="form-eidt" (cancel)="$event.stopPropagation()"
> class="form-eidt"
<span ucapInlineEditInput="view">{{ loginRes?.statusMessage1 }}</span> >
<span ucapInlineEditInput="edit" <span ucapInlineEditInput="view">{{ loginRes?.statusMessage1 }}</span>
><input <span ucapInlineEditInput="edit"
matInput ><input
#statusMessage1 matInput
type="text" #statusMessage1
maxlength="5" type="text"
[value]="loginRes?.statusMessage1" maxlength="5"
(click)="$event.stopPropagation()" [value]="loginRes?.statusMessage1"
/></span> (click)="$event.stopPropagation()"
</ucap-inline-edit-input> /></span>
</button> </ucap-inline-edit-input>
</div> </button>
<div class="setting"> </div>
<button mat-menu-item (click)="onClickStatusBusy($event, 2)"> <div class="setting">
<span class="presence pcOther"> </span> <button mat-menu-item (click)="onClickStatusBusy($event, 2)">
<ucap-inline-edit-input <span class="presence pcOther"> </span>
(apply)=" <ucap-inline-edit-input
$event.stopPropagation(); (apply)="
onApplyStatusMessage(2, statusMessage2.value) $event.stopPropagation();
" onApplyStatusMessage(2, statusMessage2.value)
(edit)="$event.stopPropagation()" "
(cancel)="$event.stopPropagation()" (edit)="$event.stopPropagation()"
class="form-eidt" (cancel)="$event.stopPropagation()"
> class="form-eidt"
<span ucapInlineEditInput="view">{{ loginRes?.statusMessage2 }}</span> >
<span ucapInlineEditInput="edit" <span ucapInlineEditInput="view">{{ loginRes?.statusMessage2 }}</span>
><input <span ucapInlineEditInput="edit"
matInput ><input
#statusMessage2 matInput
type="text" #statusMessage2
maxlength="5" type="text"
[value]="loginRes?.statusMessage2" maxlength="5"
(click)="$event.stopPropagation()" [value]="loginRes?.statusMessage2"
/></span> (click)="$event.stopPropagation()"
</ucap-inline-edit-input> /></span>
</button> </ucap-inline-edit-input>
</div> </button>
<div class="setting"> </div>
<button mat-menu-item (click)="onClickStatusBusy($event, 3)"> <div class="setting">
<span class="presence pcOther"> </span> <button mat-menu-item (click)="onClickStatusBusy($event, 3)">
<ucap-inline-edit-input <span class="presence pcOther"> </span>
(apply)=" <ucap-inline-edit-input
$event.stopPropagation(); (apply)="
onApplyStatusMessage(3, statusMessage3.value) $event.stopPropagation();
" onApplyStatusMessage(3, statusMessage3.value)
(edit)="$event.stopPropagation()" "
(cancel)="$event.stopPropagation()" (edit)="$event.stopPropagation()"
class="form-eidt" (cancel)="$event.stopPropagation()"
> class="form-eidt"
<span ucapInlineEditInput="view">{{ loginRes?.statusMessage3 }}</span> >
<span ucapInlineEditInput="edit" <span ucapInlineEditInput="view">{{ loginRes?.statusMessage3 }}</span>
><input <span ucapInlineEditInput="edit"
matInput ><input
#statusMessage3 matInput
type="text" #statusMessage3
maxlength="5" type="text"
[value]="loginRes?.statusMessage3" maxlength="5"
(click)="$event.stopPropagation()" [value]="loginRes?.statusMessage3"
/></span> (click)="$event.stopPropagation()"
</ucap-inline-edit-input> /></span>
</button> </ucap-inline-edit-input>
</div> </button>
</div>
</ng-template>
</mat-menu> </mat-menu>
<mat-menu #awayTimeMenu="matMenu"> <mat-menu #awayTimeMenu="matMenu">
<div mat-menu-item (click)="$event.stopPropagation()"> <ng-template matMenuContent>
{{ 'presence.settingOfAwayTime' | translate }} <div mat-menu-item (click)="$event.stopPropagation()">
</div> {{ 'presence.settingOfAwayTime' | translate }}
<mat-radio-group aria-label="Select an option" [value]="myIdleCheckTime">
<div mat-menu-item *ngFor="let awayTime of awayTimeList">
<mat-radio-button [value]="awayTime" (change)="onChangeAwayTime($event)">
{{ awayTime }}{{ 'common.units.minute' | translate }}</mat-radio-button
>
</div> </div>
</mat-radio-group> <mat-radio-group aria-label="Select an option" [value]="myIdleCheckTime">
<div mat-menu-item *ngFor="let awayTime of awayTimeList">
<mat-radio-button
[value]="awayTime"
(change)="onChangeAwayTime($event)"
>
{{ awayTime
}}{{ 'common.units.minute' | translate }}</mat-radio-button
>
</div>
</mat-radio-group>
</ng-template>
</mat-menu> </mat-menu>
<mat-menu #informationMenu="matMenu"> <mat-menu #informationMenu="matMenu">
<div <ng-template matMenuContent>
class="version-info-container menu-item" <div
(click)="$event.stopPropagation()" class="version-info-container menu-item"
> (click)="$event.stopPropagation()"
<div> >
<span> <div>
{{ 'information.installedVersion' | translate }}:{{ appVersion }} <span>
</span> {{ 'information.installedVersion' | translate }}:{{ appVersion }}
</div> </span>
<div *ngIf="checkingUpdate">
<div *ngIf="checkingUpdateIsProcessing" style="display: flex;">
<mat-spinner
*ngIf="checkingUpdate && checkingUpdateIsProcessing"
diameter="20"
strokeWidth="1"
></mat-spinner>
{{ 'information.checkForUpdatesInProgress' | translate }}
</div> </div>
<div *ngIf="checkingUpdate">
<div *ngIf="checkingUpdateIsProcessing" style="display: flex;">
<mat-spinner
*ngIf="checkingUpdate && checkingUpdateIsProcessing"
diameter="20"
strokeWidth="1"
></mat-spinner>
{{ 'information.checkForUpdatesInProgress' | translate }}
</div>
<div *ngIf="!checkingUpdateIsProcessing" style="display: flex;"> <div *ngIf="!checkingUpdateIsProcessing" style="display: flex;">
<span> <span>
{{ 'information.latestVersion' | translate }}:{{ {{ 'information.latestVersion' | translate }}:{{
checkingUpdateAppVersion checkingUpdateAppVersion
}} }}
</span> </span>
<span> <span>
<button <button
*ngIf="checkingUpdateIsExist" *ngIf="checkingUpdateIsExist"
mat-button mat-button
(click)="onClickApplyUpdate($event)" (click)="onClickApplyUpdate($event)"
> >
{{ 'information.applyUpdates' | translate }} {{ 'information.applyUpdates' | translate }}
</button> </button>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </ng-template>
</mat-menu> </mat-menu>

View File

@ -309,6 +309,10 @@ export class TopBarComponent implements OnInit, OnDestroy {
this.store.dispatch(AuthenticationStore.logoutConfirmation()); this.store.dispatch(AuthenticationStore.logoutConfirmation());
} }
onClickQuit(): void {
this.nativeService.appExit();
}
getMyProfileImageWidget(): string { getMyProfileImageWidget(): string {
if (!!this.loginRes) { if (!!this.loginRes) {
return this.loginRes.userInfo.profileImageFile; return this.loginRes.userInfo.profileImageFile;

View File

@ -406,6 +406,7 @@
} }
}, },
"messages": { "messages": {
"quit": "Quit",
"yes": "Yes", "yes": "Yes",
"no": "No", "no": "No",
"confirm": "Confirm", "confirm": "Confirm",

View File

@ -406,6 +406,7 @@
} }
}, },
"messages": { "messages": {
"quit": "종료",
"yes": "예", "yes": "예",
"no": "아니오", "no": "아니오",
"confirm": "확인", "confirm": "확인",

View File

@ -221,6 +221,8 @@ export class BrowserNativeService extends NativeService {
windowMaximize(): void {} windowMaximize(): void {}
appExit(): void {}
zoomTo(factor: number): Promise<number> { zoomTo(factor: number): Promise<number> {
return new Promise<number>((resolve, reject) => { return new Promise<number>((resolve, reject) => {
resolve(-1); resolve(-1);

View File

@ -22,7 +22,8 @@ import {
ChatChannel, ChatChannel,
MessengerChannel, MessengerChannel,
MessageChannel, MessageChannel,
ProcessChannel ProcessChannel,
AppChannel
} from '../types/channel.type'; } from '../types/channel.type';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { TranslateLoaderService } from '../translate/electron-loader'; import { TranslateLoaderService } from '../translate/electron-loader';
@ -388,6 +389,10 @@ export class ElectronNativeService implements NativeService {
} }
} }
appExit(): void {
this.ipcRenderer.send(AppChannel.Exit);
}
zoomTo(factor: number): Promise<number> { zoomTo(factor: number): Promise<number> {
return new Promise<number>((resolve, reject) => { return new Promise<number>((resolve, reject) => {
try { try {

View File

@ -53,3 +53,7 @@ export enum IdleStateChannel {
StartCheck = 'UCAP::idleState::startCheck', StartCheck = 'UCAP::idleState::startCheck',
ChangeLimitTime = 'UCAP::idleState::changeLimitTime' ChangeLimitTime = 'UCAP::idleState::changeLimitTime'
} }
export enum AppChannel {
Exit = 'UCAP::app::exit'
}

View File

@ -68,6 +68,7 @@ export abstract class NativeService {
abstract windowMinimize(): void; abstract windowMinimize(): void;
abstract windowMaximize(): void; abstract windowMaximize(): void;
abstract zoomTo(factor: number): Promise<number>; abstract zoomTo(factor: number): Promise<number>;
abstract appExit(): void;
abstract idleStateChanged(): Observable<WindowIdle>; abstract idleStateChanged(): Observable<WindowIdle>;
abstract changeLimitOfIdleState(limitTime: number): void; abstract changeLimitOfIdleState(limitTime: number): void;