수정 :: KEY_VER_INFO 의 SessionStorage 정보를 ui component 에서 참조하던것을 상위 컴포넌트에서 주입하는 방식으로 수정.

This commit is contained in:
leejh 2019-10-15 14:58:11 +09:00
parent 25449965a1
commit db722df333
8 changed files with 47 additions and 70 deletions

View File

@ -1,23 +1,11 @@
<div> <div>
<div> <div>
<ucap-organization-tenant-search <ucap-organization-tenant-search [companyList]="companyList$ | async" [companyCode]="companyCode"
[companyList]="companyList$ | async" (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"></ucap-organization-tenant-search>
[companyCode]="companyCode" <button mat-icon-button [matMenuTriggerFor]="groupMenu" aria-label="group menu">
(keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"
></ucap-organization-tenant-search>
<button
mat-icon-button
[matMenuTriggerFor]="groupMenu"
aria-label="group menu"
>
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-menu <mat-menu #groupMenu="matMenu" xPosition="after" yPosition="below" [overlapTrigger]="false">
#groupMenu="matMenu"
xPosition="after"
yPosition="below"
[overlapTrigger]="false"
>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')"> <button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')">
<mat-icon>group_add</mat-icon> <mat-icon>group_add</mat-icon>
<span>새 그룹 추가</span> <span>새 그룹 추가</span>
@ -41,30 +29,18 @@
</mat-menu> </mat-menu>
</div> </div>
<div> <div>
<ucap-group-expansion-panel <ucap-group-expansion-panel #groupExpansionPanel [groupBuddyList]="groupBuddyList$ | async"
#groupExpansionPanel [favoritBuddyList]="favoritBuddyList$ | async" (more)="onMoreGroup($event)">
[groupBuddyList]="groupBuddyList$ | async" <ucap-profile-user-list-item *ucapGroupExpansionPanelItem="let userInfo" [userInfo]="userInfo"
[favoritBuddyList]="favoritBuddyList$ | async" [presence]="getStatusBulkInfo(userInfo) | async" [sessionVerinfo]="sessionVerinfo"
(more)="onMoreGroup($event)" (click)="onSelectBuddy(userInfo)" (contextMenu)="onContextMenuProfile($event)">
>
<ucap-profile-user-list-item
*ucapGroupExpansionPanelItem="let userInfo"
[userInfo]="userInfo"
[presence]="getStatusBulkInfo(userInfo) | async"
(click)="onSelectBuddy(userInfo)"
(contextMenu)="onContextMenuProfile($event)"
>
</ucap-profile-user-list-item> </ucap-profile-user-list-item>
</ucap-group-expansion-panel> </ucap-group-expansion-panel>
</div> </div>
</div> </div>
<div <div style="visibility: hidden; position: fixed" [style.left]="profileContextMenuPosition.x"
style="visibility: hidden; position: fixed" [style.top]="profileContextMenuPosition.y" [matMenuTriggerFor]="profileContextMenu"></div>
[style.left]="profileContextMenuPosition.x"
[style.top]="profileContextMenuPosition.y"
[matMenuTriggerFor]="profileContextMenu"
></div>
<mat-menu #profileContextMenu="matMenu" [overlapTrigger]="false"> <mat-menu #profileContextMenu="matMenu" [overlapTrigger]="false">
<ng-template matMenuContent let-item="userInfo"> <ng-template matMenuContent let-item="userInfo">
<button mat-menu-item>Action 1</button> <button mat-menu-item>Action 1</button>
@ -72,12 +48,8 @@
</ng-template> </ng-template>
</mat-menu> </mat-menu>
<div <div style="visibility: hidden; position: fixed" [style.left]="groupContextMenuPosition.x"
style="visibility: hidden; position: fixed" [style.top]="groupContextMenuPosition.y" [matMenuTriggerFor]="groupContextMenu"></div>
[style.left]="groupContextMenuPosition.x"
[style.top]="groupContextMenuPosition.y"
[matMenuTriggerFor]="groupContextMenu"
></div>
<mat-menu #groupContextMenu="matMenu" [overlapTrigger]="false"> <mat-menu #groupContextMenu="matMenu" [overlapTrigger]="false">
<ng-template matMenuContent let-item="group"> <ng-template matMenuContent let-item="group">
<button mat-menu-item>그룹 대화하기</button> <button mat-menu-item>그룹 대화하기</button>

View File

@ -35,6 +35,8 @@ import {
UserInfoDN UserInfoDN
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { MatMenuTrigger, MatMenu } from '@angular/material'; import { MatMenuTrigger, MatMenu } from '@angular/material';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -68,6 +70,8 @@ export class GroupComponent implements OnInit {
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription; loginResSubscription: Subscription;
sessionVerinfo: VersionInfo2Response;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
@ -77,6 +81,9 @@ export class GroupComponent implements OnInit {
ngOnInit() { ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO); const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO
);
this.companyCode = loginInfo.companyCode; this.companyCode = loginInfo.companyCode;
this.loginResSubscription = this.store this.loginResSubscription = this.store

View File

@ -40,7 +40,8 @@
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->
<ucap-chat-messages [messages]="eventList$ | async" [userInfos]="userInfoList$ | async" [loginRes]="loginRes" <ucap-chat-messages [messages]="eventList$ | async" [userInfos]="userInfoList$ | async" [loginRes]="loginRes"
(massDetail)="onMassDetail($event)" (save)="onSave($event)" (imageViewer)="onImageViewer($event)"> [sessionVerInfo]="sessionVerInfo" (massDetail)="onMassDetail($event)" (save)="onSave($event)"
(imageViewer)="onImageViewer($event)">
</ucap-chat-messages> </ucap-chat-messages>
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->
</div> </div>

View File

@ -22,6 +22,8 @@ import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { RoomInfo, UserInfo } from '@ucap-webmessenger/protocol-room'; import { RoomInfo, UserInfo } from '@ucap-webmessenger/protocol-room';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { FileInfo } from '@ucap-webmessenger/ui-chat'; import { FileInfo } from '@ucap-webmessenger/ui-chat';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -40,6 +42,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
roomInfoSubscription: Subscription; roomInfoSubscription: Subscription;
userInfoList$: Observable<UserInfo[]>; userInfoList$: Observable<UserInfo[]>;
eventListProcessing$: Observable<boolean>; eventListProcessing$: Observable<boolean>;
sessionVerInfo: VersionInfo2Response;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
@ -49,6 +52,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
ngOnInit() { ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO); const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.sessionVerInfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO
);
this.loginResSubscription = this.store this.loginResSubscription = this.store
.pipe( .pipe(

View File

@ -18,7 +18,10 @@ import { Store, select } from '@ngrx/store';
import { ProtocolService } from '@ucap-webmessenger/protocol'; import { ProtocolService } from '@ucap-webmessenger/protocol';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { PublicApiService } from '@ucap-webmessenger/api-public'; import {
PublicApiService,
VersionInfo2Response
} from '@ucap-webmessenger/api-public';
import { import {
LoginInfo, LoginInfo,
@ -44,7 +47,7 @@ import * as VersionInfoStore from '@app/store/setting/version-info';
import * as OptionStore from '@app/store/messenger/option'; import * as OptionStore from '@app/store/messenger/option';
import * as QueryStore from '@app/store/messenger/query'; import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
import { VerInfo2, KEY_VER_INFO } from '@app/types/ver-info.type'; import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
@Injectable() @Injectable()
@ -85,7 +88,10 @@ export class AppMessengerResolver implements Resolve<void> {
.pipe( .pipe(
take(1), take(1),
tap(res => { tap(res => {
this.sessionStorageService.set<VerInfo2>(KEY_VER_INFO, res); this.sessionStorageService.set<VersionInfo2Response>(
KEY_VER_INFO,
res
);
this.store.dispatch(VersionInfoStore.versionInfo2Success({ res })); this.store.dispatch(VersionInfoStore.versionInfo2Success({ res }));
}), }),
switchMap(res => { switchMap(res => {

View File

@ -1,20 +1 @@
import { SyncMode } from '@ucap-webmessenger/api-public';
export const KEY_VER_INFO = 'ucap::VER_INFO'; export const KEY_VER_INFO = 'ucap::VER_INFO';
export interface VerInfo2 {
protocolCode?: number;
syncMode?: SyncMode;
appVersion?: string;
installUrl?: string;
serverIp?: string;
uploadUrl?: string;
downloadUrl?: string;
profileUploadUrl?: string;
profileRoot?: string;
fileTerm?: number;
fileAllowSize?: number;
authIp?: boolean;
launcherAppVersion?: string;
launcherInstallUrl?: string;
}

View File

@ -6,8 +6,8 @@ import {
UserInfo UserInfo
} from '@ucap-webmessenger/protocol-authentication'; } from '@ucap-webmessenger/protocol-authentication';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_VER_INFO, VerInfo2 } from '@app/types/ver-info.type';
import { FileInfo } from '../models/file-info.json'; import { FileInfo } from '../models/file-info.json';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
@ -23,6 +23,8 @@ export class MessagesComponent implements OnInit {
messages: Info[]; messages: Info[];
@Input() @Input()
userInfos?: UserInfo[]; userInfos?: UserInfo[];
@Input()
sessionVerInfo: VersionInfo2Response;
@Output() @Output()
massDetail = new EventEmitter<number>(); massDetail = new EventEmitter<number>();
@ -41,8 +43,8 @@ export class MessagesComponent implements OnInit {
) {} ) {}
ngOnInit() { ngOnInit() {
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO); this.profileImageRoot =
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot; this.profileImageRoot || this.sessionVerInfo.profileRoot;
} }
getUserName(seq: number): string { getUserName(seq: number): string {

View File

@ -19,10 +19,10 @@ import { Subscription } from 'rxjs';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_VER_INFO, VerInfo2 } from '@app/types/ver-info.type';
import { StatusCode } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/core';
import { PresenceType } from '../types/presence-type.type'; import { PresenceType } from '../types/presence-type.type';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
@Component({ @Component({
selector: 'ucap-profile-user-list-item', selector: 'ucap-profile-user-list-item',
@ -43,6 +43,8 @@ export class UserListItemComponent implements OnInit, OnDestroy {
checkable = false; checkable = false;
@Input() @Input()
compactable = false; compactable = false;
@Input()
sessionVerinfo: VersionInfo2Response;
@Output() @Output()
contextMenu = new EventEmitter<{ contextMenu = new EventEmitter<{
@ -72,8 +74,8 @@ export class UserListItemComponent implements OnInit, OnDestroy {
// ) // )
// .subscribe(); // .subscribe();
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO); this.profileImageRoot =
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot; this.profileImageRoot || this.sessionVerinfo.profileRoot;
} }
ngOnDestroy(): void { ngOnDestroy(): void {