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

View File

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

View File

@ -40,7 +40,8 @@
<!-- CHAT MESSAGES -->
<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>
<!-- CHAT MESSAGES -->
</div>

View File

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

View File

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

View File

@ -1,20 +1 @@
import { SyncMode } from '@ucap-webmessenger/api-public';
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
} from '@ucap-webmessenger/protocol-authentication';
import { NGXLogger } from 'ngx-logger';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
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 { DatePipe } from '@angular/common';
@ -23,6 +23,8 @@ export class MessagesComponent implements OnInit {
messages: Info[];
@Input()
userInfos?: UserInfo[];
@Input()
sessionVerInfo: VersionInfo2Response;
@Output()
massDetail = new EventEmitter<number>();
@ -41,8 +43,8 @@ export class MessagesComponent implements OnInit {
) {}
ngOnInit() {
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO);
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot;
this.profileImageRoot =
this.profileImageRoot || this.sessionVerInfo.profileRoot;
}
getUserName(seq: number): string {

View File

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