diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts
index 7de5914b..5582952b 100644
--- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts
+++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts
@@ -1,5 +1,9 @@
import { Component, OnInit } from '@angular/core';
-import { AuthenticationProtocolService } from '@ucap-webmessenger/protocol-authentication';
+
+import { Store, select } from '@ngrx/store';
+
+import * as AppSotre from '@app/store';
+import { Observable } from 'rxjs';
@Component({
selector: 'app-page-messenger-main',
@@ -7,14 +11,13 @@ import { AuthenticationProtocolService } from '@ucap-webmessenger/protocol-authe
styleUrls: ['./main.page.component.scss']
})
export class MainPageComponent implements OnInit {
- selectedChat: boolean;
+ selectedChat$: Observable
;
- constructor(
- private authenticationProtocolService: AuthenticationProtocolService
- ) {}
+ constructor(private store: Store) {}
ngOnInit(): void {
- // this.authenticationProtocolService.login({});
- this.selectedChat = true;
+ this.selectedChat$ = this.store.pipe(
+ select(AppSotre.MessengerSelector.ChatSelector.selectedRoom)
+ );
}
}
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 527f805d..e7228cf4 100644
--- a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts
+++ b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts
@@ -15,7 +15,12 @@ import { PublicApiService } from '@ucap-webmessenger/api-public';
import * as AppStore from '../store';
import * as VersionInfoStore from '../store/setting/version-info';
-import { LoginInfo, KEY_LOGIN_INFO } from '../types';
+import {
+ LoginInfo,
+ KEY_LOGIN_INFO,
+ EnvironmentsInfo,
+ KEY_ENVIRONMENTS_INFO
+} from '../types';
import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner';
import {
AuthenticationProtocolService,
@@ -41,64 +46,68 @@ export class AppMessengerResolver implements Resolve {
state: RouterStateSnapshot
): void | Observable | Promise {
const loginInfo = this.sessionStorageService.get(KEY_LOGIN_INFO);
+ const environmentsInfo = this.sessionStorageService.get(
+ KEY_ENVIRONMENTS_INFO
+ );
return new Promise((resolve, reject) => {
- this.publicApiService
- .versionInfo2({
- deviceType: loginInfo.deviceType,
- companyGroupType: 'C',
- companyCode: loginInfo.companyCode,
- loginId: loginInfo.loginId
- })
- .pipe(
- take(1),
- tap(versionInfo2Res => {
- this.store.dispatch(VersionInfoStore.fetchSuccess(versionInfo2Res));
- }),
- mergeMap(versionInfo2Res =>
- this.protocolService.connect(versionInfo2Res.serverIp)
- ),
- mergeMap(() => this.innerProtocolService.conn({})),
- mergeMap(connRres =>
- this.authenticationProtocolService.login({
- loginId: loginInfo.loginId,
- loginPw: loginInfo.loginPw,
- deviceType: loginInfo.deviceType,
- deviceId: ' ',
- token: '',
- localeCode: loginInfo.localeCode,
- pushId: ' ',
- companyCode: loginInfo.companyCode,
- passwordEncodingType: 1,
- clientVersion: '',
- reconnect: false,
- ip: 'localhost',
- hostName: '',
- ssoMode: SSOMode.AUTH,
- userSpecificInformation: 'PRO_000482',
- productId: 'PRO_000482',
- productName: 'EZMessenger'
- })
- ),
- map(loginRes => {
- this.store.dispatch(
- AuthenticationStore.loginSuccess({
- loginInfo: loginRes
- })
- );
- }),
- catchError(err => {
- return throwError(err);
- })
- )
- .subscribe(
- () => {
- resolve();
- },
- err => {
- reject();
- }
- );
+ resolve();
+ // this.publicApiService
+ // .versionInfo2({
+ // deviceType: environmentsInfo.deviceType,
+ // companyGroupType: loginInfo.companyGroupType,
+ // companyCode: loginInfo.companyCode,
+ // loginId: loginInfo.loginId
+ // })
+ // .pipe(
+ // take(1),
+ // tap(versionInfo2Res => {
+ // this.store.dispatch(VersionInfoStore.fetchSuccess(versionInfo2Res));
+ // }),
+ // mergeMap(versionInfo2Res =>
+ // this.protocolService.connect(versionInfo2Res.serverIp)
+ // ),
+ // mergeMap(() => this.innerProtocolService.conn({})),
+ // mergeMap(connRres =>
+ // this.authenticationProtocolService.login({
+ // loginId: loginInfo.loginId,
+ // loginPw: loginInfo.loginPw,
+ // deviceType: environmentsInfo.deviceType,
+ // deviceId: ' ',
+ // token: '',
+ // localeCode: loginInfo.localeCode,
+ // pushId: ' ',
+ // companyCode: loginInfo.companyCode,
+ // passwordEncodingType: 1,
+ // clientVersion: '',
+ // reconnect: false,
+ // ip: 'localhost',
+ // hostName: '',
+ // ssoMode: SSOMode.AUTH,
+ // userSpecificInformation: 'PRO_000482',
+ // productId: 'PRO_000482',
+ // productName: 'EZMessenger'
+ // })
+ // ),
+ // map(loginRes => {
+ // this.store.dispatch(
+ // AuthenticationStore.loginSuccess({
+ // loginInfo: loginRes
+ // })
+ // );
+ // }),
+ // catchError(err => {
+ // return throwError(err);
+ // })
+ // )
+ // .subscribe(
+ // () => {
+ // resolve();
+ // },
+ // err => {
+ // reject();
+ // }
+ // );
});
}
}
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 2ab032ab..5b603b1e 100644
--- a/projects/ucap-webmessenger-app/src/app/services/app.service.ts
+++ b/projects/ucap-webmessenger-app/src/app/services/app.service.ts
@@ -1,14 +1,44 @@
import { Injectable } from '@angular/core';
import { AppNotificationService } from './notification.service';
+import { SessionStorageService } from '@ucap-webmessenger/web-storage';
+import { EnviromentUtilService } from '@ucap-webmessenger/util';
+import { DeviceType } from '@ucap-webmessenger/core';
+import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
@Injectable()
export class AppService {
- constructor(private appNotificationService: AppNotificationService) {}
+ constructor(
+ private enviromentUtilService: EnviromentUtilService,
+ private sessionStorageService: SessionStorageService,
+ private appNotificationService: AppNotificationService
+ ) {}
public postInit(): Promise {
return new Promise((resolve, reject) => {
- this.appNotificationService.subscribe();
- resolve();
+ try {
+ let deviceType: DeviceType;
+ if (this.enviromentUtilService.nodeWebkit()) {
+ deviceType = DeviceType.PC;
+ } else if (this.enviromentUtilService.android()) {
+ deviceType = DeviceType.Android;
+ } else if (this.enviromentUtilService.ios()) {
+ deviceType = DeviceType.iOS;
+ } else {
+ deviceType = DeviceType.Web;
+ }
+
+ this.sessionStorageService.set(
+ KEY_ENVIRONMENTS_INFO,
+ {
+ deviceType
+ }
+ );
+
+ this.appNotificationService.subscribe();
+ resolve();
+ } catch (error) {
+ 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 5e22890c..454431f6 100644
--- a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts
+++ b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts
@@ -6,8 +6,7 @@ import {
SessionStorageService,
LocalStorageService
} from '@ucap-webmessenger/web-storage';
-import { EnviromentUtilService } from '@ucap-webmessenger/util';
-import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
+import { LocaleCode } from '@ucap-webmessenger/core';
import { LoginInfo, KEY_LOGIN_INFO } from '../types';
@Injectable({
@@ -18,8 +17,7 @@ export class AppAuthenticationService {
constructor(
private sessionStorageService: SessionStorageService,
- private localStorageService: LocalStorageService,
- private enviromentUtilService: EnviromentUtilService
+ private localStorageService: LocalStorageService
) {}
authenticated(): boolean {
@@ -28,24 +26,11 @@ export class AppAuthenticationService {
}
login(loginInfo: LoginInfo, rememberMe: boolean) {
- let deviceType: DeviceType;
-
loginInfo = { ...loginInfo, localeCode: LocaleCode.Korean };
- if (this.enviromentUtilService.nodeWebkit()) {
- deviceType = DeviceType.PC;
- } else if (this.enviromentUtilService.android()) {
- deviceType = DeviceType.Android;
- } else if (this.enviromentUtilService.ios()) {
- deviceType = DeviceType.iOS;
- } else {
- deviceType = DeviceType.Web;
- }
-
this.sessionStorageService.set(KEY_LOGIN_INFO, {
...loginInfo,
- loginPw: CryptoJS.enc.Hex.stringify(CryptoJS.SHA256(loginInfo.loginPw)),
- deviceType
+ loginPw: CryptoJS.enc.Hex.stringify(CryptoJS.SHA256(loginInfo.loginPw))
});
if (rememberMe) {
diff --git a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts
index 92356379..8ab465d2 100644
--- a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts
@@ -1,18 +1,22 @@
import { Injectable, Inject } from '@angular/core';
import { Router } from '@angular/router';
-import { Actions, ofType, createEffect } from '@ngrx/effects';
-
-import { of } from 'rxjs';
+import { of, throwError, EMPTY as empty } from 'rxjs';
import {
catchError,
exhaustMap,
map,
tap,
take,
- switchMap
+ switchMap,
+ mergeMap,
+ skip,
+ concatMap
} from 'rxjs/operators';
+import { Store } from '@ngrx/store';
+import { Actions, ofType, createEffect } from '@ngrx/effects';
+
import {
PiService,
Login2Response,
@@ -37,38 +41,265 @@ import {
webLoginSuccess,
webLoginFailure
} from './actions';
-import { LoginInfo } from '../../../types';
+import {
+ LoginInfo,
+ EnvironmentsInfo,
+ KEY_ENVIRONMENTS_INFO
+} from '../../../types';
import { AppAuthenticationService } from '../../../services/authentication.service';
+import { NGXLogger } from 'ngx-logger';
+import {
+ PublicApiService,
+ VersionInfo2Response
+} from '@ucap-webmessenger/api-public';
+import { SessionStorageService } from '@ucap-webmessenger/web-storage';
+
+import * as VersionInfoStore from '@app/store/setting/version-info';
+import { ProtocolService } from '@ucap-webmessenger/protocol';
+import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner';
+import {
+ AuthenticationProtocolService,
+ SSOMode,
+ LoginResponse
+} from '@ucap-webmessenger/protocol-authentication';
+
+import CryptoJS from 'crypto-js';
@Injectable()
export class Effects {
- webLogin$ = createEffect(() =>
- this.actions$.pipe(
- ofType(webLogin),
- map(action => action),
- exhaustMap((params: { loginInfo: LoginInfo; rememberMe: boolean }) =>
- this.piService
- .login2({
- loginId: params.loginInfo.loginId,
- loginPw: params.loginInfo.loginPw,
- companyCode: params.loginInfo.companyCode
- })
- .pipe(
- map((res: Login2Response) => {
- if ('success' !== res.status.toLowerCase()) {
- return webLoginFailure({ error: 'Failed' });
- } else {
- return webLoginSuccess({
- loginInfo: params.loginInfo,
- rememberMe: params.rememberMe,
- login2Response: res
- });
- }
- }),
- catchError(error => of(webLoginFailure({ error })))
- )
- )
- )
+ // webLogin$ = createEffect(() =>
+ // this.actions$.pipe(
+ // ofType(webLogin),
+ // map(action => action),
+ // exhaustMap((params: { loginInfo: LoginInfo; rememberMe: boolean }) =>
+ // this.piService
+ // .login2({
+ // loginId: params.loginInfo.loginId,
+ // loginPw: params.loginInfo.loginPw,
+ // companyCode: params.loginInfo.companyCode
+ // })
+ // .pipe(
+ // map((res: Login2Response) => {
+ // if ('success' !== res.status.toLowerCase()) {
+ // return webLoginFailure({ error: 'Failed' });
+ // } else {
+ // return webLoginSuccess({
+ // loginInfo: params.loginInfo,
+ // rememberMe: params.rememberMe,
+ // login2Response: res
+ // });
+ // }
+ // }),
+ // catchError(error => of(webLoginFailure({ error })))
+ // )
+ // )
+ // )
+ // );
+ webLogin$ = createEffect(
+ () =>
+ this.actions$.pipe(
+ ofType(webLogin),
+ map(action => action),
+ switchMap(
+ (loginParams: { loginInfo: LoginInfo; rememberMe: boolean }) => {
+ const environmentsInfo = this.sessionStorageService.get<
+ EnvironmentsInfo
+ >(KEY_ENVIRONMENTS_INFO);
+
+ let login2Res: Login2Response;
+ let loginRes: LoginResponse;
+ let versionInfo2Res: VersionInfo2Response;
+ let encLoginPw: string;
+
+ return this.piService
+ .login2({
+ loginId: loginParams.loginInfo.loginId,
+ loginPw: loginParams.loginInfo.loginPw,
+ companyCode: loginParams.loginInfo.companyCode
+ })
+ .pipe(
+ concatMap(res => {
+ console.log('tap');
+ if ('success' !== res.status.toLowerCase()) {
+ return throwError('login2 failed');
+ }
+ login2Res = res;
+ return of(true);
+ }),
+ mergeMap(dd => {
+ console.log('checkForUpdates');
+ return this.nativeService.checkForUpdates();
+ }),
+ concatMap(update => {
+ if (update) {
+ return throwError('update process');
+ }
+ encLoginPw = CryptoJS.enc.Hex.stringify(
+ CryptoJS.SHA256(loginParams.loginInfo.loginPw)
+ );
+ return of(true);
+ }),
+ mergeMap(() =>
+ this.publicApiService.versionInfo2({
+ deviceType: environmentsInfo.deviceType,
+ companyGroupType: loginParams.loginInfo.companyGroupType,
+ companyCode: loginParams.loginInfo.companyCode,
+ loginId: loginParams.loginInfo.loginId
+ })
+ ),
+ map(res => {
+ this.store.dispatch(VersionInfoStore.fetchSuccess(res));
+ versionInfo2Res = res;
+ return of(true);
+ }),
+ mergeMap(() =>
+ this.protocolService.connect(versionInfo2Res.serverIp)
+ ),
+ mergeMap(() => this.innerProtocolService.conn({})),
+ mergeMap(() =>
+ this.authenticationProtocolService.login({
+ loginId: loginParams.loginInfo.loginId,
+ loginPw: encLoginPw,
+ deviceType: environmentsInfo.deviceType,
+ deviceId: ' ',
+ token: '',
+ localeCode: loginParams.loginInfo.localeCode,
+ pushId: ' ',
+ companyCode: loginParams.loginInfo.companyCode,
+ passwordEncodingType: 1,
+ clientVersion: '',
+ reconnect: false,
+ ip: 'localhost',
+ hostName: '',
+ ssoMode: SSOMode.AUTH,
+ userSpecificInformation: 'PRO_000482',
+ productId: 'PRO_000482',
+ productName: 'EZMessenger'
+ })
+ ),
+ exhaustMap(async res => {
+ if (res.privateInformationAgree) {
+ return of(null);
+ }
+
+ loginRes = res;
+
+ const privacyTotalUrl = this.piService.privacyTotalUrl({
+ companyCode: res.companyCode,
+ userSeq: res.userSeq,
+ token: res.tokenString,
+ deviceType: environmentsInfo.deviceType,
+ localeCode: loginParams.loginInfo.localeCode,
+ textOnly: 'true'
+ });
+
+ const result = await this.dialogService.open<
+ ConfirmDialogComponent,
+ ConfirmDialogData,
+ ConfirmDialogResult
+ >(ConfirmDialogComponent, {
+ width: '100%',
+ height: '500px',
+ disableClose: true,
+ data: {
+ title: '개인정보 동의',
+ html: ``
+ }
+ });
+
+ if (!result.choice) {
+ console.log('privacy error');
+ throw new Error('privacy error');
+ }
+
+ return of(true);
+ }),
+ exhaustMap(proceed => {
+ if (null === proceed) {
+ return of(null);
+ }
+
+ return this.piService.userTermsAction({
+ userSeq: loginRes.userSeq,
+ token: loginRes.tokenString,
+ deviceType: environmentsInfo.deviceType
+ });
+ }),
+ exhaustMap(async () => {
+ this.logger.debug(
+ 'loginRes.passwordExpired',
+ loginRes.passwordExpired
+ );
+ if (!loginRes.passwordExpired) {
+ return of(null);
+ }
+
+ const privacyTotalUrl = this.piService.privacyTotalUrl({
+ companyCode: loginRes.companyCode,
+ userSeq: loginRes.userSeq,
+ token: loginRes.tokenString,
+ deviceType: environmentsInfo.deviceType,
+ localeCode: loginParams.loginInfo.localeCode,
+ textOnly: 'true'
+ });
+
+ const result = await this.dialogService.open<
+ ConfirmDialogComponent,
+ ConfirmDialogData,
+ ConfirmDialogResult
+ >(ConfirmDialogComponent, {
+ width: '100%',
+ height: '500px',
+ disableClose: true,
+ data: {
+ title: '패스워드 변경',
+ html: ``
+ }
+ });
+
+ if (!result.choice) {
+ return throwError('privacy error');
+ }
+
+ return of(true);
+ }),
+ mergeMap(proceed => {
+ // 패스워드 변경
+ if (null === proceed) {
+ return of(null);
+ }
+
+ return this.piService.userTermsAction({
+ userSeq: loginRes.userSeq,
+ token: loginRes.tokenString,
+ deviceType: environmentsInfo.deviceType
+ });
+ }),
+
+ map(res => {
+ this.appAuthenticationService.login(
+ loginParams.loginInfo,
+ loginParams.rememberMe
+ );
+ this.store.dispatch(
+ loginSuccess({
+ loginInfo: loginRes
+ })
+ );
+ this.router.navigate(['/messenger']);
+ }),
+ catchError(error => {
+ return throwError(error);
+ })
+ );
+ }
+ ),
+ catchError(error => {
+ this.store.dispatch(webLoginFailure({ error: error.message }));
+ return of(error);
+ })
+ ),
+ { dispatch: false }
);
webLoginSuccess$ = createEffect(
@@ -140,9 +371,16 @@ export class Effects {
constructor(
private actions$: Actions,
private router: Router,
+ private store: Store,
private piService: PiService,
+ private publicApiService: PublicApiService,
+ private protocolService: ProtocolService,
+ private innerProtocolService: InnerProtocolService,
+ private authenticationProtocolService: AuthenticationProtocolService,
private appAuthenticationService: AppAuthenticationService,
private dialogService: DialogService,
- @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
+ @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
+ private sessionStorageService: SessionStorageService,
+ private logger: NGXLogger
) {}
}
diff --git a/projects/ucap-webmessenger-app/src/app/store/account/privacy/effects.ts b/projects/ucap-webmessenger-app/src/app/store/account/privacy/effects.ts
index 32202e89..1515b66b 100644
--- a/projects/ucap-webmessenger-app/src/app/store/account/privacy/effects.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/account/privacy/effects.ts
@@ -28,62 +28,70 @@ import {
agreeFailure
} from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
-import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
+import {
+ LoginInfo,
+ KEY_LOGIN_INFO,
+ EnvironmentsInfo,
+ KEY_ENVIRONMENTS_INFO
+} from '@app/types';
import { initSettings } from '@app/store/setting/init';
@Injectable()
export class Effects {
- agreeConfirmation$ = createEffect(() =>
- this.actions$.pipe(
- ofType(loginSuccess),
- exhaustMap(async params => {
- if (params.loginInfo.privateInformationAgree) {
- return null;
- }
- const loginInfo = this.sessionStorageService.get(
- KEY_LOGIN_INFO
- );
+ // agreeConfirmation$ = createEffect(() =>
+ // this.actions$.pipe(
+ // ofType(loginSuccess),
+ // exhaustMap(async params => {
+ // if (params.loginInfo.privateInformationAgree) {
+ // return null;
+ // }
+ // const loginInfo = this.sessionStorageService.get(
+ // KEY_LOGIN_INFO
+ // );
+ // const environmentsInfo = this.sessionStorageService.get<
+ // EnvironmentsInfo
+ // >(KEY_ENVIRONMENTS_INFO);
- const privacyTotalUrl = this.piService.privacyTotalUrl({
- companyCode: params.loginInfo.companyCode,
- userSeq: params.loginInfo.userSeq,
- token: params.loginInfo.tokenString,
- deviceType: loginInfo.deviceType,
- localeCode: loginInfo.localeCode,
- textOnly: 'true'
- });
+ // const privacyTotalUrl = this.piService.privacyTotalUrl({
+ // companyCode: params.loginInfo.companyCode,
+ // userSeq: params.loginInfo.userSeq,
+ // token: params.loginInfo.tokenString,
+ // deviceType: environmentsInfo.deviceType,
+ // localeCode: loginInfo.localeCode,
+ // textOnly: 'true'
+ // });
- const result = await this.dialogService.open<
- ConfirmDialogComponent,
- ConfirmDialogData,
- ConfirmDialogResult
- >(ConfirmDialogComponent, {
- width: '100%',
- height: '500px',
- disableClose: true,
- data: {
- title: '개인정보 동의',
- html: ``
- }
- });
+ // const result = await this.dialogService.open<
+ // ConfirmDialogComponent,
+ // ConfirmDialogData,
+ // ConfirmDialogResult
+ // >(ConfirmDialogComponent, {
+ // width: '100%',
+ // height: '500px',
+ // disableClose: true,
+ // data: {
+ // title: '개인정보 동의',
+ // html: ``
+ // }
+ // });
- return {
- loginInfo: params.loginInfo,
- choice: result.choice
- };
- }),
- map(params => {
- if (!params) {
- return agreeConfirmationNotNeeded();
- }
+ // return {
+ // loginInfo: params.loginInfo,
+ // choice: result.choice
+ // };
+ // }),
+ // map(params => {
+ // if (!params) {
+ // return agreeConfirmationNotNeeded();
+ // }
- return params.choice
- ? agreeConfirmationYes({ loginInfo: params.loginInfo })
- : agreeConfirmationNo();
- })
- )
- );
+ // return params.choice
+ // ? agreeConfirmationYes({ loginInfo: params.loginInfo })
+ // : agreeConfirmationNo();
+ // })
+ // )
+ // );
agreeConfirmationYes$ = createEffect(() =>
this.actions$.pipe(
@@ -92,9 +100,13 @@ export class Effects {
const loginInfo = this.sessionStorageService.get(
KEY_LOGIN_INFO
);
+ const environmentsInfo = this.sessionStorageService.get<
+ EnvironmentsInfo
+ >(KEY_ENVIRONMENTS_INFO);
return {
loginInfo,
+ environmentsInfo,
loginResponse: action.loginInfo
};
}),
@@ -103,7 +115,7 @@ export class Effects {
.userTermsAction({
userSeq: params.loginResponse.userSeq,
token: params.loginResponse.tokenString,
- deviceType: params.loginInfo.deviceType
+ deviceType: params.environmentsInfo.deviceType
})
.pipe(
map((res: UserTermsActionResponse) => {
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/chat/actions.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/actions.ts
new file mode 100644
index 00000000..bc1f34b8
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/actions.ts
@@ -0,0 +1,6 @@
+import { createAction, props } from '@ngrx/store';
+
+export const selectedRoom = createAction(
+ '[Messenger::Chat] selectedRoom',
+ props<{ roomSeq: number }>()
+);
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/chat/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/effects.ts
new file mode 100644
index 00000000..511eba9c
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/effects.ts
@@ -0,0 +1,16 @@
+import { Injectable } from '@angular/core';
+
+import { Actions } from '@ngrx/effects';
+
+import { Store } from '@ngrx/store';
+
+import { NGXLogger } from 'ngx-logger';
+
+@Injectable()
+export class Effects {
+ constructor(
+ private actions$: Actions,
+ private store: Store,
+ private logger: NGXLogger
+ ) {}
+}
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/chat/index.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/index.ts
new file mode 100644
index 00000000..2663cade
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/index.ts
@@ -0,0 +1,4 @@
+export * from './actions';
+export * from './effects';
+export * from './reducers';
+export * from './state';
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/chat/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/reducers.ts
new file mode 100644
index 00000000..c2ba4566
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/reducers.ts
@@ -0,0 +1,13 @@
+import { createReducer, on } from '@ngrx/store';
+import { initialState } from './state';
+import { selectedRoom } from './actions';
+
+export const reducer = createReducer(
+ initialState,
+ on(selectedRoom, (state, action) => {
+ return {
+ ...state,
+ selectedRoom: action.roomSeq
+ };
+ })
+);
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/chat/state.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/state.ts
new file mode 100644
index 00000000..62a27a94
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/chat/state.ts
@@ -0,0 +1,18 @@
+import { Selector, createSelector } from '@ngrx/store';
+
+export interface State {
+ selectedRoom: number | null;
+}
+
+export const initialState: State = {
+ selectedRoom: null
+};
+
+export function selectors(selector: Selector) {
+ return {
+ selectedRoom: createSelector(
+ selector,
+ (state: State) => state.selectedRoom
+ )
+ };
+}
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/index.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/index.ts
index 3cf34cb6..7d85092c 100644
--- a/projects/ucap-webmessenger-app/src/app/store/messenger/index.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/index.ts
@@ -1,22 +1,31 @@
import { Type } from '@angular/core';
import { Action, combineReducers, Selector, createSelector } from '@ngrx/store';
+import * as ChatStore from './chat';
import * as SyncStore from './sync';
export interface State {
+ chat: ChatStore.State;
sync: SyncStore.State;
}
-export const effects: Type[] = [SyncStore.Effects];
+export const effects: Type[] = [ChatStore.Effects, SyncStore.Effects];
export function reducers(state: State | undefined, action: Action) {
return combineReducers({
+ chat: ChatStore.reducer,
sync: SyncStore.reducer
})(state, action);
}
export function selectors(selector: Selector) {
return {
+ ChatSelector: ChatStore.selectors(
+ createSelector(
+ selector,
+ (state: State) => state.chat
+ )
+ ),
SyncSelector: SyncStore.selectors(
createSelector(
selector,
diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/state.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/state.ts
index 6087f3a6..73e5fbc2 100644
--- a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/state.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/state.ts
@@ -33,6 +33,15 @@ export function selectors(selector: Selector) {
group2SyncDate: createSelector(
selector,
(state: State) => state.group2SyncDate
+ ),
+ groupListAndBuddyList: createSelector(
+ selector,
+ (state: State) => {
+ return {
+ groupList: state.groupList,
+ buddyList: state.buddyInfoList
+ };
+ }
)
};
}
diff --git a/projects/ucap-webmessenger-app/src/app/store/setting/option/effects.ts b/projects/ucap-webmessenger-app/src/app/store/setting/option/effects.ts
index e4742de6..3f648b11 100644
--- a/projects/ucap-webmessenger-app/src/app/store/setting/option/effects.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/setting/option/effects.ts
@@ -8,12 +8,13 @@ import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { regViewSuccess, regViewFailure } from './actions';
import { initSettings } from '../init';
import { OptionProtocolService } from '@ucap-webmessenger/protocol-option';
+import { loginSuccess } from '@app/store/account/authentication';
@Injectable()
export class Effects {
initSettings$ = createEffect(() =>
this.actions$.pipe(
- ofType(initSettings),
+ ofType(loginSuccess),
exhaustMap(() =>
this.optionProtocolService.regView({}).pipe(
map(res => regViewSuccess({ res })),
diff --git a/projects/ucap-webmessenger-app/src/app/store/setting/query/effects.ts b/projects/ucap-webmessenger-app/src/app/store/setting/query/effects.ts
index c7f6ce95..4515cd4c 100644
--- a/projects/ucap-webmessenger-app/src/app/store/setting/query/effects.ts
+++ b/projects/ucap-webmessenger-app/src/app/store/setting/query/effects.ts
@@ -13,19 +13,29 @@ import {
AuthRequest
} from '@ucap-webmessenger/protocol-query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
-import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
+import {
+ LoginInfo,
+ KEY_LOGIN_INFO,
+ EnvironmentsInfo,
+ KEY_ENVIRONMENTS_INFO
+} from '@app/types';
+import { loginSuccess } from '@app/store/account/authentication';
@Injectable()
export class Effects {
initSettings$ = createEffect(() =>
this.actions$.pipe(
- ofType(initSettings),
+ ofType(loginSuccess),
map(() => {
const loginInfo = this.sessionStorageService.get(
KEY_LOGIN_INFO
);
+ const environmentsInfo = this.sessionStorageService.get<
+ EnvironmentsInfo
+ >(KEY_ENVIRONMENTS_INFO);
+
return {
- deviceType: loginInfo.deviceType
+ deviceType: environmentsInfo.deviceType
} as AuthRequest;
}),
exhaustMap(req =>
diff --git a/projects/ucap-webmessenger-app/src/app/types/environment.type.ts b/projects/ucap-webmessenger-app/src/app/types/environment.type.ts
new file mode 100644
index 00000000..7fb5e769
--- /dev/null
+++ b/projects/ucap-webmessenger-app/src/app/types/environment.type.ts
@@ -0,0 +1,7 @@
+import { DeviceType } from '@ucap-webmessenger/core';
+
+export const KEY_ENVIRONMENTS_INFO = 'ucap::ENVIRONMENTS_INFO';
+
+export interface EnvironmentsInfo {
+ deviceType?: DeviceType;
+}
diff --git a/projects/ucap-webmessenger-app/src/app/types/index.ts b/projects/ucap-webmessenger-app/src/app/types/index.ts
index 5d9da6f4..bd6be849 100644
--- a/projects/ucap-webmessenger-app/src/app/types/index.ts
+++ b/projects/ucap-webmessenger-app/src/app/types/index.ts
@@ -1 +1,2 @@
+export * from './environment.type';
export * from './login-info.type';
diff --git a/projects/ucap-webmessenger-app/src/app/types/login-info.type.ts b/projects/ucap-webmessenger-app/src/app/types/login-info.type.ts
index 03acdb6a..8c3e10d9 100644
--- a/projects/ucap-webmessenger-app/src/app/types/login-info.type.ts
+++ b/projects/ucap-webmessenger-app/src/app/types/login-info.type.ts
@@ -1,4 +1,4 @@
-import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
+import { LocaleCode } from '@ucap-webmessenger/core';
export const KEY_LOGIN_INFO = 'ucap::LOGIN_INFO';
@@ -6,7 +6,7 @@ export interface LoginInfo {
loginId?: string;
loginPw?: string;
companyCode?: string;
- deviceType?: DeviceType;
+ companyGroupType?: string;
localeCode?: LocaleCode;
encData?: string;
}
diff --git a/projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts b/projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts
index 62ad0cf3..4ab20b51 100644
--- a/projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts
+++ b/projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts
@@ -10,6 +10,7 @@ import {
ProtocolStream
} from '@ucap-webmessenger/protocol';
import { UserInfo } from '../types/userInfo';
+import { EmployeeType } from '@ucap-webmessenger/protocol-room';
export interface BuddyInfo {
// 사용자SEQ
@@ -82,7 +83,7 @@ export const decodeBuddyDetailData: ProtocolDecoder = (
const info = buddyinfo.split(BodyStringDivider);
let i = 0;
buddyInfos.push({
- seq: info[i],
+ seq: Number(info[i]),
name: info[i++],
profileImageFile: info[i++],
grade: info[i++],
@@ -109,7 +110,7 @@ export const decodeBuddyDetailData: ProtocolDecoder = (
deptNameCn: info[i++],
isPrivacyAgree: info[i++] === 'Y' ? true : false,
isValidLogin: info[i++] === 'Y' ? true : false,
- employeeType: info[i++],
+ employeeType: info[i++] as EmployeeType,
nickName: info[i++]
});
});
diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html
index 26ea11e3..c85a1ad5 100644
--- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html
+++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html
@@ -1,8 +1,15 @@
-
+
- {{ group.name }}
+ {{ groupBuddy.group.name }}
+
+
+ {{ buddy.name }}
+
diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts
index 7f20bc65..29e113da 100644
--- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts
+++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts
@@ -1,6 +1,6 @@
-import { Component, OnInit, Input } from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
-import { GroupDetailData } from '@ucap-webmessenger/protocol-sync';
+import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync';
@Component({
selector: 'ucap-group-expansion-panel',
@@ -9,9 +9,16 @@ import { GroupDetailData } from '@ucap-webmessenger/protocol-sync';
})
export class ExpansionPanelComponent implements OnInit {
@Input()
- groupList: GroupDetailData[];
+ groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
+
+ @Output()
+ selectBuddy = new EventEmitter();
constructor() {}
ngOnInit() {}
+
+ onClickBuddy(buddy: UserInfo) {
+ this.selectBuddy.emit(buddy);
+ }
}