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

View File

@ -257,7 +257,8 @@
yPosition="below"
(closed)="onClosedProfileMenu($event)"
>
<div class="setting">
<ng-template matMenuContent>
<div class="setting" style="width: 200px;">
<button mat-menu-item [matMenuTriggerFor]="presenseMenu">
<ng-container [ngSwitch]="myStatus.pcStatus">
<ng-container *ngSwitchCase="StatusCode.OnLine">
@ -324,9 +325,16 @@
{{ 'accounts.logout' | translate }}
</button>
</div>
<div class="setting">
<button mat-menu-item (click)="onClickQuit()">
{{ 'common.messages.quit' | translate }}
</button>
</div>
</ng-template>
</mat-menu>
<mat-menu #presenseMenu="matMenu" class="status-pc-set">
<ng-template matMenuContent>
<div class="setting">
<button mat-menu-item (click)="onClickStatusOnline($event)">
<span class="presence pcOn"> </span>
@ -419,22 +427,30 @@
</ucap-inline-edit-input>
</button>
</div>
</ng-template>
</mat-menu>
<mat-menu #awayTimeMenu="matMenu">
<ng-template matMenuContent>
<div mat-menu-item (click)="$event.stopPropagation()">
{{ 'presence.settingOfAwayTime' | translate }}
</div>
<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
<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 #informationMenu="matMenu">
<ng-template matMenuContent>
<div
class="version-info-container menu-item"
(click)="$event.stopPropagation()"
@ -472,4 +488,5 @@
</div>
</div>
</div>
</ng-template>
</mat-menu>

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,8 @@ import {
ChatChannel,
MessengerChannel,
MessageChannel,
ProcessChannel
ProcessChannel,
AppChannel
} from '../types/channel.type';
import { Injectable } from '@angular/core';
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> {
return new Promise<number>((resolve, reject) => {
try {

View File

@ -53,3 +53,7 @@ export enum IdleStateChannel {
StartCheck = 'UCAP::idleState::startCheck',
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 windowMaximize(): void;
abstract zoomTo(factor: number): Promise<number>;
abstract appExit(): void;
abstract idleStateChanged(): Observable<WindowIdle>;
abstract changeLimitOfIdleState(limitTime: number): void;