Skip to content

Commit 01e3b03

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

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/services/participantsService.js

Lines changed: 10 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,

src/store/participantsStore.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,14 @@ const actions = {
691691
}
692692
context.commit('updateParticipant', { token, attendeeId, updatedData })
693693
},
694+
695+
async setTyping(context, { typing }) {
696+
if (!context.getters.currentConversationIsJoined()) {
697+
return
698+
}
699+
700+
await setTyping(typing)
701+
},
694702
}
695703

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

src/utils/webrtc/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ import './shims/MediaStream.js'
3535
import './shims/MediaStreamTrack.js'
3636
import initWebRtc from './webrtc.js'
3737

38+
// This does not really belongs here, as it is unrelated to WebRTC, but it is
39+
// included here for the time being until signaling and WebRTC are split.
40+
import SignalingTypingHandler from '../SignalingTypingHandler.js'
41+
3842
let webRtc = null
3943
const callParticipantCollection = new CallParticipantCollection()
4044
const localCallParticipantModel = new LocalCallParticipantModel()
@@ -43,6 +47,8 @@ const mediaDevicesManager = new MediaDevicesManager()
4347
let callAnalyzer = null
4448
let sentVideoQualityThrottler = null
4549

50+
let signalingTypingHandler = new SignalingTypingHandler()
51+
4652
let cancelFetchSignalingSettings = null
4753
let signaling = null
4854
let tokensInSignaling = {}
@@ -126,6 +132,7 @@ async function connectSignaling(token) {
126132
signaling.settings = settings
127133
})
128134

135+
signalingTypingHandler.setSignaling(signaling)
129136
}
130137

131138
tokensInSignaling[token] = true
@@ -436,6 +443,15 @@ function signalingKill() {
436443
}
437444
}
438445

446+
/**
447+
* Sets whether the current participant is typing.
448+
*
449+
* @param {boolean} typing whether the current participant is typing.
450+
*/
451+
function signalingSetTyping(typing) {
452+
signalingTypingHandler.setTyping(typing)
453+
}
454+
439455
export {
440456
callParticipantCollection,
441457
localCallParticipantModel,
@@ -452,4 +468,6 @@ export {
452468
signalingLeaveCall,
453469
signalingLeaveConversation,
454470
signalingKill,
471+
472+
signalingSetTyping,
455473
}

0 commit comments

Comments
 (0)