mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Basic discard of old call events
This commit is contained in:
parent
843da1d48d
commit
c85ba51274
2 changed files with 8 additions and 1 deletions
|
@ -52,10 +52,17 @@ internal class DefaultCallEventsObserverTask @Inject constructor(
|
|||
}
|
||||
|
||||
private fun update(realm: Realm, events: List<Event>, userId: String) {
|
||||
val now = System.currentTimeMillis()
|
||||
events.forEach { event ->
|
||||
event.roomId ?: return@forEach Unit.also {
|
||||
Timber.w("Event with no room id ${event.eventId}")
|
||||
}
|
||||
val age = now - (event.ageLocalTs ?: now)
|
||||
if (age > 40_000) {
|
||||
// To old to ring?
|
||||
return@forEach
|
||||
}
|
||||
event.ageLocalTs
|
||||
decryptIfNeeded(event)
|
||||
if (EventType.isCallEvent(event.getClearType())) {
|
||||
callService.onCallEvent(event)
|
||||
|
|
|
@ -581,7 +581,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
|||
|
||||
override fun onCallInviteReceived(mxCall: MxCall, callInviteContent: CallInviteContent) {
|
||||
Timber.v("## VOIP onCallInviteReceived callId ${mxCall.callId}")
|
||||
// TODO What if a call is currently active?
|
||||
// to simplify we only treat one call at a time, and ignore others
|
||||
if (currentCall != null) {
|
||||
Timber.w("## VOIP receiving incoming call while already in call?")
|
||||
// Just ignore, maybe we could answer from other session?
|
||||
|
|
Loading…
Reference in a new issue