diff --git a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts
index d14cf7a6..bd099cd9 100644
--- a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts
+++ b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts
@@ -46,7 +46,11 @@ export class AppAutoLoginGuard implements CanActivate {
'PERSON_LOGOUT'
);
- if (!!appUserInfo && appUserInfo.autoLogin && !personLogout) {
+ if (
+ !!appUserInfo &&
+ appUserInfo.settings.general.autoLogin &&
+ !personLogout
+ ) {
this.store.dispatch(
AuthenticationStore.webLogin({
loginInfo: {
@@ -56,7 +60,7 @@ export class AppAutoLoginGuard implements CanActivate {
loginPw: appUserInfo.loginPw
},
rememberMe: appUserInfo.rememberMe,
- autoLogin: appUserInfo.autoLogin
+ autoLogin: true
})
);
resolve(false);
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html
index e919a2a3..c9020572 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html
@@ -49,7 +49,32 @@
- {{ getRoomName() }}
+
+ 대화방명을 가져오고 있습니다..
+
+
+
+
+ MyTalk
+
+
+ {{ _roomUserInfos | ucapTranslate: 'name':',' }}
+
+
+
+ {{ roomInfo.roomName }}
+
+
+ {{ _roomUserInfos | ucapTranslate: 'name':',' }}
+
+
+
+
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts
index 2e95f086..8b9b001e 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts
@@ -161,6 +161,8 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
snackBarPreviewEvent: MatSnackBarRef
;
+ RoomType = RoomType;
+
constructor(
private store: Store,
private sessionStorageService: SessionStorageService,
@@ -296,36 +298,14 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.selectedSticker = undefined;
}
- getRoomName() {
- if (!this.roomInfo || !this.userInfoList) {
- return '대화방명을 가져오고 있습니다..';
- }
-
- switch (this.roomInfo.roomType) {
- case RoomType.Mytalk:
- return 'MyTalk';
- case RoomType.Bot:
- case RoomType.Allim:
- return this.userInfoList
- .filter(user => user.seq !== this.loginRes.userSeq && user.isJoinRoom)
- .map(user => user.name);
- }
-
- if (!!this.roomInfo.roomName && '' !== this.roomInfo.roomName.trim()) {
- return this.roomInfo.roomName;
- } else {
- return this.userInfoList
- .filter(user => {
- if (this.roomInfo.roomType === RoomType.Single) {
- return user.seq !== this.loginRes.userSeq;
- } else {
- return user.isJoinRoom;
- }
- })
- .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))
- .map(user => user.name)
- .join(',');
- }
+ get _roomUserInfos() {
+ return this.userInfoList
+ .filter(roomUserInfo => {
+ return (
+ this.loginRes.userSeq !== roomUserInfo.seq && roomUserInfo.isJoinRoom
+ );
+ })
+ .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
}
/** 대화전송 가능한 방인지 판단 */
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts
index 69931388..9ba29dd6 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts
@@ -8,7 +8,10 @@ import {
import { Store } from '@ngrx/store';
-import { DialogService } from '@ucap-webmessenger/ui';
+import {
+ DialogService,
+ TranslateService as UCapTranslateService
+} from '@ucap-webmessenger/ui';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { map } from 'rxjs/operators';
@@ -44,6 +47,7 @@ export class MessengerSettingsDialogComponent implements OnInit {
private dialogService: DialogService,
private sessionStorageService: SessionStorageService,
private localStorageService: LocalStorageService,
+ private ucapTranslateService: UCapTranslateService,
private store: Store,
@Inject(DOCUMENT) private document: Document,
private renderer2: Renderer2
@@ -71,6 +75,13 @@ export class MessengerSettingsDialogComponent implements OnInit {
setting.appTheme
);
}
+ if (this.appUserInfo.settings.general.locale !== setting.locale) {
+ }
+ if (
+ this.appUserInfo.settings.general.hrInfoLocale !== setting.hrInfoLocale
+ ) {
+ this.ucapTranslateService.use(setting.hrInfoLocale);
+ }
this.applySettings({ ...this.appUserInfo.settings, general: setting });
}
diff --git a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html
index 326a4876..b49e4b82 100644
--- a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html
+++ b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html
@@ -9,7 +9,7 @@
[companyCode]="appUserInfo?.companyCode"
[loginId]="appUserInfo?.loginId"
[rememberMe]="appUserInfo?.rememberMe"
- [autoLogin]="appUserInfo?.autoLogin"
+ [autoLogin]="appUserInfo?.settings?.general?.autoLogin"
[useRememberMe]="useRememberMe"
[useAutoLogin]="useAutoLogin"
(login)="onLogin($event)"
diff --git a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts
index 2feb3a2c..16cf8472 100644
--- a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts
+++ b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts
@@ -42,6 +42,8 @@ import { NGXLogger } from 'ngx-logger';
import { QueryProtocolService } from '@ucap-webmessenger/protocol-query';
import { OptionProtocolService } from '@ucap-webmessenger/protocol-option';
+import { TranslateService as UCapTranslateService } from '@ucap-webmessenger/ui';
+
import * as AppStore from '@app/store';
import * as CompanyStore from '@app/store/setting/company';
import * as VersionInfoStore from '@app/store/setting/version-info';
diff --git a/projects/ucap-webmessenger-app/src/app/services/app.service.ts b/projects/ucap-webmessenger-app/src/app/services/app.service.ts
index 4cb57f1e..bd2b3dae 100644
--- a/projects/ucap-webmessenger-app/src/app/services/app.service.ts
+++ b/projects/ucap-webmessenger-app/src/app/services/app.service.ts
@@ -6,6 +6,8 @@ import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { AppNotificationService } from './notification.service';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { AppNativeService } from './native.service';
+import { TranslateService as UCapTranslateService } from '@ucap-webmessenger/ui';
+import { TranslateService } from '@ngx-translate/core';
@Injectable()
export class AppService {
@@ -14,8 +16,16 @@ export class AppService {
private sessionStorageService: SessionStorageService,
private appNotificationService: AppNotificationService,
private appNativeService: AppNativeService,
+ // private translateService: TranslateService,
+ private ucapTranslateService: UCapTranslateService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
- ) {}
+ ) {
+ // this.translateService.setDefaultLang('ko');
+ // this.translateService.use('ko');
+
+ this.ucapTranslateService.setDefaultLang('ko');
+ this.ucapTranslateService.use('ko');
+ }
public postInit(): Promise {
const initPromise = new Promise((resolve, reject) => {
diff --git a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts
index 5d581e1e..bfecc867 100644
--- a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts
+++ b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts
@@ -13,6 +13,7 @@ import {
KEY_URL_INFO
} from '../types';
import { PasswordUtil } from '@ucap-webmessenger/pi';
+
import { DaesangCipherService } from '@ucap-webmessenger/daesang';
import { environment } from '../../environments/environment';
@@ -73,9 +74,9 @@ export class AppAuthenticationService {
if (rememberMe || autoLogin) {
appUserInfo = {
...appUserInfo,
- rememberMe,
- autoLogin
+ rememberMe
};
+ appUserInfo.settings.general.autoLogin = autoLogin;
}
this.localStorageService.encSet(
diff --git a/projects/ucap-webmessenger-app/src/app/store/setting/init/effects.ts b/projects/ucap-webmessenger-app/src/app/store/setting/init/effects.ts
index 4092a83c..dd7f4110 100644
--- a/projects/ucap-webmessenger-app/src/app/store/setting/init/effects.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/setting/init/effects.ts
@@ -1,6 +1,38 @@
import { Injectable } from '@angular/core';
+import { Actions, createEffect, ofType } from '@ngrx/effects';
+
+import { TranslateService as UCapTranslateService } from '@ucap-webmessenger/ui';
+import { map, tap } from 'rxjs/operators';
+
+import * as AuthenticationStore from '@app/store/account/authentication';
+import { LocalStorageService } from '@ucap-webmessenger/web-storage';
+import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
+
+import { environment } from '../../../../environments/environment';
@Injectable()
export class Effects {
- constructor() {}
+ postLogin$ = createEffect(
+ () =>
+ this.actions$.pipe(
+ ofType(AuthenticationStore.postLogin),
+ map(action => action.loginRes),
+ tap(async loginRes => {
+ const appUserInfo = this.localStorageService.encGet(
+ KEY_APP_USER_INFO,
+ environment.customConfig.appKey
+ );
+
+ this.ucapTranslateService.use(
+ appUserInfo.settings.general.hrInfoLocale
+ );
+ })
+ ),
+ { dispatch: false }
+ );
+ constructor(
+ private actions$: Actions,
+ private ucapTranslateService: UCapTranslateService,
+ private localStorageService: LocalStorageService
+ ) {}
}
diff --git a/projects/ucap-webmessenger-app/src/app/types/app-user-info.type.ts b/projects/ucap-webmessenger-app/src/app/types/app-user-info.type.ts
index 622f8c67..16be3b5c 100644
--- a/projects/ucap-webmessenger-app/src/app/types/app-user-info.type.ts
+++ b/projects/ucap-webmessenger-app/src/app/types/app-user-info.type.ts
@@ -7,7 +7,6 @@ export interface AppUserInfo {
loginId?: string;
loginPw?: string;
rememberMe?: boolean;
- autoLogin?: boolean;
companyCode?: string;
companyGroupType?: string;
localeCode?: LocaleCode;
diff --git a/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts b/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts
index bfbf3269..34fe09f6 100644
--- a/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts
+++ b/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts
@@ -43,6 +43,7 @@ export const environment: Environment = {
autoStart: true,
continueRunWhenClose: true,
locale: 'ko',
+ hrInfoLocale: 'ko',
startBackgroudMode: false,
timezone: '+9'
},
diff --git a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts
index 7e0da8af..7e936e74 100644
--- a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts
+++ b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts
@@ -43,6 +43,7 @@ export const environment: Environment = {
autoStart: true,
continueRunWhenClose: true,
locale: 'ko',
+ hrInfoLocale: 'ko',
startBackgroudMode: false,
timezone: '+9'
},
diff --git a/projects/ucap-webmessenger-app/src/environments/environment.dev.ts b/projects/ucap-webmessenger-app/src/environments/environment.dev.ts
index 025ba9a5..01aab1f6 100644
--- a/projects/ucap-webmessenger-app/src/environments/environment.dev.ts
+++ b/projects/ucap-webmessenger-app/src/environments/environment.dev.ts
@@ -43,6 +43,7 @@ export const environment: Environment = {
autoStart: true,
continueRunWhenClose: true,
locale: 'ko',
+ hrInfoLocale: 'ko',
startBackgroudMode: false,
timezone: '+9'
},
diff --git a/projects/ucap-webmessenger-app/src/environments/environment.prod.ts b/projects/ucap-webmessenger-app/src/environments/environment.prod.ts
index 8b544359..da298dcb 100644
--- a/projects/ucap-webmessenger-app/src/environments/environment.prod.ts
+++ b/projects/ucap-webmessenger-app/src/environments/environment.prod.ts
@@ -43,6 +43,7 @@ export const environment: Environment = {
autoStart: true,
continueRunWhenClose: true,
locale: 'ko',
+ hrInfoLocale: 'ko',
startBackgroudMode: false,
timezone: '+9'
},
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.html b/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.html
index edd9a963..b450443f 100644
--- a/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.html
+++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tree.component.html
@@ -39,7 +39,9 @@
- {{ node.name }}
+
+ {{ node.deptInfo | ucapTranslate: 'name' }}
+
@@ -83,7 +85,9 @@
{{ treeControl.isExpanded(node) ? 'remove' : 'add' }}
-
{{ node.name }}
+
{{
+ node.deptInfo | ucapTranslate: 'name'
+ }}
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/pipes/translate.pipe.ts b/projects/ucap-webmessenger-ui-organization/src/lib/pipes/translate.pipe.ts
deleted file mode 100644
index 52c06ec2..00000000
--- a/projects/ucap-webmessenger-ui-organization/src/lib/pipes/translate.pipe.ts
+++ /dev/null
@@ -1,164 +0,0 @@
-import {
- ChangeDetectorRef,
- Injectable,
- OnDestroy,
- Pipe,
- PipeTransform
-} from '@angular/core';
-import {
- LangChangeEvent,
- TranslateService,
- TranslationChangeEvent
-} from '@ngx-translate/core';
-import { ObjectUtil } from '@ucap-webmessenger/core';
-import { Subscription } from 'rxjs';
-
-@Injectable()
-@Pipe({
- name: 'ucap-organization-translate',
- pure: false // required to update the value when the promise is resolved
-})
-export class TranslatePipe implements PipeTransform, OnDestroy {
- value = '';
- lastKey: string;
- lastParams: any[];
- onTranslationChange: Subscription;
- onLangChange: Subscription;
- onDefaultLangChange: Subscription;
-
- constructor(
- private translate: TranslateService,
- private changeDetectorRef: ChangeDetectorRef
- ) {}
-
- updateValue(
- key: string,
- interpolateParams?: object,
- translations?: any
- ): void {
- const onTranslation = (res: string) => {
- this.value = res !== undefined ? res : key;
- this.lastKey = key;
- this.changeDetectorRef.markForCheck();
- };
- if (translations) {
- const res = this.translate.getParsedResult(
- translations,
- key,
- interpolateParams
- );
- if (typeof res.subscribe === 'function') {
- res.subscribe(onTranslation);
- } else {
- onTranslation(res);
- }
- }
- this.translate.get(key, interpolateParams).subscribe(onTranslation);
- }
-
- transform(query: string, ...args: any[]): any {
- if (!query || query.length === 0) {
- return query;
- }
-
- // if we ask another time for the same key, return the last value
- if (
- ObjectUtil.equals(query, this.lastKey) &&
- ObjectUtil.equals(args, this.lastParams)
- ) {
- return this.value;
- }
-
- let interpolateParams: object;
- if (!!args[0] && args.length) {
- if (typeof args[0] === 'string' && args[0].length) {
- // we accept objects written in the template such as {n:1}, {'n':1}, {n:'v'}
- // which is why we might need to change it to real JSON objects such as {"n":1} or {"n":"v"}
- const validArgs: string = args[0]
- .replace(/(\')?([a-zA-Z0-9_]+)(\')?(\s)?:/g, '"$2":')
- .replace(/:(\s)?(\')(.*?)(\')/g, ':"$3"');
- try {
- interpolateParams = JSON.parse(validArgs);
- } catch (e) {
- throw new SyntaxError(
- `Wrong parameter in TranslatePipe. Expected a valid Object, received: ${args[0]}`
- );
- }
- } else if (typeof args[0] === 'object' && !Array.isArray(args[0])) {
- interpolateParams = args[0];
- }
- }
-
- // store the query, in case it changes
- this.lastKey = query;
-
- // store the params, in case they change
- this.lastParams = args;
-
- // set the value
- this.updateValue(query, interpolateParams);
-
- // if there is a subscription to onLangChange, clean it
- this._dispose();
-
- // subscribe to onTranslationChange event, in case the translations change
- if (!this.onTranslationChange) {
- this.onTranslationChange = this.translate.onTranslationChange.subscribe(
- (event: TranslationChangeEvent) => {
- if (this.lastKey && event.lang === this.translate.currentLang) {
- this.lastKey = null;
- this.updateValue(query, interpolateParams, event.translations);
- }
- }
- );
- }
-
- // subscribe to onLangChange event, in case the language changes
- if (!this.onLangChange) {
- this.onLangChange = this.translate.onLangChange.subscribe(
- (event: LangChangeEvent) => {
- if (this.lastKey) {
- this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated
- this.updateValue(query, interpolateParams, event.translations);
- }
- }
- );
- }
-
- // subscribe to onDefaultLangChange event, in case the default language changes
- if (!this.onDefaultLangChange) {
- this.onDefaultLangChange = this.translate.onDefaultLangChange.subscribe(
- () => {
- if (this.lastKey) {
- this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated
- this.updateValue(query, interpolateParams);
- }
- }
- );
- }
-
- return this.value;
- }
-
- /**
- * Clean any existing subscription to change events
- */
- private _dispose(): void {
- if (typeof this.onTranslationChange !== 'undefined') {
- this.onTranslationChange.unsubscribe();
- this.onTranslationChange = undefined;
- }
- if (typeof this.onLangChange !== 'undefined') {
- this.onLangChange.unsubscribe();
- this.onLangChange = undefined;
- }
- if (typeof this.onDefaultLangChange !== 'undefined') {
- this.onDefaultLangChange.unsubscribe();
- this.onDefaultLangChange = undefined;
- }
- }
-
- ngOnDestroy(): void {
- this._dispose();
- }
-}
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts
index e51a5a06..3691b611 100644
--- a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts
+++ b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts
@@ -16,6 +16,8 @@ import { MatTreeModule } from '@angular/material/tree';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
+import { UCapUiModule } from '@ucap-webmessenger/ui';
+
import { TenantSearchComponent } from './components/tenant-search.component';
import { TreeComponent } from './components/tree.component';
@@ -37,7 +39,9 @@ const SERVICES = [];
MatSelectModule,
MatTreeModule,
- PerfectScrollbarModule
+ PerfectScrollbarModule,
+
+ UCapUiModule
],
exports: [...COMPONENTS],
declarations: [...COMPONENTS]
diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html
index 5484b736..d84702eb 100644
--- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html
+++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.html
@@ -1,10 +1,12 @@
- {{ userInfo.name }}
- {{ userInfo.grade }}
+ {{ userInfo | ucapTranslate: 'name' }}
+ {{ userInfo | ucapTranslate: 'grade' }}
- {{ userInfo.deptName }}
+ {{
+ userInfo | ucapTranslate: 'deptName'
+ }}
diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html
index b27cc911..85c9c713 100644
--- a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html
+++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html
@@ -16,11 +16,11 @@
- {{ userInfo.name }}
- {{ userInfo.grade }}
+ {{ userInfo | ucapTranslate: 'name' }}
+ {{ userInfo | ucapTranslate: 'grade' }}
- {{ userInfo.deptName }}
+ {{ userInfo | ucapTranslate: 'deptName' }}