clear configuration logic add. but not appearence
This commit is contained in:
parent
1f83038abc
commit
ae56f389c5
@ -420,6 +420,13 @@ ipcMain.on(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ipcMain.on(
|
||||||
|
MessengerChannel.ClearAppStorage,
|
||||||
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
appStorage.reset();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
ipcMain.on(
|
ipcMain.on(
|
||||||
MessengerChannel.ChangeAutoLaunch,
|
MessengerChannel.ChangeAutoLaunch,
|
||||||
(event: IpcMainEvent, ...args: any[]) => {
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
@ -53,6 +53,15 @@ export class Storage {
|
|||||||
get constDefaultDownloadFolder(): string {
|
get constDefaultDownloadFolder(): string {
|
||||||
return DOWNLOAD_FOLDER_PATH;
|
return DOWNLOAD_FOLDER_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset(): void {
|
||||||
|
this.store.set({
|
||||||
|
options: {
|
||||||
|
startupHideWindow: false,
|
||||||
|
downloadPath: path.join(app.getPath('documents'), DOWNLOAD_FOLDER_PATH)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appStorage: Storage = new Storage();
|
export const appStorage: Storage = new Storage();
|
||||||
|
@ -124,6 +124,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions class="button-farm flex-row">
|
<mat-card-actions class="button-farm flex-row">
|
||||||
|
<!-- <button
|
||||||
|
mat-stroked-button
|
||||||
|
(click)="onClickClearSettingAndLogout()"
|
||||||
|
class="mat-primary"
|
||||||
|
>
|
||||||
|
Clear Setting & Logout
|
||||||
|
</button> -->
|
||||||
<button
|
<button
|
||||||
mat-stroked-button
|
mat-stroked-button
|
||||||
(click)="onClickChoice(false)"
|
(click)="onClickChoice(false)"
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
import { Component, OnInit, Inject, Renderer2, OnDestroy } from '@angular/core';
|
import { Component, OnInit, Inject, Renderer2, OnDestroy } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
|
import {
|
||||||
|
KEY_LOGIN_RES_INFO,
|
||||||
|
KEY_VER_INFO,
|
||||||
|
KEY_LOGIN_INFO,
|
||||||
|
KEY_URL_INFO,
|
||||||
|
KEY_AUTH_INFO,
|
||||||
|
KEY_LOGOUT_INFO
|
||||||
|
} from '@app/types';
|
||||||
import {
|
import {
|
||||||
SessionStorageService,
|
SessionStorageService,
|
||||||
LocalStorageService
|
LocalStorageService
|
||||||
} from '@ucap-webmessenger/web-storage';
|
} from '@ucap-webmessenger/web-storage';
|
||||||
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
|
||||||
import clone from 'clone';
|
import clone from 'clone';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TranslateService as UCapTranslateService,
|
TranslateService as UCapTranslateService,
|
||||||
DateService as UCapDateService
|
DateService as UCapDateService,
|
||||||
|
DialogService
|
||||||
} from '@ucap-webmessenger/ui';
|
} from '@ucap-webmessenger/ui';
|
||||||
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
||||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||||
@ -69,6 +78,7 @@ export class MessengerSettingsDialogComponent implements OnInit, OnDestroy {
|
|||||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
|
private dialogService: DialogService,
|
||||||
@Inject(DOCUMENT) private document: Document,
|
@Inject(DOCUMENT) private document: Document,
|
||||||
private renderer2: Renderer2
|
private renderer2: Renderer2
|
||||||
) {
|
) {
|
||||||
@ -200,4 +210,17 @@ export class MessengerSettingsDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return modSettings;
|
return modSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickClearSettingAndLogout() {
|
||||||
|
this.localStorageService.remove(KEY_APP_USER_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_LOGIN_RES_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_VER_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_LOGIN_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_URL_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_AUTH_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_LOGOUT_INFO);
|
||||||
|
this.nativeService.clearAppStorage();
|
||||||
|
this.dialogService.closeAll();
|
||||||
|
this.store.dispatch(AuthenticationStore.loginRedirect());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,8 @@ export class BrowserNativeService extends NativeService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearAppStorage(): void {}
|
||||||
|
|
||||||
changeAutoLaunch(autoLaunch: boolean): Promise<boolean> {
|
changeAutoLaunch(autoLaunch: boolean): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
@ -132,6 +132,10 @@ export class ElectronNativeService implements NativeService {
|
|||||||
return this.showSetting$;
|
return this.showSetting$;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearAppStorage(): void {
|
||||||
|
this.ipcRenderer.send(MessengerChannel.ClearAppStorage);
|
||||||
|
}
|
||||||
|
|
||||||
changeAutoLaunch(autoLaunch: boolean): Promise<boolean> {
|
changeAutoLaunch(autoLaunch: boolean): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
@ -2,6 +2,7 @@ export enum MessengerChannel {
|
|||||||
Logout = 'UCAP::messenger::logout',
|
Logout = 'UCAP::messenger::logout',
|
||||||
ChangeStatus = 'UCAP::messenger::changeStatus',
|
ChangeStatus = 'UCAP::messenger::changeStatus',
|
||||||
ShowSetting = 'UCAP::messenger::showSetting',
|
ShowSetting = 'UCAP::messenger::showSetting',
|
||||||
|
ClearAppStorage = 'UCAP::messenger::clearAppStorage',
|
||||||
ChangeAutoLaunch = 'UCAP::messenger::changeAutoLaunch',
|
ChangeAutoLaunch = 'UCAP::messenger::changeAutoLaunch',
|
||||||
ChangeStartupHideWindow = 'UCAP::messenger::changeStartupHideWindow',
|
ChangeStartupHideWindow = 'UCAP::messenger::changeStartupHideWindow',
|
||||||
ChangeDownloadPath = 'UCAP::messenger::changeDownloadPath',
|
ChangeDownloadPath = 'UCAP::messenger::changeDownloadPath',
|
||||||
|
@ -27,6 +27,7 @@ export abstract class NativeService {
|
|||||||
abstract getNetworkInfo(): Promise<any>;
|
abstract getNetworkInfo(): Promise<any>;
|
||||||
abstract getVersionInfo(): Promise<string>;
|
abstract getVersionInfo(): Promise<string>;
|
||||||
|
|
||||||
|
abstract clearAppStorage(): void;
|
||||||
abstract changeAutoLaunch(autoLaunch: boolean): Promise<boolean>;
|
abstract changeAutoLaunch(autoLaunch: boolean): Promise<boolean>;
|
||||||
abstract changeStartupHideWindow(
|
abstract changeStartupHideWindow(
|
||||||
startupHideWindow: boolean
|
startupHideWindow: boolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user