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,7 +257,8 @@
yPosition="below" yPosition="below"
(closed)="onClosedProfileMenu($event)" (closed)="onClosedProfileMenu($event)"
> >
<div class="setting"> <ng-template matMenuContent>
<div class="setting" style="width: 200px;">
<button mat-menu-item [matMenuTriggerFor]="presenseMenu"> <button mat-menu-item [matMenuTriggerFor]="presenseMenu">
<ng-container [ngSwitch]="myStatus.pcStatus"> <ng-container [ngSwitch]="myStatus.pcStatus">
<ng-container *ngSwitchCase="StatusCode.OnLine"> <ng-container *ngSwitchCase="StatusCode.OnLine">
@ -324,9 +325,16 @@
{{ '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">
<ng-template matMenuContent>
<div class="setting"> <div class="setting">
<button mat-menu-item (click)="onClickStatusOnline($event)"> <button mat-menu-item (click)="onClickStatusOnline($event)">
<span class="presence pcOn"> </span> <span class="presence pcOn"> </span>
@ -419,22 +427,30 @@
</ucap-inline-edit-input> </ucap-inline-edit-input>
</button> </button>
</div> </div>
</ng-template>
</mat-menu> </mat-menu>
<mat-menu #awayTimeMenu="matMenu"> <mat-menu #awayTimeMenu="matMenu">
<ng-template matMenuContent>
<div mat-menu-item (click)="$event.stopPropagation()"> <div mat-menu-item (click)="$event.stopPropagation()">
{{ 'presence.settingOfAwayTime' | translate }} {{ 'presence.settingOfAwayTime' | translate }}
</div> </div>
<mat-radio-group aria-label="Select an option" [value]="myIdleCheckTime"> <mat-radio-group aria-label="Select an option" [value]="myIdleCheckTime">
<div mat-menu-item *ngFor="let awayTime of awayTimeList"> <div mat-menu-item *ngFor="let awayTime of awayTimeList">
<mat-radio-button [value]="awayTime" (change)="onChangeAwayTime($event)"> <mat-radio-button
{{ awayTime }}{{ 'common.units.minute' | translate }}</mat-radio-button [value]="awayTime"
(change)="onChangeAwayTime($event)"
>
{{ awayTime
}}{{ 'common.units.minute' | translate }}</mat-radio-button
> >
</div> </div>
</mat-radio-group> </mat-radio-group>
</ng-template>
</mat-menu> </mat-menu>
<mat-menu #informationMenu="matMenu"> <mat-menu #informationMenu="matMenu">
<ng-template matMenuContent>
<div <div
class="version-info-container menu-item" class="version-info-container menu-item"
(click)="$event.stopPropagation()" (click)="$event.stopPropagation()"
@ -472,4 +488,5 @@
</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;