From 9c9c1fa79c3366fbd2090fbd780b8736a3a10109 Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 1 Feb 2021 19:19:46 +0100 Subject: [PATCH] VoIP: make some clean up and update CHANGES --- CHANGES.md | 27 +++++++++++++++++++ .../android/sdk/api/session/call/MxCall.kt | 4 +-- .../room/model/call/CallRejectContent.kt | 2 +- .../session/call/CallListenersDispatcher.kt | 2 +- .../internal/session/call/model/MxCallImpl.kt | 4 +-- .../app/features/call/webrtc/WebRtcCall.kt | 2 +- .../features/call/webrtc/WebRtcCallManager.kt | 7 +++++ .../timeline/TimelineEventController.kt | 4 +-- 8 files changed, 43 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 90c2e05c65..505d4f1497 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,30 @@ +Changes in Element 1.0.16 (2020-XX-XX) +=================================================== + +Features ✨: + - VoIP : support for VoIP V1 protocol, transfer call and dial-pad + +Improvements 🙌: + - VoIP : new tiles in timeline + +Bugfix 🐛: + - VoIP : fix audio devices output + +Translations 🗣: + - + +SDK API changes ⚠️: + - + +Build 🧱: + - + +Test: + - + +Other changes: + - + Changes in Element 1.0.15 (2020-XX-XX) =================================================== diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt index 2b7c0a7578..7533619eb0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt @@ -80,9 +80,9 @@ interface MxCall : MxCallDetail { fun offerSdp(sdpString: String) /** - * Send Ice candidate to the other participant. + * Send Call candidate to the other participant. */ - fun sendLocalIceCandidates(candidates: List) + fun sendLocalCallCandidates(candidates: List) /** * Send removed ICE candidates to the other participant. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt index d9a8090eb1..1da229b179 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt @@ -37,4 +37,4 @@ data class CallRejectContent( * Required. The version of the VoIP specification this message adheres to. */ @Json(name = "version") override val version: String? -):CallSignallingContent +) : CallSignallingContent diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt index 54e3df8416..1de2d8a106 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt @@ -30,7 +30,7 @@ import org.matrix.android.sdk.api.session.room.model.call.CallSelectAnswerConten /** * Dispatch each method safely to all listeners. */ -class CallListenersDispatcher(private val listeners: Set) : CallListener { +internal class CallListenersDispatcher(private val listeners: Set) : CallListener { override fun onCallInviteReceived(mxCall: MxCall, callInviteContent: CallInviteContent) = dispatch { it.onCallInviteReceived(mxCall, callInviteContent) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt index ab7b74c229..88fba0ea85 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt @@ -114,8 +114,8 @@ internal class MxCallImpl( .also { eventSenderProcessor.postEvent(it) } } - override fun sendLocalIceCandidates(candidates: List) { - Timber.v("Send local ice canditates $callId: $candidates") + override fun sendLocalCallCandidates(candidates: List) { + Timber.v("Send local call canditates $callId: $candidates") CallCandidatesContent( callId = callId, partyId = ourPartyId, diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt index 5ad78a3801..ddfea11066 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt @@ -177,7 +177,7 @@ class WebRtcCall(val mxCall: MxCall, if (it.isNotEmpty()) { Timber.v("## Sending local ice candidates to call") // it.forEach { peerConnection?.addIceCandidate(it) } - mxCall.sendLocalIceCandidates(it.mapToCallCandidate()) + mxCall.sendLocalCallCandidates(it.mapToCallCandidate()) } } diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt index 0f694249f3..95728e0a97 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt @@ -147,6 +147,7 @@ class WebRtcCallManager @Inject constructor( } } + private val advertisedCalls = HashSet() private val callsByCallId = ConcurrentHashMap() private val callsByRoomId = ConcurrentHashMap>() @@ -166,6 +167,11 @@ class WebRtcCallManager @Inject constructor( return callsByCallId.values.toList() } + /** + * @return a set of all advertised call during the lifetime of the app. + */ + fun getAdvertisedCalls() = advertisedCalls + fun headSetButtonTapped() { Timber.v("## VOIP headSetButtonTapped") val call = getCurrentCall() ?: return @@ -299,6 +305,7 @@ class WebRtcCallManager @Inject constructor( onCallBecomeActive = this::onCallActive, onCallEnded = this::onCallEnded ) + advertisedCalls.add(mxCall.callId) callsByCallId[mxCall.callId] = webRtcCall callsByRoomId.getOrPut(mxCall.roomId) { ArrayList(1) } .add(webRtcCall) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt index 018b8691c0..e521cb2ddf 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt @@ -210,10 +210,10 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec val epoxyModel = it.value if (epoxyModel is CallTileTimelineItem) { val callId = epoxyModel.attributes.callId - val call = callManager.getCallById(callId) // We should remove the call tile if we already have one for this call or // if this is an active call tile without an actual call (which can happen with permalink) - val shouldRemoveCallItem = callIds.contains(callId) || (call == null && epoxyModel.attributes.callStatus.isActive()) + val shouldRemoveCallItem = callIds.contains(callId) + || (!callManager.getAdvertisedCalls().contains(callId) && epoxyModel.attributes.callStatus.isActive()) if (shouldRemoveCallItem && !showHiddenEvents) { modelsIterator.remove() return@forEach