[IMP] mail: rename 'MediaPreview' to 'CallDemoView'

Task-2871939

Part-of: odoo/odoo#93330
This commit is contained in:
Alexandre Kühn
2022-06-11 02:15:15 +02:00
parent dcfc8a91e8
commit 751affdb8a
6 changed files with 29 additions and 29 deletions
@@ -5,7 +5,7 @@ import { registerMessagingComponent } from '@mail/utils/messaging_component';
const { Component } = owl;
export class MediaPreview extends Component {
export class CallDemoView extends Component {
/**
* @override
@@ -17,16 +17,16 @@ export class MediaPreview extends Component {
}
/**
* @returns {MediaPreview}
* @returns {CallDemoView}
*/
get mediaPreview() {
get callDemoView() {
return this.props.record;
}
}
Object.assign(MediaPreview, {
Object.assign(CallDemoView, {
props: { record: Object },
template: 'mail.MediaPreview',
template: 'mail.CallDemoView',
});
registerMessagingComponent(MediaPreview);
registerMessagingComponent(CallDemoView);
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mail.MediaPreview" owl="1">
<t t-if="mediaPreview">
<div class="o_MediaPreview position-relative d-flex justify-content-center" t-attf-class="{{ className }}" t-ref="root">
<video class="o_MediaPreview_videoDisplay shadow rounded bg-dark" height="480" width="640" autoplay="" t-ref="video"/>
<p t-if="mediaPreview.doesBrowserSupportMediaDevices and !mediaPreview.isVideoEnabled" class="o_MediaPreview_mediaDevicesStatus position-absolute text-light">
<t t-name="mail.CallDemoView" owl="1">
<t t-if="callDemoView">
<div class="o_CallDemoView position-relative d-flex justify-content-center" t-attf-class="{{ className }}" t-ref="root">
<video class="o_CallDemoView_videoDisplay shadow rounded bg-dark" height="480" width="640" autoplay="" t-ref="video"/>
<p t-if="callDemoView.doesBrowserSupportMediaDevices and !callDemoView.isVideoEnabled" class="o_CallDemoView_mediaDevicesStatus position-absolute text-light">
Camera is off
</p>
<p t-if="!mediaPreview.doesBrowserSupportMediaDevices" class="o_MediaPreview_mediaDevicesStatus text-light">
<p t-if="!callDemoView.doesBrowserSupportMediaDevices" class="o_CallDemoView_mediaDevicesStatus text-light">
Your browser does not support videoconference
</p>
<div class="o_MediaPreview_buttonsContainer">
<button t-if="!mediaPreview.isMicrophoneEnabled" class="o_MediaPreview_enableMicrophoneButton o_MediaPreview_button btn btn-danger btn-lg rounded-circle p-0 m-3 fa fa-microphone-slash" t-on-click="mediaPreview.onClickEnableMicrophoneButton"/>
<button t-if="mediaPreview.isMicrophoneEnabled" class="o_MediaPreview_disableMicrophoneButton o_MediaPreview_button btn btn-dark btn-lg p-0 m-3 rounded-circle border-light fa fa-microphone" t-on-click="mediaPreview.onClickDisableMicrophoneButton"/>
<button t-if="!mediaPreview.isVideoEnabled" class="o_MediaPreview_enableVideoButton o_MediaPreview_button btn btn-danger btn-lg p-0 m-3 rounded-circle fa fa-eye-slash" t-on-click="mediaPreview.onClickEnableVideoButton"/>
<button t-if="mediaPreview.isVideoEnabled" class="o_MediaPreview_disableVideoButton o_MediaPreview_button btn btn-dark btn-lg p-0 m-3 rounded-circle border-light fa fa-video-camera" t-on-click="mediaPreview.onClickDisableVideoButton"/>
<div class="o_CallDemoView_buttonsContainer">
<button t-if="!callDemoView.isMicrophoneEnabled" class="o_CallDemoView_enableMicrophoneButton o_CallDemoView_button btn btn-danger btn-lg rounded-circle p-0 m-3 fa fa-microphone-slash" t-on-click="callDemoView.onClickEnableMicrophoneButton"/>
<button t-if="callDemoView.isMicrophoneEnabled" class="o_CallDemoView_disableMicrophoneButton o_CallDemoView_button btn btn-dark btn-lg p-0 m-3 rounded-circle border-light fa fa-microphone" t-on-click="callDemoView.onClickDisableMicrophoneButton"/>
<button t-if="!callDemoView.isVideoEnabled" class="o_CallDemoView_enableVideoButton o_CallDemoView_button btn btn-danger btn-lg p-0 m-3 rounded-circle fa fa-eye-slash" t-on-click="callDemoView.onClickEnableVideoButton"/>
<button t-if="callDemoView.isVideoEnabled" class="o_CallDemoView_disableVideoButton o_CallDemoView_button btn btn-dark btn-lg p-0 m-3 rounded-circle border-light fa fa-video-camera" t-on-click="callDemoView.onClickDisableVideoButton"/>
</div>
<audio class="o_MediaPreview_audioPlayer" autoplay="" t-ref="audio"/>
<audio class="o_CallDemoView_audioPlayer" autoplay="" t-ref="audio"/>
</div>
</t>
</t>
@@ -5,12 +5,12 @@
<t t-if="welcomeView">
<div class="o_WelcomeView h-100 d-flex flex-column justify-content-center align-items-center bg-light" t-attf-class="{{ className }}" t-ref="root">
<h1 class="font-weight-light">
<span t-if="welcomeView.mediaPreview">You've been invited to a meeting!</span>
<span t-if="!welcomeView.mediaPreview">You've been invited to a chat!</span>
<span t-if="welcomeView.callDemoView">You've been invited to a meeting!</span>
<span t-if="!welcomeView.callDemoView">You've been invited to a chat!</span>
</h1>
<h2 class="m-5" t-esc="messaging.companyName"/>
<div class="d-flex justify-content-center">
<MediaPreview t-if="welcomeView.mediaPreview" className="'mr-5'" record="welcomeView.mediaPreview"/>
<CallDemoView t-if="welcomeView.callDemoView" className="'mr-5'" record="welcomeView.callDemoView"/>
<div class="d-flex flex-column justify-content-center">
<t t-if="messaging.currentGuest">
<label class="o_WelcomeView_guestNameInputLabel text-center fs-4" t-att-for="welcomeView.guestNameInputUniqueId">What's your name?</label>
@@ -44,9 +44,9 @@ registerModel({
pendingGuestName: this.messaging.currentGuest && this.messaging.currentGuest.name,
}),
});
if (this.welcomeView.mediaPreview) {
this.welcomeView.mediaPreview.enableMicrophone();
this.welcomeView.mediaPreview.enableVideo();
if (this.welcomeView.callDemoView) {
this.welcomeView.callDemoView.enableMicrophone();
this.welcomeView.callDemoView.enableVideo();
}
},
},
@@ -4,7 +4,7 @@ import { attr, one } from '@mail/model/model_field';
import { registerModel } from '@mail/model/model_core';
registerModel({
name: 'MediaPreview',
name: 'CallDemoView',
identifyingFields: ['welcomeView'],
recordMethods: {
/**
@@ -174,7 +174,7 @@ registerModel({
* States the welcome view containing this media preview.
*/
welcomeView: one('WelcomeView', {
inverse: 'mediaPreview',
inverse: 'callDemoView',
readonly: true,
}),
},
@@ -93,7 +93,7 @@ registerModel({
* @private
* @returns {FieldCommand}
*/
_computeMediaPreview() {
_computeCallDemoView() {
return (this.channel && this.channel.defaultDisplayMode === 'video_full_screen')
? insertAndReplace()
: clear();
@@ -182,8 +182,8 @@ registerModel({
/**
* States the media preview embedded in this welcome view.
*/
mediaPreview: one('MediaPreview', {
compute: '_computeMediaPreview',
callDemoView: one('CallDemoView', {
compute: '_computeCallDemoView',
inverse: 'welcomeView',
isCausal: true,
readonly: true,