Handle signaling message for recording status changes in UI

This just updates the conversation property "callRecording" as soon as
the signaling message is received, rather than having to wait until the
whole conversation data is fetched again.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2023-02-14 00:39:52 +01:00
Родитель d48a582dc2
Коммит 4511978305
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -63,3 +63,7 @@ EventBus.$on('signaling-join-room', (payload) => {
const token = payload[0]
store.dispatch('updateLastJoinedConversationToken', token)
})
EventBus.$on('signaling-recording-status-changed', (token, status) => {
store.dispatch('setConversationProperties', { token, properties: { callRecording: status } })
})

Просмотреть файл

@ -1281,7 +1281,7 @@ Signaling.Standalone.prototype.processRoomEvent = function(data) {
})
break
case 'message':
this.processRoomMessageEvent(data.event.message.data)
this.processRoomMessageEvent(data.event.message.roomid, data.event.message.data)
break
default:
console.error('Unknown room event', data)
@ -1289,12 +1289,15 @@ Signaling.Standalone.prototype.processRoomEvent = function(data) {
}
}
Signaling.Standalone.prototype.processRoomMessageEvent = function(data) {
Signaling.Standalone.prototype.processRoomMessageEvent = function(token, data) {
switch (data.type) {
case 'chat':
// FIXME this is not listened to
EventBus.$emit('should-refresh-chat-messages')
break
case 'recording':
EventBus.$emit('signaling-recording-status-changed', token, data.recording.status)
break
default:
console.error('Unknown room message event', data)
}