mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Small cleanup during review
This commit is contained in:
parent
34b012732e
commit
fca74e9eb4
5 changed files with 41 additions and 28 deletions
|
@ -89,6 +89,7 @@ interface MxCall : MxCallDetail {
|
|||
|
||||
/**
|
||||
* Send a m.call.replaces event to initiate call transfer.
|
||||
* See [org.matrix.android.sdk.api.session.room.model.call.CallReplacesContent] for documentation about the parameters
|
||||
*/
|
||||
suspend fun transfer(targetUserId: String,
|
||||
targetRoomId: String?,
|
||||
|
|
|
@ -77,6 +77,5 @@ data class CallReplacesContent(
|
|||
* Optional. The avatar URL of the transfer target.
|
||||
*/
|
||||
@Json(name = "avatar_url") val avatarUrl: String?
|
||||
|
||||
)
|
||||
}
|
||||
|
|
|
@ -75,7 +75,10 @@ internal class MxCallFactory @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun updateOutgoingCallWithOpponentData(call: MxCall, userId: String, content: CallSignalingContent, callCapabilities: CallCapabilities?) {
|
||||
fun updateOutgoingCallWithOpponentData(call: MxCall,
|
||||
userId: String,
|
||||
content: CallSignalingContent,
|
||||
callCapabilities: CallCapabilities?) {
|
||||
(call as? MxCallImpl)?.updateOpponentData(userId, content, callCapabilities)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,8 +86,10 @@ private const val AUDIO_TRACK_ID = "ARDAMSa0"
|
|||
private const val VIDEO_TRACK_ID = "ARDAMSv0"
|
||||
private val DEFAULT_AUDIO_CONSTRAINTS = MediaConstraints()
|
||||
|
||||
class WebRtcCall(val mxCall: MxCall,
|
||||
// This is where the call is placed from an ui perspective. In case of virtual room, it can differs from the signalingRoomId.
|
||||
class WebRtcCall(
|
||||
val mxCall: MxCall,
|
||||
// This is where the call is placed from an ui perspective.
|
||||
// In case of virtual room, it can differs from the signalingRoomId.
|
||||
val nativeRoomId: String,
|
||||
private val rootEglBase: EglBase?,
|
||||
private val context: Context,
|
||||
|
@ -95,7 +97,8 @@ class WebRtcCall(val mxCall: MxCall,
|
|||
private val sessionProvider: Provider<Session?>,
|
||||
private val peerConnectionFactoryProvider: Provider<PeerConnectionFactory?>,
|
||||
private val onCallBecomeActive: (WebRtcCall) -> Unit,
|
||||
private val onCallEnded: (String) -> Unit) : MxCall.StateListener {
|
||||
private val onCallEnded: (String) -> Unit
|
||||
) : MxCall.StateListener {
|
||||
|
||||
interface Listener : MxCall.StateListener {
|
||||
fun onCaptureStateChanged() {}
|
||||
|
@ -119,6 +122,7 @@ class WebRtcCall(val mxCall: MxCall,
|
|||
}
|
||||
|
||||
val callId = mxCall.callId
|
||||
|
||||
// room where call signaling is placed. In case of virtual room it can differs from the nativeRoomId.
|
||||
val signalingRoomId = mxCall.roomId
|
||||
|
||||
|
@ -290,6 +294,9 @@ class WebRtcCall(val mxCall: MxCall,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Without consultation
|
||||
*/
|
||||
suspend fun transferToUser(targetUserId: String, targetRoomId: String?) {
|
||||
mxCall.transfer(
|
||||
targetUserId = targetUserId,
|
||||
|
@ -300,21 +307,24 @@ class WebRtcCall(val mxCall: MxCall,
|
|||
endCall(sendEndSignaling = false)
|
||||
}
|
||||
|
||||
/**
|
||||
* With consultation
|
||||
*/
|
||||
suspend fun transferToCall(transferTargetCall: WebRtcCall) {
|
||||
val newCallId = CallIdGenerator.generate()
|
||||
transferTargetCall.mxCall.transfer(
|
||||
targetUserId = this@WebRtcCall.mxCall.opponentUserId,
|
||||
targetUserId = mxCall.opponentUserId,
|
||||
targetRoomId = null,
|
||||
createCallId = null,
|
||||
awaitCallId = newCallId
|
||||
)
|
||||
this@WebRtcCall.mxCall.transfer(
|
||||
mxCall.transfer(
|
||||
targetUserId = transferTargetCall.mxCall.opponentUserId,
|
||||
targetRoomId = null,
|
||||
createCallId = newCallId,
|
||||
awaitCallId = null
|
||||
)
|
||||
this@WebRtcCall.endCall(sendEndSignaling = false)
|
||||
endCall(sendEndSignaling = false)
|
||||
transferTargetCall.endCall(sendEndSignaling = false)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue