unreadcount 소스 개선.

This commit is contained in:
leejinho 2020-04-03 14:10:08 +09:00
parent d219226aa3
commit 0872d2eb88

View File

@ -1,4 +1,11 @@
import { map, tap, take, catchError, debounce } from 'rxjs/operators'; import {
map,
tap,
take,
catchError,
debounce,
withLatestFrom
} from 'rxjs/operators';
import { import {
Component, Component,
OnInit, OnInit,
@ -18,30 +25,15 @@ import * as EventStore from '@app/store/messenger/event';
import * as MessageStore from '@app/store/messenger/message'; import * as MessageStore from '@app/store/messenger/message';
import * as StatusStore from '@app/store/messenger/status'; import * as StatusStore from '@app/store/messenger/status';
import * as SettingsStore from '@app/store/messenger/settings'; import * as SettingsStore from '@app/store/messenger/settings';
import { import { Observable, Subscription, of, timer, EMPTY } from 'rxjs';
Observable, import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
Subscription,
of,
timer,
EMPTY,
combineLatest
} from 'rxjs';
import {
UCAP_NATIVE_SERVICE,
NativeService,
WindowState
} from '@ucap-webmessenger/native';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { StatusType, StatusCode } from '@ucap-webmessenger/core'; import { StatusType, StatusCode } from '@ucap-webmessenger/core';
import { import {
DialogService, DialogService,
ConfirmDialogComponent,
ConfirmDialogResult,
AlertDialogComponent, AlertDialogComponent,
AlertDialogResult, AlertDialogResult,
AlertDialogData, AlertDialogData
ConfirmDialogData
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { import {
ProfileDialogComponent, ProfileDialogComponent,
@ -110,7 +102,6 @@ export class MainPageComponent implements OnInit, OnDestroy {
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private store: Store<any>, private store: Store<any>,
private ngZone: NgZone, private ngZone: NgZone,
private statusProtocolService: StatusProtocolService,
private daesangProtocolService: DaesangProtocolService, private daesangProtocolService: DaesangProtocolService,
private conferenceService: ConferenceService, private conferenceService: ConferenceService,
private callService: CallService, private callService: CallService,
@ -168,17 +159,20 @@ export class MainPageComponent implements OnInit, OnDestroy {
}) })
); );
this.windowFocusChangedSubscription = combineLatest([ this.windowFocusChangedSubscription = this.nativeService
this.nativeService.windowFocusChanged(), .windowFocusChanged()
this.store.pipe(select(AppStore.MessengerSelector.RoomSelector.roomInfo)), .pipe(
withLatestFrom(
this.store.pipe(
select(AppStore.MessengerSelector.RoomSelector.roomInfo)
),
this.store.pipe( this.store.pipe(
select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex) select(AppStore.MessengerSelector.SettingsSelector.gnbMenuIndex)
), ),
this.store.pipe( this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.selectAllInfoList) select(AppStore.MessengerSelector.EventSelector.selectAllInfoList)
) )
]) ),
.pipe(
map(([windowFocusState, roomInfo, gnbMenuIndex, eventList]) => { map(([windowFocusState, roomInfo, gnbMenuIndex, eventList]) => {
if (windowFocusState === ElectronBrowserWindowChannel.Focus) { if (windowFocusState === ElectronBrowserWindowChannel.Focus) {
if ( if (