[IMP] mail: rename "mailRtc" fields to "rtc"
X-original-commit: 8db877c99f3b3c405e7a51920a574edfeb7a18d5 Part-of: odoo/odoo#77107
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@
|
||||
</t>
|
||||
</div>
|
||||
<t t-if="categoryItem.channel and categoryItem.channel.rtcSessions.length">
|
||||
<div class="o_DiscussSidebarCategoryItem_item o_DiscussSidebarCategoryItem_callIndicator fa fa-volume-up" t-att-class="{ 'o-isCalling': categoryItem.channel.mailRtc }"/>
|
||||
<div class="o_DiscussSidebarCategoryItem_item o_DiscussSidebarCategoryItem_callIndicator fa fa-volume-up" t-att-class="{ 'o-isCalling': categoryItem.channel.rtc }"/>
|
||||
</t>
|
||||
<t t-if="categoryItem.counter > 0">
|
||||
<div class="o_DiscussSidebarCategoryItem_counter o_DiscussSidebarCategoryItem_item badge badge-pill">
|
||||
|
||||
@@ -15,7 +15,7 @@ export class RtcActivityNotice extends Component {
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
_onClick(ev) {
|
||||
this.messaging.mailRtc.channel.open();
|
||||
this.messaging.rtc.channel.open();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<t t-name="mail.RtcActivityNotice" owl="1">
|
||||
<li class="o_RtcActivityNotice">
|
||||
<RtcInvitations/>
|
||||
<t t-if="messaging.mailRtc.channel">
|
||||
<t t-set="title">Open conference: <t t-esc="messaging.mailRtc.channel.displayName"/></t>
|
||||
<t t-if="messaging.rtc.channel">
|
||||
<t t-set="title">Open conference: <t t-esc="messaging.rtc.channel.displayName"/></t>
|
||||
<a class="o_RtcActivityNotice_button" t-att-title="title" role="button" t-on-click="_onClick">
|
||||
<div class="o_RtcActivityNotice_buttonContent">
|
||||
<span class="o_RtcActivityNotice_buttonTitle" t-esc="messaging.mailRtc.channel.displayName"/>
|
||||
<span class="o_RtcActivityNotice_buttonTitle" t-esc="messaging.rtc.channel.displayName"/>
|
||||
<i class="o_RtcActivityNotice_outputIndicator fa" t-att-class="{
|
||||
'fa-microphone': !messaging.mailRtc.sendDisplay and !messaging.mailRtc.sendUserVideo,
|
||||
'fa-video-camera': messaging.mailRtc.sendUserVideo,
|
||||
'fa-desktop': messaging.mailRtc.sendDisplay,
|
||||
'fa-microphone': !messaging.rtc.sendDisplay and !messaging.rtc.sendUserVideo,
|
||||
'fa-video-camera': messaging.rtc.sendUserVideo,
|
||||
'fa-desktop': messaging.rtc.sendDisplay,
|
||||
}"/>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@
|
||||
<t t-if="!callParticipantCard.isMinimized">
|
||||
<span class="o_RtcCallParticipantCard_name" t-esc="callParticipantCard.name"/>
|
||||
</t>
|
||||
<t t-if="callParticipantCard.rtcSession.isScreenSharingOn and callParticipantCard.isMinimized and !callParticipantCard.rtcSession.channel.mailRtc">
|
||||
<t t-if="callParticipantCard.rtcSession.isScreenSharingOn and callParticipantCard.isMinimized and !callParticipantCard.rtcSession.channel.rtc">
|
||||
<span class="o_RtcCallParticipantCard_liveIndicator badge-pill o-isMinimized" title="live" aria-label="live">
|
||||
LIVE
|
||||
</span>
|
||||
@@ -60,17 +60,17 @@
|
||||
<i class="fa fa-deaf"/>
|
||||
</span>
|
||||
</t>
|
||||
<t t-if="callParticipantCard.rtcSession.channel.mailRtc and callParticipantCard.rtcSession.isAudioInError">
|
||||
<t t-if="callParticipantCard.rtcSession.channel.rtc and callParticipantCard.rtcSession.isAudioInError">
|
||||
<span class="o_RtcCallParticipantCard_overlayTopElement text-danger" title="Issue with audio">
|
||||
<i class="fa fa-exclamation-triangle"/>
|
||||
</span>
|
||||
</t>
|
||||
<t t-if="callParticipantCard.rtcSession.channel.mailRtc and !callParticipantCard.rtcSession.mailRtc and !['connected', 'completed'].includes(callParticipantCard.rtcSession.connectionState)">
|
||||
<t t-if="callParticipantCard.rtcSession.channel.rtc and !callParticipantCard.rtcSession.rtc and !['connected', 'completed'].includes(callParticipantCard.rtcSession.connectionState)">
|
||||
<span class="o_RtcCallParticipantCard_overlayTopElement" t-att-title="callParticipantCard.rtcSession.connectionState">
|
||||
<i class="fa fa-lg fa-signal o_RtcCallParticipantCard_connectionState"/>
|
||||
</span>
|
||||
</t>
|
||||
<t t-if="callParticipantCard.rtcSession.isScreenSharingOn and !callParticipantCard.isMinimized and !callParticipantCard.rtcSession.channel.mailRtc">
|
||||
<t t-if="callParticipantCard.rtcSession.isScreenSharingOn and !callParticipantCard.isMinimized and !callParticipantCard.rtcSession.channel.rtc">
|
||||
<span class="o_RtcCallParticipantCard_liveIndicator badge-pill" title="live" aria-label="live">
|
||||
LIVE
|
||||
</span>
|
||||
|
||||
@@ -5,44 +5,44 @@
|
||||
<div class="o_RtcController">
|
||||
<t t-if="rtcController">
|
||||
<div class="o_RtcController_buttons">
|
||||
<t t-if="rtcController.callViewer.threadView.thread.mailRtc and messaging.mailRtc.currentRtcSession">
|
||||
<t t-if="messaging.mailRtc.currentRtcSession.isMuted"><t t-set="microphoneTitle">Unmute</t></t>
|
||||
<t t-if="rtcController.callViewer.threadView.thread.rtc and messaging.rtc.currentRtcSession">
|
||||
<t t-if="messaging.rtc.currentRtcSession.isMuted"><t t-set="microphoneTitle">Unmute</t></t>
|
||||
<t t-else=""><t t-set="microphoneTitle">Mute</t></t>
|
||||
<button class="o_RtcController_button"
|
||||
t-att-class="{ 'o-isActive': !messaging.mailRtc.currentRtcSession.isMuted, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-class="{ 'o-isActive': !messaging.rtc.currentRtcSession.isMuted, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-aria-label="microphoneTitle"
|
||||
t-att-title="microphoneTitle"
|
||||
t-on-click="rtcController.onClickMicrophone">
|
||||
<div class="o_RtcController_buttonIconWrapper" t-att-class="{ 'o-isSmall': rtcController.isSmall }">
|
||||
<i class="fa" t-att-class="{
|
||||
'fa-lg': !rtcController.isSmall,
|
||||
'fa-microphone': !messaging.mailRtc.currentRtcSession.isMuted,
|
||||
'fa-microphone-slash': messaging.mailRtc.currentRtcSession.isMuted,
|
||||
'text-danger': messaging.mailRtc.currentRtcSession.isMuted,
|
||||
'fa-microphone': !messaging.rtc.currentRtcSession.isMuted,
|
||||
'fa-microphone-slash': messaging.rtc.currentRtcSession.isMuted,
|
||||
'text-danger': messaging.rtc.currentRtcSession.isMuted,
|
||||
}"/>
|
||||
</div>
|
||||
</button>
|
||||
<t t-if="messaging.mailRtc.currentRtcSession.isDeaf"><t t-set="headphoneTitle">Undeafen</t></t>
|
||||
<t t-if="messaging.rtc.currentRtcSession.isDeaf"><t t-set="headphoneTitle">Undeafen</t></t>
|
||||
<t t-else=""><t t-set="headphoneTitle">Deafen</t></t>
|
||||
<button class="o_RtcController_button"
|
||||
t-att-class="{ 'o-isActive': !messaging.mailRtc.currentRtcSession.isDeaf, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-class="{ 'o-isActive': !messaging.rtc.currentRtcSession.isDeaf, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-aria-label="headphoneTitle"
|
||||
t-att-title="headphoneTitle"
|
||||
t-on-click="rtcController.onClickDeafen">
|
||||
<div class="o_RtcController_buttonIconWrapper" t-att-class="{ 'o-isSmall': rtcController.isSmall }">
|
||||
<i class="fa" t-att-class="{
|
||||
'fa-lg': !rtcController.isSmall,
|
||||
'fa-headphones': !messaging.mailRtc.currentRtcSession.isDeaf,
|
||||
'fa-deaf': messaging.mailRtc.currentRtcSession.isDeaf,
|
||||
'text-danger': messaging.mailRtc.currentRtcSession.isDeaf,
|
||||
'fa-headphones': !messaging.rtc.currentRtcSession.isDeaf,
|
||||
'fa-deaf': messaging.rtc.currentRtcSession.isDeaf,
|
||||
'text-danger': messaging.rtc.currentRtcSession.isDeaf,
|
||||
}"/>
|
||||
</div>
|
||||
</button>
|
||||
<t t-if="messaging.mailRtc.sendUserVideo"><t t-set="cameraTitle">Stop camera</t></t>
|
||||
<t t-if="messaging.rtc.sendUserVideo"><t t-set="cameraTitle">Stop camera</t></t>
|
||||
<t t-else=""><t t-set="cameraTitle">Turn camera on</t></t>
|
||||
<button class="o_RtcController_button o_RtcController_videoButton"
|
||||
t-att-class="{
|
||||
'o-isActive': messaging.mailRtc.sendUserVideo,
|
||||
'o-isActive': messaging.rtc.sendUserVideo,
|
||||
'o-isSmall': rtcController.isSmall,
|
||||
}"
|
||||
t-att-aria-label="cameraTitle"
|
||||
@@ -52,11 +52,11 @@
|
||||
<i class="fa fa-video-camera" t-att-class="{ 'fa-lg': !rtcController.isSmall }"/>
|
||||
</div>
|
||||
</button>
|
||||
<t t-if="messaging.mailRtc.sendDisplay"><t t-set="displayTitle">Stop screen sharing</t></t>
|
||||
<t t-if="messaging.rtc.sendDisplay"><t t-set="displayTitle">Stop screen sharing</t></t>
|
||||
<t t-else=""><t t-set="displayTitle">Share screen</t></t>
|
||||
<button class="o_RtcController_button o_RtcController_videoButton"
|
||||
t-att-class="{
|
||||
'o-isActive': messaging.mailRtc.sendDisplay,
|
||||
'o-isActive': messaging.rtc.sendDisplay,
|
||||
'o-isSmall': rtcController.isSmall,
|
||||
}"
|
||||
t-att-aria-label="displayTitle"
|
||||
@@ -81,7 +81,7 @@
|
||||
</t>
|
||||
</Popover>
|
||||
</t>
|
||||
<t t-if="!rtcController.callViewer.threadView.thread.mailRtc">
|
||||
<t t-if="!rtcController.callViewer.threadView.thread.rtc">
|
||||
<button class="o_RtcController_button o_RtcController_callToggle"
|
||||
t-att-class="{ 'o-isSmall': rtcController.isSmall }"
|
||||
aria-label="Join Video Call"
|
||||
@@ -94,7 +94,7 @@
|
||||
</button>
|
||||
</t>
|
||||
<t t-if="rtcController.callViewer.threadView.thread">
|
||||
<t t-if="rtcController.callViewer.threadView.thread.rtcInvitingSession and !rtcController.callViewer.threadView.thread.mailRtc">
|
||||
<t t-if="rtcController.callViewer.threadView.thread.rtcInvitingSession and !rtcController.callViewer.threadView.thread.rtc">
|
||||
<button class="o_RtcController_button o_RtcController_callToggle o-isActive"
|
||||
t-att-class="{ 'o-isSmall': rtcController.isSmall }"
|
||||
aria-label="Reject"
|
||||
@@ -106,11 +106,11 @@
|
||||
</div>
|
||||
</button>
|
||||
</t>
|
||||
<t t-if="rtcController.callViewer.threadView.thread.mailRtc"><t t-set="phoneTitle">Disconnect</t></t>
|
||||
<t t-if="rtcController.callViewer.threadView.thread.rtc"><t t-set="phoneTitle">Disconnect</t></t>
|
||||
<t t-else=""><t t-set="phoneTitle">Join Call</t></t>
|
||||
<button class="o_RtcController_button o_RtcController_callToggle"
|
||||
t-att-aria-label="phoneTitle"
|
||||
t-att-class="{ 'o-isActive': !!rtcController.callViewer.threadView.thread.mailRtc, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-class="{ 'o-isActive': !!rtcController.callViewer.threadView.thread.rtc, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-disabled="rtcController.callViewer.threadView.thread.hasPendingRtcRequest"
|
||||
t-att-title="phoneTitle"
|
||||
t-on-click="rtcController.onClickToggleAudioCall">
|
||||
|
||||
@@ -49,15 +49,15 @@ function factory(dependencies) {
|
||||
const channel = this.messaging.models['mail.thread'].insert(
|
||||
this.messaging.models['mail.thread'].convertData(channelData)
|
||||
);
|
||||
if (this.thread.mailRtc) {
|
||||
if (this.thread.rtc) {
|
||||
/**
|
||||
* if we were in a RTC call on the current thread, we move to the new group chat.
|
||||
* A smoother transfer would be moving the RTC sessions from one channel to
|
||||
* the other (server-side too), but it would be considerably more complex.
|
||||
*/
|
||||
await this.async(() => channel.toggleCall({
|
||||
startWithVideo: !!this.thread.mailRtc.videoTrack,
|
||||
videoType: this.thread.mailRtc.sendUserVideo ? 'user-video' : 'display',
|
||||
startWithVideo: !!this.thread.rtc.videoTrack,
|
||||
videoType: this.thread.rtc.sendUserVideo ? 'user-video' : 'display',
|
||||
}));
|
||||
}
|
||||
channel.open();
|
||||
@@ -68,7 +68,7 @@ function factory(dependencies) {
|
||||
args: [[this.thread.id]],
|
||||
kwargs: {
|
||||
partner_ids: this.selectedPartners.map(partner => partner.id),
|
||||
invite_to_rtc_call: !!this.thread.mailRtc,
|
||||
invite_to_rtc_call: !!this.thread.rtc,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ function factory(dependencies) {
|
||||
* @private
|
||||
*/
|
||||
_onChangeFocusedRtcSession() {
|
||||
this.mailRtc.filterIncomingVideoTraffic(this.focusedRtcSession && [this.focusedRtcSession.peerToken]);
|
||||
this.rtc.filterIncomingVideoTraffic(this.focusedRtcSession && [this.focusedRtcSession.peerToken]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -345,11 +345,6 @@ function factory(dependencies) {
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
mailRtc: one2one('mail.rtc', {
|
||||
default: create(),
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
/**
|
||||
* Determines after how much time in ms a "loading" indicator should be
|
||||
* shown. Useful to avoid flicker for almost instant loading.
|
||||
@@ -395,6 +390,11 @@ function factory(dependencies) {
|
||||
ringingThreads: many2many('mail.thread', {
|
||||
compute: '_computeRingingThreads',
|
||||
}),
|
||||
rtc: one2one('mail.rtc', {
|
||||
default: create(),
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
soundEffects: one2one('mail.sound_effects', {
|
||||
default: create(),
|
||||
isCausal: true,
|
||||
|
||||
+4
-4
@@ -534,7 +534,7 @@ function factory(dependencies) {
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
if (channel.mailRtc) {
|
||||
if (channel.rtc) {
|
||||
return;
|
||||
}
|
||||
if (rtcSession) {
|
||||
@@ -551,7 +551,7 @@ function factory(dependencies) {
|
||||
*/
|
||||
_handleNotificationRtcPeerToPeer({ sender, notifications }) {
|
||||
for (const content of notifications) {
|
||||
this.messaging.mailRtc.handleNotification(sender, content);
|
||||
this.messaging.rtc.handleNotification(sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,9 +572,9 @@ function factory(dependencies) {
|
||||
* @param {number} [sessionId]
|
||||
*/
|
||||
async _handleNotificationRtcSessionEnded({ sessionId }) {
|
||||
const currentSession = this.messaging.mailRtc.currentRtcSession;
|
||||
const currentSession = this.messaging.rtc.currentRtcSession;
|
||||
if (currentSession && currentSession.id === sessionId) {
|
||||
this.messaging.mailRtc.channel.endCall();
|
||||
this.messaging.rtc.channel.endCall();
|
||||
this.env.services['notification'].notify({
|
||||
message: this.env._t("Disconnected from the RTC call by the server"),
|
||||
type: 'warning',
|
||||
|
||||
@@ -1133,13 +1133,13 @@ function factory(dependencies) {
|
||||
* The channel that is hosting the current RTC call.
|
||||
*/
|
||||
channel: one2one('mail.thread', {
|
||||
inverse: 'mailRtc',
|
||||
inverse: 'rtc',
|
||||
}),
|
||||
/**
|
||||
* String, peerToken of the current session used to identify him during the peer-to-peer transactions.
|
||||
*/
|
||||
currentRtcSession: one2one('mail.rtc_session', {
|
||||
inverse: 'mailRtc',
|
||||
inverse: 'rtc',
|
||||
}),
|
||||
/**
|
||||
* ICE servers used by RTCPeerConnection to retrieve the public IP address (STUN)
|
||||
|
||||
@@ -144,7 +144,7 @@ function factory(dependencies) {
|
||||
* @private
|
||||
*/
|
||||
_computeAspectRatio() {
|
||||
const rtcAspectRatio = this.messaging.mailRtc.videoConfig && this.messaging.mailRtc.videoConfig.aspectRatio;
|
||||
const rtcAspectRatio = this.messaging.rtc.videoConfig && this.messaging.rtc.videoConfig.aspectRatio;
|
||||
const aspectRatio = rtcAspectRatio || 16 / 9;
|
||||
// if we are in minimized mode (round avatar frames), we treat the cards like squares.
|
||||
return this.isMinimized ? 1 : aspectRatio;
|
||||
@@ -170,7 +170,7 @@ function factory(dependencies) {
|
||||
if (this.isFullScreen || this.threadView.compact) {
|
||||
return false;
|
||||
}
|
||||
return !this.threadView.thread.mailRtc || this.threadView.thread.videoCount === 0;
|
||||
return !this.threadView.thread.rtc || this.threadView.thread.videoCount === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +180,7 @@ function factory(dependencies) {
|
||||
if (!this.threadView) {
|
||||
return 'tiled';
|
||||
}
|
||||
if (!this.threadView.thread.mailRtc) {
|
||||
if (!this.threadView.thread.rtc) {
|
||||
return 'tiled';
|
||||
}
|
||||
if (!this.threadView.thread.videoCount || !this.mainParticipantCard) {
|
||||
@@ -274,7 +274,7 @@ function factory(dependencies) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_onChangeMailRtcChannel() {
|
||||
_onChangeRtcChannel() {
|
||||
this.deactivateFullScreen();
|
||||
this.update({ filterVideoGrid: false });
|
||||
}
|
||||
@@ -412,8 +412,8 @@ function factory(dependencies) {
|
||||
};
|
||||
RtcCallViewer.onChanges = [
|
||||
new OnChange({
|
||||
dependencies: ['threadView.thread.mailRtc'],
|
||||
methodName: '_onChangeMailRtcChannel',
|
||||
dependencies: ['threadView.thread.rtc'],
|
||||
methodName: '_onChangeRtcChannel',
|
||||
}),
|
||||
new OnChange({
|
||||
dependencies: ['threadView.thread.videoCount'],
|
||||
|
||||
@@ -30,21 +30,21 @@ function factory(dependencies) {
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
onClickCamera(ev) {
|
||||
this.messaging.mailRtc.toggleUserVideo();
|
||||
this.messaging.rtc.toggleUserVideo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
async onClickDeafen(ev) {
|
||||
await this.messaging.mailRtc.currentRtcSession.toggleDeaf();
|
||||
await this.messaging.rtc.currentRtcSession.toggleDeaf();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
onClickMicrophone(ev) {
|
||||
this.messaging.mailRtc.toggleMicrophone();
|
||||
this.messaging.rtc.toggleMicrophone();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ function factory(dependencies) {
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
onClickScreen(ev) {
|
||||
this.messaging.mailRtc.toggleScreenShare();
|
||||
this.messaging.rtc.toggleScreenShare();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,15 +30,15 @@ function factory(dependencies) {
|
||||
*/
|
||||
async onClickDownloadLogs(ev) {
|
||||
const channel = this.rtcController.callViewer.threadView.thread;
|
||||
if (!channel.mailRtc) {
|
||||
if (!channel.rtc) {
|
||||
return;
|
||||
}
|
||||
const data = window.JSON.stringify(channel.mailRtc.logs);
|
||||
const data = window.JSON.stringify(channel.rtc.logs);
|
||||
const blob = new window.Blob([data], { type: 'application/json' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `RtcLogs_Channel${channel.id}_Session${channel.mailRtc.currentRtcSession.id}_${window.moment().format('YYYY-MM-DD_HH-mm')}.json`;
|
||||
a.download = `RtcLogs_Channel${channel.id}_Session${channel.rtc.currentRtcSession.id}_${window.moment().format('YYYY-MM-DD_HH-mm')}.json`;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
this.component.trigger('o-popover-close');
|
||||
|
||||
@@ -79,7 +79,7 @@ function factory(dependencies) {
|
||||
}
|
||||
audioElement.load();
|
||||
audioElement.volume = this.partner && this.partner.volumeSetting ? this.partner.volumeSetting.volume : this.volume;
|
||||
audioElement.muted = this.messaging.mailRtc.currentRtcSession.isDeaf;
|
||||
audioElement.muted = this.messaging.rtc.currentRtcSession.isDeaf;
|
||||
// Using both autoplay and play() as safari may prevent play() outside of user interactions
|
||||
// while some browsers may not support or block autoplay.
|
||||
audioElement.autoplay = true;
|
||||
@@ -134,7 +134,7 @@ function factory(dependencies) {
|
||||
* of the current partner.
|
||||
*/
|
||||
async toggleDeaf() {
|
||||
if (!this.mailRtc) {
|
||||
if (!this.rtc) {
|
||||
return;
|
||||
}
|
||||
this.updateAndBroadcast({
|
||||
@@ -146,12 +146,12 @@ function factory(dependencies) {
|
||||
}
|
||||
session.audioElement.muted = this.isDeaf;
|
||||
}
|
||||
if (this.channel.mailRtc) {
|
||||
if (this.channel.rtc) {
|
||||
/**
|
||||
* Ensures that the state of the microphone matches the deaf state
|
||||
* and notifies peers.
|
||||
*/
|
||||
await this.async(() => this.channel.mailRtc.toggleMicrophone({
|
||||
await this.async(() => this.channel.rtc.toggleMicrophone({
|
||||
requestAudioDevice: false,
|
||||
}));
|
||||
}
|
||||
@@ -163,7 +163,7 @@ function factory(dependencies) {
|
||||
* @param {Object} data
|
||||
*/
|
||||
updateAndBroadcast(data) {
|
||||
if (!this.mailRtc) {
|
||||
if (!this.rtc) {
|
||||
return;
|
||||
}
|
||||
this.update(data);
|
||||
@@ -394,7 +394,7 @@ function factory(dependencies) {
|
||||
* This can be true for many sessions, as one user can have multiple
|
||||
* sessions active across several tabs, browsers and devices.
|
||||
* To determine if this session is the active session of this tab,
|
||||
* use this.mailRtc instead.
|
||||
* use this.rtc instead.
|
||||
*/
|
||||
isOwnSession: attr({
|
||||
compute: '_computeIsOwnSession',
|
||||
@@ -412,15 +412,6 @@ function factory(dependencies) {
|
||||
isTalking: attr({
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
* If set, this session is the session of the current user and is in the active RTC call.
|
||||
* This information is distinct from this.isOwnSession as there can be other
|
||||
* sessions from other channels with the same partner (sessions opened from different
|
||||
* tabs or devices).
|
||||
*/
|
||||
mailRtc: one2one('mail.rtc', {
|
||||
inverse: 'currentRtcSession',
|
||||
}),
|
||||
/**
|
||||
* Name of the session, based on the partner name if set.
|
||||
*/
|
||||
@@ -443,6 +434,15 @@ function factory(dependencies) {
|
||||
peerToken: attr({
|
||||
compute: '_computePeerToken',
|
||||
}),
|
||||
/**
|
||||
* If set, this session is the session of the current user and is in the active RTC call.
|
||||
* This information is distinct from this.isOwnSession as there can be other
|
||||
* sessions from other channels with the same partner (sessions opened from different
|
||||
* tabs or devices).
|
||||
*/
|
||||
rtc: one2one('mail.rtc', {
|
||||
inverse: 'currentRtcSession',
|
||||
}),
|
||||
/**
|
||||
* MediaStream of the user's video.
|
||||
*
|
||||
|
||||
@@ -326,12 +326,12 @@ function factory(dependencies) {
|
||||
* Client-side ending of the call.
|
||||
*/
|
||||
endCall() {
|
||||
if (this.mailRtc) {
|
||||
this.mailRtc.reset();
|
||||
if (this.rtc) {
|
||||
this.rtc.reset();
|
||||
this.messaging.soundEffects.channelLeave.play();
|
||||
}
|
||||
this.update({
|
||||
mailRtc: unlink(),
|
||||
rtc: unlink(),
|
||||
rtcInvitingSession: unlink(),
|
||||
});
|
||||
}
|
||||
@@ -744,9 +744,9 @@ function factory(dependencies) {
|
||||
*/
|
||||
async toggleCall(options) {
|
||||
this.update({ hasPendingRtcRequest: true });
|
||||
const isActiveCall = !!this.mailRtc;
|
||||
if (this.messaging.mailRtc.channel) {
|
||||
await this.messaging.mailRtc.channel.leaveCall();
|
||||
const isActiveCall = !!this.rtc;
|
||||
if (this.messaging.rtc.channel) {
|
||||
await this.messaging.rtc.channel.leaveCall();
|
||||
}
|
||||
if (isActiveCall) {
|
||||
this.update({ hasPendingRtcRequest: false });
|
||||
@@ -765,7 +765,7 @@ function factory(dependencies) {
|
||||
if (this.model !== 'mail.channel') {
|
||||
return;
|
||||
}
|
||||
if (!this.messaging.mailRtc.isClientRtcCompatible) {
|
||||
if (!this.messaging.rtc.isClientRtcCompatible) {
|
||||
this.env.services.notification.notify({
|
||||
message: this.env._t("Your browser does not support webRTC."),
|
||||
type: 'warning',
|
||||
@@ -782,13 +782,13 @@ function factory(dependencies) {
|
||||
return;
|
||||
}
|
||||
this.update({
|
||||
mailRtc: link(this.messaging.mailRtc),
|
||||
rtc: link(this.messaging.rtc),
|
||||
rtcInvitingSession: unlink(),
|
||||
rtcSessions,
|
||||
invitedGuests,
|
||||
invitedPartners,
|
||||
});
|
||||
await this.async(() => this.messaging.mailRtc.initSession({
|
||||
await this.async(() => this.messaging.rtc.initSession({
|
||||
currentSessionId: sessionId,
|
||||
iceServers,
|
||||
startWithAudio: true,
|
||||
@@ -812,7 +812,7 @@ function factory(dependencies) {
|
||||
updateRtcSessions(rtcSessions) {
|
||||
const oldCount = this.rtcSessions.length;
|
||||
this.update({ rtcSessions });
|
||||
if (this.mailRtc) {
|
||||
if (this.rtc) {
|
||||
const newCount = this.rtcSessions.length;
|
||||
if (newCount > oldCount) {
|
||||
this.messaging.soundEffects.channelJoin.play();
|
||||
@@ -821,8 +821,8 @@ function factory(dependencies) {
|
||||
this.messaging.soundEffects.memberLeave.play();
|
||||
}
|
||||
}
|
||||
this.mailRtc && this.mailRtc.filterCallees(this.rtcSessions);
|
||||
if (this.mailRtc && !this.mailRtc.currentRtcSession) {
|
||||
this.rtc && this.rtc.filterCallees(this.rtcSessions);
|
||||
if (this.rtc && !this.rtc.currentRtcSession) {
|
||||
this.endCall();
|
||||
}
|
||||
}
|
||||
@@ -2243,12 +2243,6 @@ function factory(dependencies) {
|
||||
localMessageUnreadCounter: attr({
|
||||
compute: '_computeLocalMessageUnreadCounter',
|
||||
}),
|
||||
/**
|
||||
* If set, the current thread is the thread that hosts the current RTC call.
|
||||
*/
|
||||
mailRtc: one2one('mail.rtc', {
|
||||
inverse: 'channel',
|
||||
}),
|
||||
/**
|
||||
* States the number of members in this thread according to the server.
|
||||
* Guests are excluded from the count.
|
||||
@@ -2373,6 +2367,12 @@ function factory(dependencies) {
|
||||
*/
|
||||
pendingSeenMessageId: attr(),
|
||||
public: attr(),
|
||||
/**
|
||||
* If set, the current thread is the thread that hosts the current RTC call.
|
||||
*/
|
||||
rtc: one2one('mail.rtc', {
|
||||
inverse: 'channel',
|
||||
}),
|
||||
/**
|
||||
* The session that invited the current user, it is only set when the
|
||||
* invitation is still pending.
|
||||
|
||||
@@ -118,7 +118,7 @@ function factory(dependencies) {
|
||||
audioInputDeviceId,
|
||||
});
|
||||
this.env.services.local_storage.setItem('mail_user_setting_audio_input_device_id', audioInputDeviceId);
|
||||
await this.messaging.mailRtc.updateLocalAudioTrack(true);
|
||||
await this.messaging.rtc.updateLocalAudioTrack(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,12 +166,12 @@ function factory(dependencies) {
|
||||
async setThresholdValue(voiceActivationThreshold) {
|
||||
this.update({ voiceActivationThreshold });
|
||||
this.env.services.local_storage.setItem('mail_user_setting_voice_threshold', voiceActivationThreshold);
|
||||
await this.messaging.mailRtc.updateVoiceActivation();
|
||||
await this.messaging.rtc.updateVoiceActivation();
|
||||
}
|
||||
|
||||
async togglePushToTalk() {
|
||||
this.update({ usePushToTalk: !this.usePushToTalk });
|
||||
await this.messaging.mailRtc.updateVoiceActivation();
|
||||
await this.messaging.rtc.updateVoiceActivation();
|
||||
this._saveSettings();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user