Skip to content

Commit b476620

Browse files
committed
Provide facade to access the SignalingTypingHandler
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
1 parent 0f24bf1 commit b476620

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/services/participantsService.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { PARTICIPANT } from '../constants.js'
2929
import {
3030
signalingJoinConversation,
3131
signalingLeaveConversation,
32+
signalingSetTyping,
3233
} from '../utils/webrtc/index.js'
3334

3435
const PERMISSIONS = PARTICIPANT.PERMISSIONS
@@ -220,6 +221,15 @@ const setPermissions = async (token, attendeeId, permission) => {
220221
})
221222
}
222223

224+
/**
225+
* Sets whether the current participant is typing or not.
226+
*
227+
* @param {boolean} typing whether the current participant is typing.
228+
*/
229+
const setTyping = (typing) => {
230+
signalingSetTyping(typing)
231+
}
232+
223233
export {
224234
joinConversation,
225235
rejoinConversation,
@@ -237,4 +247,5 @@ export {
237247
grantAllPermissionsToParticipant,
238248
removeAllPermissionsFromParticipant,
239249
setPermissions,
250+
setTyping,
240251
}

src/store/participantsStore.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
grantAllPermissionsToParticipant,
4343
removeAllPermissionsFromParticipant,
4444
setPermissions,
45+
setTyping,
4546
} from '../services/participantsService.js'
4647
import SessionStorage from '../services/SessionStorage.js'
4748

@@ -693,6 +694,14 @@ const actions = {
693694
}
694695
context.commit('updateParticipant', { token, attendeeId, updatedData })
695696
},
697+
698+
async setTyping(context, { typing }) {
699+
if (!context.getters.currentConversationIsJoined()) {
700+
return
701+
}
702+
703+
await setTyping(typing)
704+
},
696705
}
697706

698707
export default { state, mutations, getters, actions }

src/utils/webrtc/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { PARTICIPANT, VIRTUAL_BACKGROUND } from '../../constants.js'
2525
import { fetchSignalingSettings } from '../../services/signalingService.js'
2626
import CancelableRequest from '../cancelableRequest.js'
2727
import Signaling from '../signaling.js'
28+
import SignalingTypingHandler from '../SignalingTypingHandler.js'
2829
import CallAnalyzer from './analyzers/CallAnalyzer.js'
2930
import MediaDevicesManager from './MediaDevicesManager.js'
3031
import CallParticipantCollection from './models/CallParticipantCollection.js'
@@ -43,6 +44,10 @@ const mediaDevicesManager = new MediaDevicesManager()
4344
let callAnalyzer = null
4445
let sentVideoQualityThrottler = null
4546

47+
// This does not really belongs here, as it is unrelated to WebRTC, but it is
48+
// included here for the time being until signaling and WebRTC are split.
49+
const signalingTypingHandler = new SignalingTypingHandler()
50+
4651
let cancelFetchSignalingSettings = null
4752
let signaling = null
4853
let tokensInSignaling = {}
@@ -126,6 +131,7 @@ async function connectSignaling(token) {
126131
signaling.settings = settings
127132
})
128133

134+
signalingTypingHandler.setSignaling(signaling)
129135
}
130136

131137
tokensInSignaling[token] = true
@@ -436,6 +442,15 @@ function signalingKill() {
436442
}
437443
}
438444

445+
/**
446+
* Sets whether the current participant is typing.
447+
*
448+
* @param {boolean} typing whether the current participant is typing.
449+
*/
450+
function signalingSetTyping(typing) {
451+
signalingTypingHandler.setTyping(typing)
452+
}
453+
439454
export {
440455
callParticipantCollection,
441456
localCallParticipantModel,
@@ -452,4 +467,6 @@ export {
452467
signalingLeaveCall,
453468
signalingLeaveConversation,
454469
signalingKill,
470+
471+
signalingSetTyping,
455472
}

0 commit comments

Comments
 (0)