조직도와 다른 메뉴간 화면 전환 이슈 처리.

1. 조직도 > 대화 :: 대화 메뉴로 이동.
2. 프로필 > 1:1대화 :: 대화메뉴로 이동.
This commit is contained in:
leejinho 2020-03-05 17:01:01 +09:00
parent e8bb32b609
commit 3a591fb351
5 changed files with 63 additions and 13 deletions

View File

@ -3,6 +3,7 @@
mat-stretch-tabs mat-stretch-tabs
animationDuration="0ms" animationDuration="0ms"
[backgroundColor]="'transparent'" [backgroundColor]="'transparent'"
[selectedIndex]="gnbMenuIndex"
(selectedTabChange)="onSelectedTabChange($event)" (selectedTabChange)="onSelectedTabChange($event)"
class="global-menu" class="global-menu"
> >

View File

@ -1,7 +1,7 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Observable } from 'rxjs'; import { Observable, Subscribable, Subscription } from 'rxjs';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
@ -9,6 +9,7 @@ import * as MessageStore from '@app/store/messenger/message';
import * as SettingsStore from '@app/store/messenger/settings'; import * as SettingsStore from '@app/store/messenger/settings';
import { MatTabChangeEvent } from '@angular/material/tabs'; import { MatTabChangeEvent } from '@angular/material/tabs';
import { MainMenu } from '@app/types'; import { MainMenu } from '@app/types';
import { tap, map } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-layout-messenger-left-nav', selector: 'app-layout-messenger-left-nav',
@ -22,6 +23,8 @@ export class LeftNaviComponent implements OnInit, OnDestroy {
badgeMessageInterval: any; badgeMessageInterval: any;
MainMenu = MainMenu; MainMenu = MainMenu;
gnbMenuIndexSubscription: Subscription;
gnbMenuIndex: number;
constructor(private store: Store<any>, private logger: NGXLogger) {} constructor(private store: Store<any>, private logger: NGXLogger) {}
@ -41,12 +44,34 @@ export class LeftNaviComponent implements OnInit, OnDestroy {
() => this.getMessageUnreadCount(), () => this.getMessageUnreadCount(),
5 * 60 * 1000 5 * 60 * 1000
); );
this.gnbMenuIndexSubscription = this.store
.pipe(select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex))
.subscribe(index => {
switch (index) {
case MainMenu.Group:
this.gnbMenuIndex = 0;
break;
case MainMenu.Chat:
this.gnbMenuIndex = 1;
break;
case MainMenu.Organization:
this.gnbMenuIndex = 2;
break;
case MainMenu.Message:
this.gnbMenuIndex = 3;
break;
}
});
} }
ngOnDestroy(): void { ngOnDestroy(): void {
if (!!this.badgeMessageInterval) { if (!!this.badgeMessageInterval) {
clearInterval(this.badgeMessageInterval); clearInterval(this.badgeMessageInterval);
} }
if (!!this.gnbMenuIndexSubscription) {
this.gnbMenuIndexSubscription.unsubscribe();
}
this.logger.debug('-----------------------LeftNaviComponent ngOnDestroy'); this.logger.debug('-----------------------LeftNaviComponent ngOnDestroy');
} }

View File

@ -5,6 +5,7 @@ import * as AppStore from '@app/store';
import { select, Store } from '@ngrx/store'; import { select, Store } from '@ngrx/store';
import { MainMenu } from '@app/types'; import { MainMenu } from '@app/types';
import { tap } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-layout-messenger-main-contents', selector: 'app-layout-messenger-main-contents',
@ -33,7 +34,12 @@ export class MainContentsComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.gnbMenuIndex$ = this.store.pipe( this.gnbMenuIndex$ = this.store.pipe(
select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex) select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex),
tap(index => {
if (index === MainMenu.Organization) {
this.closeRightDrawer.emit();
}
})
); );
} }

View File

@ -18,19 +18,16 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as QueryStore from '@app/store/messenger/query'; import * as SettingsStore from '@app/store/messenger/settings';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as StatusStore from '@app/store/messenger/status';
import { Observable, Subscription, combineLatest } from 'rxjs'; import { Observable, Subscription } from 'rxjs';
import { PresenceType, StatusCode } from '@ucap-webmessenger/core'; import { PresenceType } from '@ucap-webmessenger/core';
import { import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
StatusBulkInfo,
WorkStatusType
} from '@ucap-webmessenger/protocol-status';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO, KEY_AUTH_INFO } from '@app/types'; import { KEY_VER_INFO, KEY_AUTH_INFO, MainMenu } from '@app/types';
import { Sort } from '@angular/material/sort';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { import {
@ -237,9 +234,17 @@ export class OrganizationComponent implements OnInit, OnDestroy {
} }
onClickChatOpen() { onClickChatOpen() {
if (!!this.selectedUserList && this.selectedUserList.length > 0) { if (!!this.selectedUserList && this.selectedUserList.length > 0) {
// Open Room.
const seq: number[] = []; const seq: number[] = [];
this.selectedUserList.map(user => seq.push(user.seq)); this.selectedUserList.map(user => seq.push(user.seq));
this.store.dispatch(ChatStore.openRoom({ userSeqList: seq })); this.store.dispatch(ChatStore.openRoom({ userSeqList: seq }));
// GNB Change to Chat
this.store.dispatch(
SettingsStore.selectedGnbMenuIndex({
menuIndex: MainMenu.Chat
})
);
} }
} }
onClickConference() { onClickConference() {

View File

@ -1,11 +1,17 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO, KEY_AUTH_INFO } from '@app/types'; import {
KEY_LOGIN_RES_INFO,
KEY_VER_INFO,
KEY_AUTH_INFO,
MainMenu
} from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as SettingsStore from '@app/store/messenger/settings';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
@ -194,6 +200,13 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
this.store.dispatch(ChatStore.openRoom({ userSeqList: [userInfo.seq] })); this.store.dispatch(ChatStore.openRoom({ userSeqList: [userInfo.seq] }));
} }
// GNB Change to Chat
this.store.dispatch(
SettingsStore.selectedGnbMenuIndex({
menuIndex: MainMenu.Chat
})
);
this.dialogRef.close({ closeEvent: 'CHAT' }); this.dialogRef.close({ closeEvent: 'CHAT' });
} }