From 2b4846d865106a2ab828dbbd5cb8c56ce25b9f2d Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 23 Mar 2020 17:15:48 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EC=B9=B4=EC=9A=B4?= =?UTF-8?q?=ED=8A=B8=205=EB=B6=84=EB=A7=88=EB=8B=A4=20=EA=B0=B1=EC=8B=A0?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=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 | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 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 1ebe5c2f..8829f193 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 @@ -117,6 +117,8 @@ export class TopBarComponent implements OnInit, OnDestroy { webLinkBadgeMail = 0; webLinkBadgePayment = 0; + webLinkbadgeEmailCountInterval: any; + appVersion: string; WebLinkType = WebLinkType; @@ -221,6 +223,10 @@ export class TopBarComponent implements OnInit, OnDestroy { this.zoomSubscription.unsubscribe(); this.zoomSubscription = undefined; } + + if (!!this.webLinkbadgeEmailCountInterval) { + clearInterval(this.webLinkbadgeEmailCountInterval); + } } initWebLink(loginRes: LoginResponse): void { @@ -262,14 +268,18 @@ export class TopBarComponent implements OnInit, OnDestroy { .replace(/(\(%USER_ID%\))/g, loginId) .replace(/(\(%USER_PASS%\))/g, loginPw); - this.daesangApiService - .retrieveMailCount(url) - .pipe( - take(1), - map(res => (this.webLinkBadgeMail = res.count)), - catchError(error => of(this.logger.log(error))) - ) - .subscribe(); + if (!this.webLinkbadgeEmailCountInterval) { + this.webLinkbadgeEmailCountInterval = setInterval(() => { + this.daesangApiService + .retrieveMailCount(url) + .pipe( + take(1), + map(res => (this.webLinkBadgeMail = res.count)), + catchError(error => of(this.logger.log(error))) + ) + .subscribe(); + }, 5 * 60 * 1000); + } } } if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Payment) > -1) {