From 5f82fc4cc60482255c4effdadcd1510cd573b8d9 Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Tue, 21 Mar 2023 12:48:22 +0000 Subject: [PATCH] [IMP] mail: add the "raise hand" feature to calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a button to the `CallActionList` to signal to the other participants of the call that one is raising a hand. This will add a hand icon to the `CallParticipantCard` of the people with a raised hand and send a notification that is displayed in the `Call` view (only when in discuss, not in chat windows). task-3229507 closes odoo/odoo#116658 Signed-off-by: Alexandre Kühn (aku) --- .../static/src/core/channel_member_model.js | 5 ++ .../src/discuss/channel_member_list.xml | 1 + addons/mail/static/src/rtc/call.js | 18 +++++- addons/mail/static/src/rtc/call.xml | 4 +- .../mail/static/src/rtc/call_action_list.js | 4 ++ .../mail/static/src/rtc/call_action_list.xml | 11 ++++ .../static/src/rtc/call_participant_card.xml | 3 + addons/mail/static/src/rtc/rtc_service.js | 64 +++++++++++++++++++ .../mail/static/src/rtc/rtc_session_model.js | 1 + addons/mail/static/tests/call/call_tests.js | 3 +- 10 files changed, 111 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/core/channel_member_model.js b/addons/mail/static/src/core/channel_member_model.js index 6a382811333..94a487765c4 100644 --- a/addons/mail/static/src/core/channel_member_model.js +++ b/addons/mail/static/src/core/channel_member_model.js @@ -11,6 +11,7 @@ import { createLocalId } from "../utils/misc"; */ export class ChannelMember { personaLocalId; + rtcSessionId; threadId; typingTimer; /** @type {import("@mail/core/store_service").Store} */ @@ -24,6 +25,10 @@ export class ChannelMember { this.personaLocalId = persona?.localId; } + get rtcSession() { + return this._store.rtcSessions[this.rtcSessionId]; + } + get thread() { return this._store.threads[createLocalId("mail.channel", this.threadId)]; } diff --git a/addons/mail/static/src/discuss/channel_member_list.xml b/addons/mail/static/src/discuss/channel_member_list.xml index b50ca52b94d..a6c08b0638a 100644 --- a/addons/mail/static/src/discuss/channel_member_list.xml +++ b/addons/mail/static/src/discuss/channel_member_list.xml @@ -33,6 +33,7 @@ + diff --git a/addons/mail/static/src/rtc/call.js b/addons/mail/static/src/rtc/call.js index 330241bda16..77534321e90 100644 --- a/addons/mail/static/src/rtc/call.js +++ b/addons/mail/static/src/rtc/call.js @@ -53,11 +53,19 @@ export class Call extends Component { useExternalListener(browser, "fullscreenchange", this.onFullScreenChange); } + get callNotifications() { + return [...this.rtc.notifications.values()]; + } + + get isActiveCall() { + return Boolean(this.props.thread.id === this.rtc.state?.channel?.id); + } + get minimized() { if (this.state.isFullscreen || this.props.compact || this.props.thread.activeRtcSession) { return false; } - if (this.rtc.state.channel !== this.props.thread || this.props.thread.videoCount === 0) { + if (!this.isActiveCall || this.props.thread.videoCount === 0) { return true; } return false; @@ -97,6 +105,14 @@ export class Call extends Component { return this.visibleCards; } + get hasCallNotifications() { + return Boolean( + (!this.props.compact || this.state.isFullscreen) && + this.isActiveCall && + this.rtc.notifications.size + ); + } + get hasSidebarButton() { return Boolean( this.props.thread.activeRtcSession && this.state.overlay && !this.props.compact diff --git a/addons/mail/static/src/rtc/call.xml b/addons/mail/static/src/rtc/call.xml index 106d309ab8d..5745d90abd7 100644 --- a/addons/mail/static/src/rtc/call.xml +++ b/addons/mail/static/src/rtc/call.xml @@ -3,7 +3,6 @@
-
+
+ +
+ Lower hand + Raise hand + Stop camera Turn camera on