settings is modified
This commit is contained in:
parent
8ed5c11300
commit
23cd003795
|
@ -1,4 +1,12 @@
|
||||||
import { app, ipcMain, IpcMainEvent, Tray, Menu, shell } from 'electron';
|
import {
|
||||||
|
app,
|
||||||
|
ipcMain,
|
||||||
|
IpcMainEvent,
|
||||||
|
Tray,
|
||||||
|
Menu,
|
||||||
|
shell,
|
||||||
|
dialog
|
||||||
|
} from 'electron';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fse from 'fs-extra';
|
import fse from 'fs-extra';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
@ -22,7 +30,6 @@ import { ElectronNotificationService } from '@ucap-webmessenger/electron-notific
|
||||||
import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window';
|
import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window';
|
||||||
|
|
||||||
import { root } from './util/root';
|
import { root } from './util/root';
|
||||||
import { DefaultFolder } from './lib/default-folder';
|
|
||||||
import { FileUtil } from './lib/file-util';
|
import { FileUtil } from './lib/file-util';
|
||||||
|
|
||||||
import { IdleChecker } from './lib/idle-checker';
|
import { IdleChecker } from './lib/idle-checker';
|
||||||
|
@ -453,7 +460,7 @@ ipcMain.on(
|
||||||
const fileName: string = args[1];
|
const fileName: string = args[1];
|
||||||
const mimeType: string = args[2];
|
const mimeType: string = args[2];
|
||||||
let savePath: string = path.join(
|
let savePath: string = path.join(
|
||||||
!!args[3] ? args[3] : DefaultFolder.downloads(),
|
!!args[3] ? args[3] : app.getPath('downloads'),
|
||||||
fileName
|
fileName
|
||||||
);
|
);
|
||||||
savePath = await FileUtil.uniqueFileName(savePath);
|
savePath = await FileUtil.uniqueFileName(savePath);
|
||||||
|
@ -478,7 +485,7 @@ ipcMain.on(
|
||||||
let folderItem: string = args[0];
|
let folderItem: string = args[0];
|
||||||
const make: boolean = args[1];
|
const make: boolean = args[1];
|
||||||
if (!folderItem) {
|
if (!folderItem) {
|
||||||
folderItem = DefaultFolder.downloads();
|
folderItem = app.getPath('downloads');
|
||||||
}
|
}
|
||||||
|
|
||||||
let isSuccess = true;
|
let isSuccess = true;
|
||||||
|
@ -512,6 +519,23 @@ ipcMain.on(FileChannel.GetPath, async (event: IpcMainEvent, ...args: any[]) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on(
|
||||||
|
FileChannel.SelectDirectory,
|
||||||
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
dialog
|
||||||
|
.showOpenDialog(appWindow.browserWindow, {
|
||||||
|
defaultPath: app.getPath('home'),
|
||||||
|
properties: ['openDirectory']
|
||||||
|
})
|
||||||
|
.then(value => {
|
||||||
|
event.returnValue = value.filePaths[0];
|
||||||
|
})
|
||||||
|
.catch(reason => {
|
||||||
|
event.returnValue = undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
ipcMain.on(
|
ipcMain.on(
|
||||||
IdleStateChannel.StartCheck,
|
IdleStateChannel.StartCheck,
|
||||||
(event: IpcMainEvent, ...args: any[]) => {
|
(event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
import * as os from 'os';
|
|
||||||
import { execSync } from 'child_process';
|
|
||||||
import * as fse from 'fs-extra';
|
|
||||||
|
|
||||||
export class DefaultFolder {
|
|
||||||
static downloads(): string {
|
|
||||||
switch (os.platform()) {
|
|
||||||
case 'win32':
|
|
||||||
return `${process.env.USERPROFILE}/Downloads`;
|
|
||||||
case 'darwin':
|
|
||||||
return `${process.env.HOME}/Downloads`;
|
|
||||||
case 'linux': {
|
|
||||||
let dir: Buffer;
|
|
||||||
try {
|
|
||||||
dir = execSync('xdg-user-dir DOWNLOAD', { stdio: [0, 3, 3] });
|
|
||||||
} catch (_) {}
|
|
||||||
|
|
||||||
if (dir) {
|
|
||||||
return dir.toString('utf-8');
|
|
||||||
}
|
|
||||||
|
|
||||||
let stat: fse.Stats;
|
|
||||||
const homeDownloads = `${process.env.HOME}/Downloads`;
|
|
||||||
try {
|
|
||||||
stat = fse.statSync(homeDownloads);
|
|
||||||
} catch (_) {}
|
|
||||||
if (stat) {
|
|
||||||
return homeDownloads;
|
|
||||||
}
|
|
||||||
return '/tmp/';
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -65,7 +65,11 @@
|
||||||
<span class="mdi mdi-chat"></span>
|
<span class="mdi mdi-chat"></span>
|
||||||
대화
|
대화
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ucap-settings-chat class="setting-category"></ucap-settings-chat>
|
<ucap-settings-chat
|
||||||
|
[setting]="appUserInfo.settings.chat"
|
||||||
|
(changed)="onChangedChatSetting($event)"
|
||||||
|
class="setting-category"
|
||||||
|
></ucap-settings-chat>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,19 @@ import {
|
||||||
} 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';
|
||||||
import { map } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
import { DOCUMENT } from '@angular/common';
|
import { DOCUMENT } from '@angular/common';
|
||||||
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
||||||
|
import {
|
||||||
|
EnvironmentsInfo,
|
||||||
|
KEY_ENVIRONMENTS_INFO
|
||||||
|
} from '@app/types/environment.type';
|
||||||
import { environment } from '../../../../../environments/environment';
|
import { environment } from '../../../../../environments/environment';
|
||||||
import {
|
import {
|
||||||
GeneralSetting,
|
GeneralSetting,
|
||||||
Settings,
|
Settings,
|
||||||
NotificationSetting
|
NotificationSetting,
|
||||||
|
ChatSetting
|
||||||
} from '@ucap-webmessenger/ui-settings';
|
} from '@ucap-webmessenger/ui-settings';
|
||||||
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
@ -43,6 +48,7 @@ export interface MessengerSettingsDialogResult {}
|
||||||
export class MessengerSettingsDialogComponent implements OnInit {
|
export class MessengerSettingsDialogComponent implements OnInit {
|
||||||
loginRes: LoginResponse;
|
loginRes: LoginResponse;
|
||||||
sessionVerinfo: VersionInfo2Response;
|
sessionVerinfo: VersionInfo2Response;
|
||||||
|
environmentsInfo: EnvironmentsInfo;
|
||||||
|
|
||||||
modifiedSettings: Settings;
|
modifiedSettings: Settings;
|
||||||
|
|
||||||
|
@ -76,6 +82,9 @@ export class MessengerSettingsDialogComponent implements OnInit {
|
||||||
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
|
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
|
||||||
KEY_VER_INFO
|
KEY_VER_INFO
|
||||||
);
|
);
|
||||||
|
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
|
||||||
|
KEY_ENVIRONMENTS_INFO
|
||||||
|
);
|
||||||
this.loginRes = this.sessionStorageService.get<LoginResponse>(
|
this.loginRes = this.sessionStorageService.get<LoginResponse>(
|
||||||
KEY_LOGIN_RES_INFO
|
KEY_LOGIN_RES_INFO
|
||||||
);
|
);
|
||||||
|
@ -84,32 +93,59 @@ export class MessengerSettingsDialogComponent implements OnInit {
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
onChangedGeneralSetting(setting: GeneralSetting) {
|
onChangedGeneralSetting(setting: GeneralSetting) {
|
||||||
this.applySettings(this.modifiedSettings, {
|
this.modifiedSettings = this.applySettings(this.modifiedSettings, {
|
||||||
...this.appUserInfo.settings,
|
...this.appUserInfo.settings,
|
||||||
general: setting
|
general: setting
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangedNotificationSetting(setting: NotificationSetting) {
|
onChangedNotificationSetting(setting: NotificationSetting) {
|
||||||
this.applySettings(this.modifiedSettings, {
|
this.modifiedSettings = this.applySettings(this.modifiedSettings, {
|
||||||
...this.appUserInfo.settings,
|
...this.appUserInfo.settings,
|
||||||
notification: setting
|
notification: setting
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
onChangedChatSetting(setting: ChatSetting) {
|
||||||
if (choice) {
|
this.modifiedSettings = this.applySettings(this.modifiedSettings, {
|
||||||
if (ObjectUtil.equals(this.appUserInfo.settings, this.modifiedSettings)) {
|
...this.appUserInfo.settings,
|
||||||
// There is not modified settings.
|
chat: setting
|
||||||
return;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickChoice(choice: boolean): void {
|
||||||
|
if (choice) {
|
||||||
|
if (
|
||||||
|
!ObjectUtil.equals(this.appUserInfo.settings, this.modifiedSettings)
|
||||||
|
) {
|
||||||
|
this.optionProtocolService
|
||||||
|
.regUpdate({
|
||||||
|
absenceTime: this.modifiedSettings.presence.absenceTime,
|
||||||
|
deviceType: this.environmentsInfo.deviceType,
|
||||||
|
fontFamily: this.modifiedSettings.chat.fontFamily,
|
||||||
|
fontSize: this.modifiedSettings.chat.fontSize,
|
||||||
|
hrInformationLanguage: this.modifiedSettings.general.hrInfoLocale,
|
||||||
|
menuLanguage: this.modifiedSettings.general.locale,
|
||||||
|
mobileNotification: this.modifiedSettings.notification
|
||||||
|
.receiveForMobile,
|
||||||
|
notificationExposureTime: this.modifiedSettings.notification
|
||||||
|
.alertExposureTime,
|
||||||
|
notificationMethod: this.modifiedSettings.notification.method,
|
||||||
|
notificationMethod0: this.modifiedSettings.notification.method,
|
||||||
|
receiveNotification: this.modifiedSettings.notification.use,
|
||||||
|
timeZone: this.modifiedSettings.general.timezone,
|
||||||
|
timeZoneValue: '0'
|
||||||
|
})
|
||||||
|
.pipe(take(1))
|
||||||
|
.subscribe(res => {
|
||||||
this.appUserInfo.settings = this.modifiedSettings;
|
this.appUserInfo.settings = this.modifiedSettings;
|
||||||
this.localStorageService.encSet<AppUserInfo>(
|
this.localStorageService.encSet<AppUserInfo>(
|
||||||
KEY_APP_USER_INFO,
|
KEY_APP_USER_INFO,
|
||||||
this.appUserInfo,
|
this.appUserInfo,
|
||||||
environment.customConfig.appKey
|
environment.customConfig.appKey
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.applySettings(this.modifiedSettings, this.appUserInfo.settings);
|
this.applySettings(this.modifiedSettings, this.appUserInfo.settings);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +153,10 @@ export class MessengerSettingsDialogComponent implements OnInit {
|
||||||
this.dialogRef.close({});
|
this.dialogRef.close({});
|
||||||
}
|
}
|
||||||
|
|
||||||
private applySettings(oriSettings: Settings, modSettings: Settings) {
|
private applySettings(
|
||||||
|
oriSettings: Settings,
|
||||||
|
modSettings: Settings
|
||||||
|
): Settings {
|
||||||
if (oriSettings.general.appTheme !== modSettings.general.appTheme) {
|
if (oriSettings.general.appTheme !== modSettings.general.appTheme) {
|
||||||
this.renderer2.setAttribute(
|
this.renderer2.setAttribute(
|
||||||
this.document.body,
|
this.document.body,
|
||||||
|
@ -148,6 +187,6 @@ export class MessengerSettingsDialogComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
oriSettings = modSettings;
|
return modSettings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,6 @@ export class AppService {
|
||||||
deviceType = DeviceType.Web;
|
deviceType = DeviceType.Web;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info(
|
|
||||||
'platform is desktop ',
|
|
||||||
this.enviromentsService.desktop()
|
|
||||||
);
|
|
||||||
this.logger.info('native type is ', this.nativeService.type());
|
|
||||||
|
|
||||||
this.sessionStorageService.set<EnvironmentsInfo>(
|
this.sessionStorageService.set<EnvironmentsInfo>(
|
||||||
KEY_ENVIRONMENTS_INFO,
|
KEY_ENVIRONMENTS_INFO,
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,7 @@ export class AppAuthenticationService {
|
||||||
...environment.productConfig.defaultSettings,
|
...environment.productConfig.defaultSettings,
|
||||||
chat: {
|
chat: {
|
||||||
...environment.productConfig.defaultSettings.chat,
|
...environment.productConfig.defaultSettings.chat,
|
||||||
downloadPath: `${this.nativeService.getPath(
|
downloadPath: `${await this.nativeService.getPath(
|
||||||
'documents'
|
'documents'
|
||||||
)}/LG UCAP 받은 파일`
|
)}/LG UCAP 받은 파일`
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ import { LocalStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
||||||
|
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
import { NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppNotificationService {
|
export class AppNotificationService {
|
||||||
|
@ -183,10 +184,12 @@ export class AppNotificationService {
|
||||||
noti.message
|
noti.message
|
||||||
),
|
),
|
||||||
image: '',
|
image: '',
|
||||||
useSound:
|
useSound: [
|
||||||
'SOUND' === appUserInfo.settings.notification.method ||
|
NotificationMethod.Sound,
|
||||||
'SOUND_ALERT' ===
|
NotificationMethod.SoundAndAlert
|
||||||
appUserInfo.settings.notification.method
|
].some(
|
||||||
|
n => n === appUserInfo.settings.notification.method
|
||||||
|
)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
displayTime:
|
displayTime:
|
||||||
|
@ -535,9 +538,10 @@ export class AppNotificationService {
|
||||||
title: '쪽지가 도착했습니다.',
|
title: '쪽지가 도착했습니다.',
|
||||||
contents: noti.text,
|
contents: noti.text,
|
||||||
image: noti.senderInfo.profileImageFile,
|
image: noti.senderInfo.profileImageFile,
|
||||||
useSound:
|
useSound: [
|
||||||
'SOUND' === appUserInfo.settings.notification.method ||
|
NotificationMethod.Sound,
|
||||||
'SOUND_ALERT' === appUserInfo.settings.notification.method
|
NotificationMethod.SoundAndAlert
|
||||||
|
].some(n => n === appUserInfo.settings.notification.method)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
displayTime:
|
displayTime:
|
||||||
|
|
|
@ -11,12 +11,7 @@ export const reducer = createReducer(
|
||||||
reg: action.res
|
reg: action.res
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
on(regUpdateSuccess, (state, action) => {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
reg: action.res
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
messageApiUrls,
|
messageApiUrls,
|
||||||
promptUrls
|
promptUrls
|
||||||
} from './environment.type';
|
} from './environment.type';
|
||||||
import { DeviceType } from '@ucap-webmessenger/core';
|
import { DeviceType, NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
export const environment: Environment = {
|
export const environment: Environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
@ -49,7 +49,7 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
use: true,
|
use: true,
|
||||||
method: 'SOUND_ALERT',
|
method: NotificationMethod.SoundAndAlert,
|
||||||
alertExposureTime: 5,
|
alertExposureTime: 5,
|
||||||
receiveForMobile: false,
|
receiveForMobile: false,
|
||||||
receiveForMessage: false
|
receiveForMessage: false
|
||||||
|
@ -58,6 +58,9 @@ export const environment: Environment = {
|
||||||
fontFamily: 'Malgun Gothic',
|
fontFamily: 'Malgun Gothic',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
downloadPath: undefined
|
downloadPath: undefined
|
||||||
|
},
|
||||||
|
presence: {
|
||||||
|
absenceTime: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
messageApiUrls,
|
messageApiUrls,
|
||||||
promptUrls
|
promptUrls
|
||||||
} from './environment.type';
|
} from './environment.type';
|
||||||
import { DeviceType } from '@ucap-webmessenger/core';
|
import { DeviceType, NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
export const environment: Environment = {
|
export const environment: Environment = {
|
||||||
production: true,
|
production: true,
|
||||||
|
@ -49,7 +49,7 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
use: true,
|
use: true,
|
||||||
method: 'SOUND_ALERT',
|
method: NotificationMethod.SoundAndAlert,
|
||||||
alertExposureTime: 5,
|
alertExposureTime: 5,
|
||||||
receiveForMobile: false,
|
receiveForMobile: false,
|
||||||
receiveForMessage: false
|
receiveForMessage: false
|
||||||
|
@ -58,6 +58,9 @@ export const environment: Environment = {
|
||||||
fontFamily: 'Malgun Gothic',
|
fontFamily: 'Malgun Gothic',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
downloadPath: undefined
|
downloadPath: undefined
|
||||||
|
},
|
||||||
|
presence: {
|
||||||
|
absenceTime: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
messageApiUrls,
|
messageApiUrls,
|
||||||
promptUrls
|
promptUrls
|
||||||
} from './environment.type';
|
} from './environment.type';
|
||||||
import { DeviceType } from '@ucap-webmessenger/core';
|
import { DeviceType, NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
export const environment: Environment = {
|
export const environment: Environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
@ -49,7 +49,7 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
use: true,
|
use: true,
|
||||||
method: 'SOUND_ALERT',
|
method: NotificationMethod.SoundAndAlert,
|
||||||
alertExposureTime: 5,
|
alertExposureTime: 5,
|
||||||
receiveForMobile: false,
|
receiveForMobile: false,
|
||||||
receiveForMessage: false
|
receiveForMessage: false
|
||||||
|
@ -58,6 +58,9 @@ export const environment: Environment = {
|
||||||
fontFamily: 'Malgun Gothic',
|
fontFamily: 'Malgun Gothic',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
downloadPath: undefined
|
downloadPath: undefined
|
||||||
|
},
|
||||||
|
presence: {
|
||||||
|
absenceTime: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
messageApiUrls,
|
messageApiUrls,
|
||||||
promptUrls
|
promptUrls
|
||||||
} from './environment.type';
|
} from './environment.type';
|
||||||
import { DeviceType } from '@ucap-webmessenger/core';
|
import { DeviceType, NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
export const environment: Environment = {
|
export const environment: Environment = {
|
||||||
production: true,
|
production: true,
|
||||||
|
@ -49,7 +49,7 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
use: true,
|
use: true,
|
||||||
method: 'SOUND_ALERT',
|
method: NotificationMethod.SoundAndAlert,
|
||||||
alertExposureTime: 5,
|
alertExposureTime: 5,
|
||||||
receiveForMobile: false,
|
receiveForMobile: false,
|
||||||
receiveForMessage: false
|
receiveForMessage: false
|
||||||
|
@ -58,6 +58,9 @@ export const environment: Environment = {
|
||||||
fontFamily: 'Malgun Gothic',
|
fontFamily: 'Malgun Gothic',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
downloadPath: undefined
|
downloadPath: undefined
|
||||||
|
},
|
||||||
|
presence: {
|
||||||
|
absenceTime: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
|
|
@ -167,6 +167,12 @@ export class BrowserNativeService extends NativeService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectDirectory(): Promise<string> {
|
||||||
|
return new Promise<string>((resolve, reject) => {
|
||||||
|
resolve('');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
windowStateChanged(): Observable<WindowState> {
|
windowStateChanged(): Observable<WindowState> {
|
||||||
return new Observable<WindowState>(subscriber => {
|
return new Observable<WindowState>(subscriber => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -269,6 +269,16 @@ export class ElectronNativeService implements NativeService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectDirectory(): Promise<string> {
|
||||||
|
return new Promise<string>((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
resolve(this.ipcRenderer.sendSync(FileChannel.SelectDirectory));
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
windowStateChanged(): Observable<WindowState> {
|
windowStateChanged(): Observable<WindowState> {
|
||||||
if (!this.windowStateChangedSubject) {
|
if (!this.windowStateChangedSubject) {
|
||||||
this.windowStateChangedSubject = new Subject<WindowState>();
|
this.windowStateChangedSubject = new Subject<WindowState>();
|
||||||
|
|
|
@ -32,7 +32,8 @@ export enum FileChannel {
|
||||||
ShowImageViewer = 'UCAP::file::showImageViewer',
|
ShowImageViewer = 'UCAP::file::showImageViewer',
|
||||||
SaveFile = 'UCAP::file::saveFile',
|
SaveFile = 'UCAP::file::saveFile',
|
||||||
ReadFile = 'UCAP::file::readFile',
|
ReadFile = 'UCAP::file::readFile',
|
||||||
GetPath = 'UCAP::file::getPath'
|
GetPath = 'UCAP::file::getPath',
|
||||||
|
SelectDirectory = 'UCAP::file::selectDirectory'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum WindowStateChannel {
|
export enum WindowStateChannel {
|
||||||
|
|
|
@ -54,6 +54,7 @@ export abstract class NativeService {
|
||||||
): Promise<boolean>;
|
): Promise<boolean>;
|
||||||
abstract openTargetItem(filePath?: string): Promise<boolean>;
|
abstract openTargetItem(filePath?: string): Promise<boolean>;
|
||||||
abstract getPath(name: NativePathName): Promise<string>;
|
abstract getPath(name: NativePathName): Promise<string>;
|
||||||
|
abstract selectDirectory(): Promise<string>;
|
||||||
|
|
||||||
abstract windowStateChanged(): Observable<WindowState>;
|
abstract windowStateChanged(): Observable<WindowState>;
|
||||||
abstract windowClose(): void;
|
abstract windowClose(): void;
|
||||||
|
|
|
@ -15,27 +15,27 @@ export interface RegUpdateRequest extends ProtocolRequest {
|
||||||
// 0 알림방법(n)
|
// 0 알림방법(n)
|
||||||
notificationMethod: NotificationMethod;
|
notificationMethod: NotificationMethod;
|
||||||
// 1 모바일알림(n)
|
// 1 모바일알림(n)
|
||||||
mobileNotification: number;
|
mobileNotification: boolean;
|
||||||
// 2 폰트종류(s)
|
// 2 폰트종류(s)
|
||||||
fontFamily: string;
|
fontFamily: string;
|
||||||
// 3 폰트크기(n)
|
// 3 폰트크기(n)
|
||||||
fontSize: number;
|
fontSize: number;
|
||||||
// 4 알림받음/받지않음(n)
|
// 4 알림받음/받지않음(n)
|
||||||
receiveNotification: number;
|
receiveNotification: boolean;
|
||||||
// 5 알림방법(n)
|
// 5 알림방법(n)
|
||||||
notificationMethod0: number;
|
notificationMethod0: number;
|
||||||
// 6 알림창 설정(n)
|
// 6 알림창 설정(n)
|
||||||
notificationExposureTime: number;
|
notificationExposureTime: number;
|
||||||
// 7 타임존(s)
|
// 7 타임존(s)
|
||||||
timeZone: string;
|
timeZone: string;
|
||||||
// 8 타임존값(s)
|
// 8 타임존(s)
|
||||||
timeZoneValue: string;
|
timeZoneValue: string;
|
||||||
// 9 부재중시간설정(n)
|
// 9 부재중시간설정(n)
|
||||||
absenceTime: number;
|
absenceTime: number;
|
||||||
// 10 메뉴 언어(n)
|
// 10 메뉴 언어(n)
|
||||||
menuLanguage: number;
|
menuLanguage: string;
|
||||||
// 11 인사정보 언어(n)
|
// 11 인사정보 언어(n)
|
||||||
hrInformationLanguage: number;
|
hrInformationLanguage: string;
|
||||||
deviceType: DeviceType;
|
deviceType: DeviceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,13 +43,13 @@ export interface RegUpdateResponse extends ProtocolResponse {
|
||||||
// 0 알림방법(n)
|
// 0 알림방법(n)
|
||||||
notificationMethod?: NotificationMethod;
|
notificationMethod?: NotificationMethod;
|
||||||
// 1 모바일알림(n)
|
// 1 모바일알림(n)
|
||||||
mobileNotification?: number;
|
mobileNotification?: boolean;
|
||||||
// 2 폰트종류(s)
|
// 2 폰트종류(s)
|
||||||
fontFamily?: string;
|
fontFamily?: string;
|
||||||
// 3 폰트크기(n)
|
// 3 폰트크기(n)
|
||||||
fontSize?: number;
|
fontSize?: number;
|
||||||
// 4 알림받음/받지않음(n)
|
// 4 알림받음/받지않음(n)
|
||||||
receiveNotification?: number;
|
receiveNotification?: boolean;
|
||||||
// 5 알림방법(n)
|
// 5 알림방법(n)
|
||||||
notificationMethod0?: number;
|
notificationMethod0?: number;
|
||||||
// 6 알림창 설정(n)
|
// 6 알림창 설정(n)
|
||||||
|
@ -61,9 +61,9 @@ export interface RegUpdateResponse extends ProtocolResponse {
|
||||||
// 9 부재중시간설정(n)
|
// 9 부재중시간설정(n)
|
||||||
absenceTime?: number;
|
absenceTime?: number;
|
||||||
// 10 메뉴 언어(n)
|
// 10 메뉴 언어(n)
|
||||||
menuLanguage?: number;
|
menuLanguage?: string;
|
||||||
// 11 인사정보 언어(n)
|
// 11 인사정보 언어(n)
|
||||||
hrInformationLanguage?: number;
|
hrInformationLanguage?: string;
|
||||||
// 12 단말타입(s)
|
// 12 단말타입(s)
|
||||||
deviceType?: DeviceType;
|
deviceType?: DeviceType;
|
||||||
// 13 번역키
|
// 13 번역키
|
||||||
|
@ -81,7 +81,7 @@ export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.Integer,
|
type: PacketBodyValue.Integer,
|
||||||
value: req.mobileNotification
|
value: req.mobileNotification ? 1 : 0
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.String,
|
type: PacketBodyValue.String,
|
||||||
|
@ -93,7 +93,7 @@ export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.Integer,
|
type: PacketBodyValue.Integer,
|
||||||
value: req.receiveNotification
|
value: req.receiveNotification ? 1 : 0
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.Integer,
|
type: PacketBodyValue.Integer,
|
||||||
|
@ -116,11 +116,11 @@ export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
|
||||||
value: req.absenceTime
|
value: req.absenceTime
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.Integer,
|
type: PacketBodyValue.String,
|
||||||
value: req.menuLanguage
|
value: req.menuLanguage
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
type: PacketBodyValue.Integer,
|
type: PacketBodyValue.String,
|
||||||
value: req.hrInformationLanguage
|
value: req.hrInformationLanguage
|
||||||
});
|
});
|
||||||
bodyList.push({
|
bodyList.push({
|
||||||
|
@ -136,10 +136,10 @@ export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = (
|
||||||
) => {
|
) => {
|
||||||
return decodeProtocolMessage(message, {
|
return decodeProtocolMessage(message, {
|
||||||
notificationMethod: message.bodyList[0] as NotificationMethod,
|
notificationMethod: message.bodyList[0] as NotificationMethod,
|
||||||
mobileNotification: message.bodyList[1],
|
mobileNotification: message.bodyList[1] === 1 ? true : false,
|
||||||
fontFamily: message.bodyList[2],
|
fontFamily: message.bodyList[2],
|
||||||
fontSize: message.bodyList[3],
|
fontSize: message.bodyList[3],
|
||||||
receiveNotification: message.bodyList[4],
|
receiveNotification: message.bodyList[4] === 1 ? true : false,
|
||||||
notificationMethod0: message.bodyList[5],
|
notificationMethod0: message.bodyList[5],
|
||||||
notificationExposureTime: message.bodyList[6],
|
notificationExposureTime: message.bodyList[6],
|
||||||
timeZone: message.bodyList[7],
|
timeZone: message.bodyList[7],
|
||||||
|
|
|
@ -167,6 +167,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fileInput.nativeElement.value = '';
|
self.fileInput.nativeElement.value = '';
|
||||||
|
this.fileInput.nativeElement.onchange = undefined;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
<span class="item-input">
|
<span class="item-input">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select
|
<mat-select
|
||||||
[value]="setting.fontSize"
|
value="{{ setting.fontSize }}"
|
||||||
(selectionChange)="onSelectionChangeFontSize($event)"
|
(selectionChange)="onSelectionChangeFontSize($event)"
|
||||||
>
|
>
|
||||||
<mat-option
|
<mat-option
|
||||||
*ngFor="let fontSize of [8, 9, 10, 11, 12, 13, 14, 15, 16, 18]"
|
*ngFor="let fontSize of [8, 9, 10, 11, 12, 13, 14, 15, 16, 18]"
|
||||||
value="{{ fontSize }}"
|
value="{{ fontSize }}"
|
||||||
>
|
>
|
||||||
fontSize
|
{{ fontSize }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -37,11 +37,16 @@
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<h1 mat-subheader>파일 전송</h1>
|
<h1 mat-subheader *ngIf="_isNodeWebkit">파일 전송</h1>
|
||||||
<mat-list-item>
|
<mat-list-item *ngIf="_isNodeWebkit">
|
||||||
<mat-form-field fxFlexFill>
|
<mat-form-field fxFlexFill>
|
||||||
<input matInput placeholder="다운로드 폴더" value="" readonly />
|
<input
|
||||||
<input type="file" #downloadPathInput style="display: none" />
|
matInput
|
||||||
|
placeholder="다운로드 폴더"
|
||||||
|
[value]="setting.downloadPath"
|
||||||
|
readonly
|
||||||
|
(click)="onClickDownloadPath()"
|
||||||
|
/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
</mat-list>
|
</mat-list>
|
||||||
|
|
|
@ -4,7 +4,10 @@ import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Input,
|
Input,
|
||||||
Output,
|
Output,
|
||||||
EventEmitter
|
EventEmitter,
|
||||||
|
ViewChild,
|
||||||
|
ElementRef,
|
||||||
|
Inject
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { NGXLogger } from 'ngx-logger';
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { MatSelectChange } from '@angular/material';
|
import { MatSelectChange } from '@angular/material';
|
||||||
|
@ -12,6 +15,7 @@ import { MatSelectChange } from '@angular/material';
|
||||||
import { EnviromentsService } from '@ucap-webmessenger/enviroments';
|
import { EnviromentsService } from '@ucap-webmessenger/enviroments';
|
||||||
|
|
||||||
import { ChatSetting } from '../models/settings';
|
import { ChatSetting } from '../models/settings';
|
||||||
|
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-settings-chat',
|
selector: 'ucap-settings-chat',
|
||||||
|
@ -25,14 +29,17 @@ export class ChatComponent implements OnInit {
|
||||||
@Output()
|
@Output()
|
||||||
changed = new EventEmitter<ChatSetting>();
|
changed = new EventEmitter<ChatSetting>();
|
||||||
|
|
||||||
private readonly isDesktop = false;
|
// tslint:disable-next-line: variable-name
|
||||||
private readonly isBrowser = false;
|
readonly _isNodeWebkit: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private enviromentsService: EnviromentsService,
|
private enviromentsService: EnviromentsService,
|
||||||
|
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
private logger: NGXLogger
|
private logger: NGXLogger
|
||||||
) {}
|
) {
|
||||||
|
this._isNodeWebkit = this.enviromentsService.nodeWebkit();
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
|
@ -44,6 +51,16 @@ export class ChatComponent implements OnInit {
|
||||||
this.emit({ ...this.setting, fontSize: Number(event.value) });
|
this.emit({ ...this.setting, fontSize: Number(event.value) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickDownloadPath() {
|
||||||
|
this.logger.debug('onClickDownloadPath');
|
||||||
|
this.nativeService
|
||||||
|
.selectDirectory()
|
||||||
|
.then(path => {
|
||||||
|
this.emit({ ...this.setting, downloadPath: path });
|
||||||
|
})
|
||||||
|
.catch(reason => {});
|
||||||
|
}
|
||||||
|
|
||||||
private emit(setting: ChatSetting) {
|
private emit(setting: ChatSetting) {
|
||||||
this.setting = setting;
|
this.setting = setting;
|
||||||
this.changed.emit(this.setting);
|
this.changed.emit(this.setting);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { NotificationMethod } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
export interface GeneralSetting {
|
export interface GeneralSetting {
|
||||||
appTheme: string;
|
appTheme: string;
|
||||||
autoLaunch: boolean;
|
autoLaunch: boolean;
|
||||||
|
@ -11,7 +13,7 @@ export interface GeneralSetting {
|
||||||
|
|
||||||
export interface NotificationSetting {
|
export interface NotificationSetting {
|
||||||
use: boolean;
|
use: boolean;
|
||||||
method: 'SOUND' | 'ALERT' | 'SOUND_ALERT';
|
method: NotificationMethod;
|
||||||
alertExposureTime: number;
|
alertExposureTime: number;
|
||||||
receiveForMobile: boolean;
|
receiveForMobile: boolean;
|
||||||
receiveForMessage: boolean;
|
receiveForMessage: boolean;
|
||||||
|
@ -23,8 +25,13 @@ export interface ChatSetting {
|
||||||
downloadPath: string;
|
downloadPath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PresenceSetting {
|
||||||
|
absenceTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
general: GeneralSetting;
|
general: GeneralSetting;
|
||||||
notification: NotificationSetting;
|
notification: NotificationSetting;
|
||||||
chat: ChatSetting;
|
chat: ChatSetting;
|
||||||
|
presence: PresenceSetting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class LocalStorageService extends StorageService {
|
export class LocalStorageService extends StorageService {
|
||||||
constructor() {
|
constructor(logger: NGXLogger) {
|
||||||
super(localStorage);
|
super(localStorage, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SessionStorageService extends StorageService {
|
export class SessionStorageService extends StorageService {
|
||||||
constructor() {
|
constructor(logger: NGXLogger) {
|
||||||
super(sessionStorage);
|
super(sessionStorage, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,10 @@ import { fromEvent, Observable } from 'rxjs';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
|
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
|
|
||||||
export class StorageService {
|
export class StorageService {
|
||||||
constructor(private storage: Storage) {}
|
constructor(private storage: Storage, private logger: NGXLogger) {}
|
||||||
|
|
||||||
get<T>(key: string): T | null {
|
get<T>(key: string): T | null {
|
||||||
return StorageUtil.get(this.storage, key);
|
return StorageUtil.get(this.storage, key);
|
||||||
|
@ -38,6 +39,7 @@ export class StorageService {
|
||||||
expiredAt: number = 0,
|
expiredAt: number = 0,
|
||||||
expiredUnit: ExpiredUnit = 'd'
|
expiredUnit: ExpiredUnit = 'd'
|
||||||
) {
|
) {
|
||||||
|
this.logger.debug('encSet key:', key, ' value:', value);
|
||||||
const json = JSON.stringify(value);
|
const json = JSON.stringify(value);
|
||||||
const encrypted = CryptoJS.AES.encrypt(json, secretPassphrase);
|
const encrypted = CryptoJS.AES.encrypt(json, secretPassphrase);
|
||||||
return StorageUtil.set(
|
return StorageUtil.set(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user