# All files / src/lib/components/footer footer.component.ts

88% Statements 22/25
42.3% Branches 11/26
87.5% Functions 7/8
89.47% Lines 17/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    371x
    1x
    1x
    1x
    1x

    1x

    1x
    1x

    1x

    1x
    1x

    1x
    1x
    1x

    1x

    1x
     import { Component, OnDestroy, OnInit } from '@angular/core';
    import { Subscription } from 'rxjs';
    impoIrt { RemoteUserService } from '../../../public-api';
    import { UserName } from '../../models/username.model';
    import { VideoType } from '../../models/video-type.model';

    @Component({
    	selector: 'ov-footer',
    	templateUrl: './footer.component.html',
    	styleUrls: ['./footer.component.css']
    })
    export class FooterComponent implements OnInit, OnDestroy {
    	participantsNames: string[] = [];
    	private remoteUserNameSubscription: Subscription;

    	constructor(private remoteUserService: RemoteUserService) {}
    	ngOnInit(): void {
    		this.subscribeToUsersName();
    	}
    	ngOnDestroy(): void {
    		if (this.remoteUserNameSubscription) this.remoteUserNameSubscription.unsubscribe();
    	}

    	private subscribeToUsersName() {
    		this.remoteUserNameSubscription = this.remoteUserService.remoteUserNameList.subscribe((userNameList: UserName[]) => {
    			this.participantsNames = [];

    			userNameList.forEach((names) => {
    				if (!names.nickname.includes(VideoType.SCREEN)) {
    					this.participantsNames.push(names.nickname);
    				}
    			});
    			this.participantsNames = [...this.participantsNames];
    		});
    	}
    }