Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/app/services/view.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { View } from '@app/model';
import { BehaviorSubject } from 'rxjs';
import { FaceService } from '@app/services/face';
import {Injectable} from '@angular/core';
import {View} from '@app/model';
import {BehaviorSubject} from 'rxjs';
import {FaceService} from '@app/services/face';

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

constructor(private _faceSvc: FaceService) {}
constructor(private _faceSvc: FaceService) {
}

addView(view: View) {
this.num += 1;
Expand All @@ -25,7 +26,7 @@ export class ViewService {
if (view.connectToken.face_monitor_token) {
this._faceSvc.addMonitoringTab(view.id);
}
this.state$.next({ action: 'add', view: view });
this.state$.next({action: 'add', view: view});
}

activeView(view: View) {
Expand Down Expand Up @@ -62,27 +63,27 @@ export class ViewService {
if (view.connectToken.face_monitor_token) {
this._faceSvc.removeMonitoringTab(view.id);
}
this.state$.next({ action: 'close', view: view });
this.state$.next({action: 'close', view: view});
}

addSubViewToCurrentView(view: View) {
this.currentView.subViews.push(view);
const index = this.currentView.subViews.length;
this.setCurrentViewTitle(view, index + 1, 'concat');
this.setCurrentView();
this.state$.next({ action: 'addSub', view: view, currentView: this.currentView });
this.state$.next({action: 'addSub', view: view, currentView: this.currentView});
}

clearSubViewOfCurrentView(view: View) {
const index = this.currentView.subViews.indexOf(view);
this.currentView.subViews.splice(index, 1);
this.setCurrentViewTitle(view, index + 1, 'delete');
this.setCurrentView();
this.state$.next({ action: 'clearSub', view: view, currentView: this.currentView });
this.state$.next({action: 'clearSub', view: view, currentView: this.currentView});
}

setCurrentViewTitle(view, index, status) {
const { name } = this.currentView;
const {name} = this.currentView;
switch (status) {
case 'concat':
this.currentView.name = name + '|' + view.name;
Expand Down Expand Up @@ -126,7 +127,7 @@ export class ViewService {

setCurrentView(view: Object = this.currentView) {
this.currentView$.next(view);
this.connectViewCount.next(this.viewList.filter(view => view.connected === true).length);
this.state$.next({ action: 'active', view: view });
this.connectViewCount.next(this.viewList.filter(view => view.connected === true && view.connectMethod.component === 'koko').length);
this.state$.next({action: 'active', view: view});
}
}