Merge pull request #5502 from tsiegleauq/enter-animation-without-css

Replace meeting room keyframe animation
This commit is contained in:
Emanuel Schütze 2020-08-12 18:43:50 +02:00 committed by GitHub
commit 2b3766b758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 31 deletions

View File

@ -90,12 +90,7 @@
(click)="enterConversation()" (click)="enterConversation()"
matTooltip="{{ 'Enter live conference' | translate }}" matTooltip="{{ 'Enter live conference' | translate }}"
> >
<mat-icon <mat-icon color="primary" [@fadeInOut]="isEnterMeetingRoomVisible" (@fadeInOut.done)="triggerMeetingRoomButtonAnimation()">
color="primary"
[ngClass]="{
'enter-meeting-room': !canManageSpeaker
}"
>
meeting_room meeting_room
</mat-icon> </mat-icon>
</button> </button>

View File

@ -75,22 +75,6 @@
text-align: center; text-align: center;
margin: auto $wrapper-padding auto 0; margin: auto $wrapper-padding auto 0;
} }
/**
* appear animation
*/
@keyframes fade-in-out {
from {
opacity: 100%;
}
to {
opacity: 25%;
}
}
.enter-meeting-room {
animation: fade-in-out 1s linear infinite alternate;
}
} }
.stream-width-wrapper { .stream-width-wrapper {

View File

@ -1,10 +1,11 @@
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { StorageMap } from '@ngx-pwa/local-storage'; import { StorageMap } from '@ngx-pwa/local-storage';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { distinctUntilChanged, map } from 'rxjs/operators'; import { delay, distinctUntilChanged, map } from 'rxjs/operators';
import { ConstantsService } from 'app/core/core-services/constants.service'; import { ConstantsService } from 'app/core/core-services/constants.service';
import { OperatorService } from 'app/core/core-services/operator.service'; import { OperatorService } from 'app/core/core-services/operator.service';
@ -55,6 +56,23 @@ enum ConferenceState {
selector: 'os-jitsi', selector: 'os-jitsi',
templateUrl: './jitsi.component.html', templateUrl: './jitsi.component.html',
styleUrls: ['./jitsi.component.scss'], styleUrls: ['./jitsi.component.scss'],
animations: [
trigger('fadeInOut', [
state(
'true',
style({
opacity: 1
})
),
state(
'false',
style({
opacity: 0.2
})
),
transition('true <=> false', animate('1s'))
])
],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestroy { export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestroy {
@ -114,15 +132,11 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
return this.roomPassword?.length > 0; return this.roomPassword?.length > 0;
} }
public get canSeeLiveStream(): boolean {
return this.operator.hasPerms(this.permission.coreCanSeeLiveStream);
}
private isOnCurrentLos: boolean; private isOnCurrentLos: boolean;
public get canManageSpeaker(): boolean { public canSeeLiveStream: boolean;
return this.operator.hasPerms(this.permission.agendaCanManageListOfSpeakers);
} public canManageSpeaker: boolean;
public get isAccessPermitted(): boolean { public get isAccessPermitted(): boolean {
return !this.restricted || this.canManageSpeaker || this.isOnCurrentLos; return !this.restricted || this.canManageSpeaker || this.isOnCurrentLos;
@ -138,6 +152,7 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
*/ */
public state = ConferenceState; public state = ConferenceState;
public currentState: ConferenceState; public currentState: ConferenceState;
public isEnterMeetingRoomVisible = true;
private configOverwrite = { private configOverwrite = {
startAudioOnly: false, startAudioOnly: false,
@ -216,6 +231,14 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
await this.stopConference(); await this.stopConference();
} }
public triggerMeetingRoomButtonAnimation(): void {
if (this.canManageSpeaker) {
this.isEnterMeetingRoomVisible = true;
} else {
this.isEnterMeetingRoomVisible = !this.isEnterMeetingRoomVisible;
}
}
private async stopConference(): Promise<void> { private async stopConference(): Promise<void> {
await this.stopJitsi(); await this.stopJitsi();
if (this.streamActiveInAnotherTab && this.streamRunning) { if (this.streamActiveInAnotherTab && this.streamRunning) {
@ -225,6 +248,16 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
private async setUp(): Promise<void> { private async setUp(): Promise<void> {
this.subscriptions.push( this.subscriptions.push(
// if the operators users has changes, check if we have to start the animation
this.operator
.getUserObservable()
.pipe(delay(0))
.subscribe(() => {
this.canManageSpeaker = this.operator.hasPerms(this.permission.agendaCanManageListOfSpeakers);
this.canSeeLiveStream = this.operator.hasPerms(this.permission.coreCanSeeLiveStream);
this.isEnterMeetingRoomVisible = this.canManageSpeaker;
}),
this.storageMap this.storageMap
.watch(this.RTC_LOGGED_STORAGE_KEY) .watch(this.RTC_LOGGED_STORAGE_KEY)
.pipe(distinctUntilChanged()) .pipe(distinctUntilChanged())
@ -310,7 +343,7 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
) )
.subscribe(isOnList => { .subscribe(isOnList => {
this.isOnCurrentLos = isOnList; this.isOnCurrentLos = isOnList;
console.log('this.isOnCurrentLos: ', this.isOnCurrentLos); this.triggerMeetingRoomButtonAnimation();
if (!this.isAccessPermitted) { if (!this.isAccessPermitted) {
this.viewStream(); this.viewStream();