Skip to content

Commit 64856bb

Browse files
fit2botw940853815
andauthored
fix: koko component connectViewCount (#1398)
Co-authored-by: wangruidong <940853815@qq.com>
1 parent 9c5b154 commit 64856bb

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

src/app/services/view.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Injectable } from '@angular/core';
2-
import { View } from '@app/model';
3-
import { BehaviorSubject } from 'rxjs';
4-
import { FaceService } from '@app/services/face';
1+
import {Injectable} from '@angular/core';
2+
import {View} from '@app/model';
3+
import {BehaviorSubject} from 'rxjs';
4+
import {FaceService} from '@app/services/face';
55

66
@Injectable()
77
export class ViewService {
@@ -14,7 +14,8 @@ export class ViewService {
1414
public connectViewCount$ = this.connectViewCount.asObservable();
1515
public state$ = new BehaviorSubject<any>({});
1616

17-
constructor(private _faceSvc: FaceService) {}
17+
constructor(private _faceSvc: FaceService) {
18+
}
1819

1920
addView(view: View) {
2021
this.num += 1;
@@ -25,7 +26,7 @@ export class ViewService {
2526
if (view.connectToken.face_monitor_token) {
2627
this._faceSvc.addMonitoringTab(view.id);
2728
}
28-
this.state$.next({ action: 'add', view: view });
29+
this.state$.next({action: 'add', view: view});
2930
}
3031

3132
activeView(view: View) {
@@ -62,27 +63,27 @@ export class ViewService {
6263
if (view.connectToken.face_monitor_token) {
6364
this._faceSvc.removeMonitoringTab(view.id);
6465
}
65-
this.state$.next({ action: 'close', view: view });
66+
this.state$.next({action: 'close', view: view});
6667
}
6768

6869
addSubViewToCurrentView(view: View) {
6970
this.currentView.subViews.push(view);
7071
const index = this.currentView.subViews.length;
7172
this.setCurrentViewTitle(view, index + 1, 'concat');
7273
this.setCurrentView();
73-
this.state$.next({ action: 'addSub', view: view, currentView: this.currentView });
74+
this.state$.next({action: 'addSub', view: view, currentView: this.currentView});
7475
}
7576

7677
clearSubViewOfCurrentView(view: View) {
7778
const index = this.currentView.subViews.indexOf(view);
7879
this.currentView.subViews.splice(index, 1);
7980
this.setCurrentViewTitle(view, index + 1, 'delete');
8081
this.setCurrentView();
81-
this.state$.next({ action: 'clearSub', view: view, currentView: this.currentView });
82+
this.state$.next({action: 'clearSub', view: view, currentView: this.currentView});
8283
}
8384

8485
setCurrentViewTitle(view, index, status) {
85-
const { name } = this.currentView;
86+
const {name} = this.currentView;
8687
switch (status) {
8788
case 'concat':
8889
this.currentView.name = name + '|' + view.name;
@@ -126,7 +127,7 @@ export class ViewService {
126127

127128
setCurrentView(view: Object = this.currentView) {
128129
this.currentView$.next(view);
129-
this.connectViewCount.next(this.viewList.filter(view => view.connected === true).length);
130-
this.state$.next({ action: 'active', view: view });
130+
this.connectViewCount.next(this.viewList.filter(view => view.connected === true && view.connectMethod.component === 'koko').length);
131+
this.state$.next({action: 'active', view: view});
131132
}
132133
}

0 commit comments

Comments
 (0)