1+ import { ToolbarComponent } from './../shared/components/toolbar/toolbar.component' ;
12import { RoomService } from './../shared/services/room.service' ;
23import { AssistantsComponent } from './../shared/components/menu/assistants/assistants.component' ;
34import { UserService } from '../shared/services/user.service' ;
@@ -24,7 +25,7 @@ import { ChatComponent } from '../shared/components/menu/chat/chat.component';
2425import { OvSettings } from '../shared/models/ov-settings' ;
2526import { ApiService } from '../shared/services/api.service' ;
2627import { ThrowStmt } from '@angular/compiler' ;
27- import { trigger , transition , style , animate , query , stagger , animateChild } from '@angular/animations' ;
28+ import { trigger , transition , style , animate } from '@angular/animations' ;
2829
2930@Component ( {
3031 selector : 'app-video-room' ,
@@ -645,6 +646,9 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
645646 if ( data . isHandRaised !== undefined ) {
646647 user . setHandRaised ( data . isHandRaised ) ;
647648 }
649+ if ( data . positionInHandRaiseQueue !== undefined ) {
650+ user . setPositionInHandRaiseQueue ( data . positionInHandRaiseQueue ) ;
651+ }
648652 }
649653 } ) ;
650654 this . remoteUsers . forEach ( ( user : UserModel ) => {
@@ -664,9 +668,15 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
664668 if ( data . avatar !== undefined ) {
665669 user . setUserAvatar ( data . avatar ) ;
666670 }
671+ if ( data . positionInHandRaiseQueue !== undefined ) {
672+ user . setPositionInHandRaiseQueue ( data . positionInHandRaiseQueue ) ;
673+ }
667674 if ( data . isHandRaised !== undefined ) {
675+ const previousHandRaised = user . isHandRaised ( ) ;
668676 user . setHandRaised ( data . isHandRaised ) ;
669- this . raiseOrLowerHand ( user ) ;
677+ if ( previousHandRaised !== user . isHandRaised ( ) ) {
678+ this . raiseOrLowerHand ( user ) ;
679+ }
670680 }
671681 if ( data . isFirstTime ) {
672682 this . showConnectionPopup ( user . getNickname ( ) , true , data . avatar ) ;
@@ -678,7 +688,7 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
678688 }
679689
680690 raiseOrLowerHand ( user : UserModel ) {
681- if ( user . isHandRaised ( ) ) {
691+ if ( user . isHandRaised ( ) ) { //Raise the hand
682692 let unupdatedUser = this . handsRaised . filter ( handRaisedUser => handRaisedUser . connectionId === user . getConnectionId ( ) ) [ 0 ] ;
683693 if ( unupdatedUser ) { //Update the user that was already raising their hand
684694 const index = this . handsRaised . indexOf ( unupdatedUser ) ;
@@ -698,13 +708,17 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
698708 this . recalculatePopupOffsets ( ) ;
699709 }
700710 }
701- } else {
711+ } else { //Lower the hand
702712 this . handsRaised = this . handsRaised . filter ( handRaisedUser => handRaisedUser . connectionId !== user . getConnectionId ( ) ) ;
703713 if ( this . handsRaised . length == 0 ) {
704714 setTimeout ( ( ) => {
705715 this . recalculatePopupOffsets ( ) ;
706716 } , 500 ) ;
707717 }
718+ const localUserPosition = this . localUsers [ 0 ] . getPositionInHandRaiseQueue ( ) ;
719+ if ( user . getPositionInHandRaiseQueue ( ) < localUserPosition ) {
720+ this . localUsers [ 0 ] . setPositionInHandRaiseQueue ( localUserPosition - 1 ) ;
721+ }
708722 }
709723 this . handsRaisedMessage = ( this . handsRaised . length > 1 ? 'And ' + ( this . handsRaised . length - 1 ) + ' other ' + ( this . handsRaised . length === 2 ? 'person' : 'people' ) + ' are' : 'Is' ) + ' raising their hand'
710724 }
@@ -727,8 +741,10 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
727741 }
728742 const connection = event . connection ;
729743 const userDisconnected = this . remoteUsers . filter ( ( user ) => user . getConnectionId ( ) === connection . connectionId ) [ 0 ] ;
730- userDisconnected . setHandRaised ( false ) ;
731- this . raiseOrLowerHand ( userDisconnected ) ;
744+ if ( userDisconnected . isHandRaised ( ) ) {
745+ userDisconnected . setHandRaised ( false ) ;
746+ this . raiseOrLowerHand ( userDisconnected ) ;
747+ }
732748 this . remoteUsers = this . remoteUsers . filter ( ( user ) => user . getConnectionId ( ) !== connection . connectionId ) ;
733749 this . showConnectionPopup ( userDisconnected . getNickname ( ) , false , userDisconnected . getAvatar ( ) ) ;
734750 this . updateModConnections ( ) ;
@@ -763,6 +779,7 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
763779 isVideoActive : user . isVideoActive ( ) ,
764780 isScreenShareActive : user . isScreenShareActive ( ) ,
765781 isHandRaised : user . isHandRaised ( ) ,
782+ positionInHandRaiseQueue : user . getPositionInHandRaiseQueue ( ) ,
766783 nickname : user . getNickname ( ) ,
767784 avatar : user . getAvatar ( ) ,
768785 isFirstTime : isFirstTime ,
0 commit comments