mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +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.
|
* 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,
|
suspend fun transfer(targetUserId: String,
|
||||||
targetRoomId: String?,
|
targetRoomId: String?,
|
||||||
|
|
|
@ -77,6 +77,5 @@ data class CallReplacesContent(
|
||||||
* Optional. The avatar URL of the transfer target.
|
* Optional. The avatar URL of the transfer target.
|
||||||
*/
|
*/
|
||||||
@Json(name = "avatar_url") val avatarUrl: String?
|
@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)
|
(call as? MxCallImpl)?.updateOpponentData(userId, content, callCapabilities)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ data class VectorCallViewState(
|
||||||
) : MvRxState {
|
) : MvRxState {
|
||||||
|
|
||||||
sealed class TransfereeState {
|
sealed class TransfereeState {
|
||||||
object NoTransferee: TransfereeState()
|
object NoTransferee : TransfereeState()
|
||||||
data class KnownTransferee(val name:String): TransfereeState()
|
data class KnownTransferee(val name: String) : TransfereeState()
|
||||||
object UnknownTransferee: TransfereeState()
|
object UnknownTransferee : TransfereeState()
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CallInfo(
|
data class CallInfo(
|
||||||
|
@ -56,7 +56,7 @@ data class VectorCallViewState(
|
||||||
val otherUserItem: MatrixItem? = null
|
val otherUserItem: MatrixItem? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
constructor(callArgs: CallArgs): this(
|
constructor(callArgs: CallArgs) : this(
|
||||||
callId = callArgs.callId,
|
callId = callArgs.callId,
|
||||||
roomId = callArgs.signalingRoomId,
|
roomId = callArgs.signalingRoomId,
|
||||||
isVideoCall = callArgs.isVideoCall
|
isVideoCall = callArgs.isVideoCall
|
||||||
|
|
|
@ -86,8 +86,10 @@ private const val AUDIO_TRACK_ID = "ARDAMSa0"
|
||||||
private const val VIDEO_TRACK_ID = "ARDAMSv0"
|
private const val VIDEO_TRACK_ID = "ARDAMSv0"
|
||||||
private val DEFAULT_AUDIO_CONSTRAINTS = MediaConstraints()
|
private val DEFAULT_AUDIO_CONSTRAINTS = MediaConstraints()
|
||||||
|
|
||||||
class WebRtcCall(val mxCall: MxCall,
|
class WebRtcCall(
|
||||||
// This is where the call is placed from an ui perspective. In case of virtual room, it can differs from the signalingRoomId.
|
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,
|
val nativeRoomId: String,
|
||||||
private val rootEglBase: EglBase?,
|
private val rootEglBase: EglBase?,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
@ -95,7 +97,8 @@ class WebRtcCall(val mxCall: MxCall,
|
||||||
private val sessionProvider: Provider<Session?>,
|
private val sessionProvider: Provider<Session?>,
|
||||||
private val peerConnectionFactoryProvider: Provider<PeerConnectionFactory?>,
|
private val peerConnectionFactoryProvider: Provider<PeerConnectionFactory?>,
|
||||||
private val onCallBecomeActive: (WebRtcCall) -> Unit,
|
private val onCallBecomeActive: (WebRtcCall) -> Unit,
|
||||||
private val onCallEnded: (String) -> Unit) : MxCall.StateListener {
|
private val onCallEnded: (String) -> Unit
|
||||||
|
) : MxCall.StateListener {
|
||||||
|
|
||||||
interface Listener : MxCall.StateListener {
|
interface Listener : MxCall.StateListener {
|
||||||
fun onCaptureStateChanged() {}
|
fun onCaptureStateChanged() {}
|
||||||
|
@ -119,6 +122,7 @@ class WebRtcCall(val mxCall: MxCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
val callId = mxCall.callId
|
val callId = mxCall.callId
|
||||||
|
|
||||||
// room where call signaling is placed. In case of virtual room it can differs from the nativeRoomId.
|
// room where call signaling is placed. In case of virtual room it can differs from the nativeRoomId.
|
||||||
val signalingRoomId = mxCall.roomId
|
val signalingRoomId = mxCall.roomId
|
||||||
|
|
||||||
|
@ -290,6 +294,9 @@ class WebRtcCall(val mxCall: MxCall,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Without consultation
|
||||||
|
*/
|
||||||
suspend fun transferToUser(targetUserId: String, targetRoomId: String?) {
|
suspend fun transferToUser(targetUserId: String, targetRoomId: String?) {
|
||||||
mxCall.transfer(
|
mxCall.transfer(
|
||||||
targetUserId = targetUserId,
|
targetUserId = targetUserId,
|
||||||
|
@ -300,21 +307,24 @@ class WebRtcCall(val mxCall: MxCall,
|
||||||
endCall(sendEndSignaling = false)
|
endCall(sendEndSignaling = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* With consultation
|
||||||
|
*/
|
||||||
suspend fun transferToCall(transferTargetCall: WebRtcCall) {
|
suspend fun transferToCall(transferTargetCall: WebRtcCall) {
|
||||||
val newCallId = CallIdGenerator.generate()
|
val newCallId = CallIdGenerator.generate()
|
||||||
transferTargetCall.mxCall.transfer(
|
transferTargetCall.mxCall.transfer(
|
||||||
targetUserId = this@WebRtcCall.mxCall.opponentUserId,
|
targetUserId = mxCall.opponentUserId,
|
||||||
targetRoomId = null,
|
targetRoomId = null,
|
||||||
createCallId = null,
|
createCallId = null,
|
||||||
awaitCallId = newCallId
|
awaitCallId = newCallId
|
||||||
)
|
)
|
||||||
this@WebRtcCall.mxCall.transfer(
|
mxCall.transfer(
|
||||||
targetUserId = transferTargetCall.mxCall.opponentUserId,
|
targetUserId = transferTargetCall.mxCall.opponentUserId,
|
||||||
targetRoomId = null,
|
targetRoomId = null,
|
||||||
createCallId = newCallId,
|
createCallId = newCallId,
|
||||||
awaitCallId = null
|
awaitCallId = null
|
||||||
)
|
)
|
||||||
this@WebRtcCall.endCall(sendEndSignaling = false)
|
endCall(sendEndSignaling = false)
|
||||||
transferTargetCall.endCall(sendEndSignaling = false)
|
transferTargetCall.endCall(sendEndSignaling = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue