From 43f071319e1f03a84fa5a639fc4f7f6884bebd5f Mon Sep 17 00:00:00 2001 From: leejinho Date: Sun, 15 Dec 2019 14:01:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9B=B9=EB=A7=81=ED=81=AC=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../native/components/top-bar.component.ts | 63 ++++++++++++++----- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts index f997c267..406ff40b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts @@ -50,20 +50,7 @@ export class TopBarComponent implements OnInit, OnDestroy { private store: Store, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private sessionStorageService: SessionStorageService - ) { - this.loginInfo = this.sessionStorageService.get(KEY_LOGIN_INFO); - const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get< - DaesangUrlInfoResponse - >(KEY_URL_INFO); - - if (!!urlInfo.webLink) { - this.weblink = urlInfo.webLink.filter( - weblink => - urlInfo.webLinkAllowedList.filter(type => type === weblink.key) - .length > 0 - ); - } - } + ) {} ngOnInit() { this.windowStateChanged$ = this.nativeService.windowStateChanged(); @@ -73,6 +60,13 @@ export class TopBarComponent implements OnInit, OnDestroy { select(AppStore.AccountSelector.AuthenticationSelector.loginRes), tap(loginRes => { this.loginRes = loginRes; + + this.loginInfo = this.sessionStorageService.get( + KEY_LOGIN_INFO + ); + + // WebLink init.. + this.initWebLink(); }) ) .subscribe(); @@ -82,6 +76,47 @@ export class TopBarComponent implements OnInit, OnDestroy { ); } + initWebLink(): void { + const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get< + DaesangUrlInfoResponse + >(KEY_URL_INFO); + + if (!!urlInfo && !!urlInfo.webLink) { + this.weblink = urlInfo.webLink.filter( + weblink => + urlInfo.webLinkAllowedList.filter(type => type === weblink.key) + .length > 0 + ); + + if ( + urlInfo.webLinkAllowedList.indexOf('WebLinkMail') > -1 && + urlInfo.webLinkAllowedList.indexOf('WebLinkMailCnt') > -1 + ) { + // 메일 카운트 체크. + const link = urlInfo.webLink.filter( + weblink => weblink.key === 'WebLinkMailCnt' + ); + if (link.length > 0) { + const WebLinkMailCnt = link[0]; + // this.onClickWebLink(WebLinkMailCnt); + } + } + if ( + urlInfo.webLinkAllowedList.indexOf('WebLinkPayment') > -1 && + urlInfo.webLinkAllowedList.indexOf('WebLinkPaymentCnt') > -1 + ) { + // 결제 카운트 체크. + const link = urlInfo.webLink.filter( + weblink => weblink.key === 'WebLinkPaymentCnt' + ); + if (link.length > 0) { + const WebLinkPaymentCnt = link[0]; + // this.onClickWebLink(WebLinkPaymentCnt); + } + } + } + } + ngOnDestroy(): void {} onClickClose() {