Skip to content

Commit

Permalink
Disable av preference page when a call is ongoing (#6654)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc authored May 29, 2019
1 parent 8e08a27 commit 84c9daf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/page/template/content/preferences-av.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<div class="preferences-titlebar" data-bind="text: t('preferencesAV')"></div>
<div class="preferences-content" data-bind="fadingscrollbar">

<!-- ko if: hasOngoingCall() -->
Changing the settings during the call is temporarily unavailable
<!-- /ko -->
<!-- ko if: !hasOngoingCall() -->
<!-- ko if: deviceSupport.audioInput() -->
<section class="preferences-section">
<header class="preferences-header preferences-av-header" data-bind="text: t('preferencesAVMicrophone')"></header>
Expand Down Expand Up @@ -96,6 +100,7 @@
<!-- /ko -->
</section>
<!-- /ko -->
<!-- /ko -->

</div>
</div>
7 changes: 7 additions & 0 deletions src/script/view_model/content/PreferencesAVViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ z.viewModel.content.PreferencesAVViewModel = class PreferencesAVViewModel {
}

constructor(mainViewModel, contentViewModel, repositories) {
this.hasOngoingCall = ko.observable(false);
this.initiateDevices = this.initiateDevices.bind(this);
this.releaseDevices = this.releaseDevices.bind(this);

this.logger = getLogger('z.viewModel.content.PreferencesAVViewModel');

this.mediaRepository = repositories.media;
this.userRepository = repositories.user;
this.callingRepository = repositories.calling;

this.isActivatedAccount = this.userRepository.isActivatedAccount;

Expand Down Expand Up @@ -91,6 +93,11 @@ z.viewModel.content.PreferencesAVViewModel = class PreferencesAVViewModel {
* @returns {undefined} No return value
*/
initiateDevices() {
if (this.callingRepository.joinedCall()) {
this.hasOngoingCall(true);
return;
}
this.hasOngoingCall(false);
this.isVisible = true;

this._getMediaStream().then(mediaStream => {
Expand Down

0 comments on commit 84c9daf

Please sign in to comment.