Fix ringing calls not stopping when the other user cancels the call (#4613)
* Fix ringing calls not being automatically canceled This will keep the sync active while the user is screening an incoming call, allowing receiving a call cancellation event, which will terminate the incoming call ringing early. * Add extra logs to help debugging ringing call issues.
This commit is contained in:
parent
75cb3156a1
commit
3b35d96e1a
10 changed files with 112 additions and 17 deletions
|
|
@ -17,6 +17,7 @@ import io.element.android.libraries.push.impl.R
|
|||
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
|
||||
import io.element.android.libraries.push.impl.notifications.model.NotifiableRingingCallEvent
|
||||
import io.element.android.services.toolbox.api.strings.StringProvider
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
|
@ -69,6 +70,9 @@ class DefaultCallNotificationEventResolver @Inject constructor(
|
|||
senderAvatarUrl = senderAvatarUrl,
|
||||
)
|
||||
} else {
|
||||
val now = System.currentTimeMillis()
|
||||
val elapsed = now - timestamp
|
||||
Timber.d("Event $eventId is call notify but should not ring: $timestamp vs $now ($elapsed ms elapsed), notify: ${content.type}")
|
||||
// Create a simple message notification event
|
||||
buildNotifiableMessageEvent(
|
||||
sessionId = sessionId,
|
||||
|
|
|
|||
|
|
@ -92,8 +92,9 @@ class DefaultNotifiableEventResolver @Inject constructor(
|
|||
return notificationData.flatMap {
|
||||
if (it == null) {
|
||||
Timber.tag(loggerTag.value).d("No notification data found for event $eventId")
|
||||
return@flatMap Result.failure(ResolvingException("Unable to resolve event"))
|
||||
return@flatMap Result.failure(ResolvingException("Unable to resolve event $eventId"))
|
||||
} else {
|
||||
Timber.tag(loggerTag.value).d("Found notification item for $eventId")
|
||||
it.asNotifiableEvent(client, sessionId)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,10 +133,12 @@ class DefaultPushHandler @Inject constructor(
|
|||
is ResolvedPushEvent.Event -> {
|
||||
when (val notifiableEvent = resolvedPushEvent.notifiableEvent) {
|
||||
is NotifiableRingingCallEvent -> {
|
||||
Timber.tag(loggerTag.value).d("Notifiable event ${pushData.eventId} is ringing call: $notifiableEvent")
|
||||
onNotifiableEventReceived.onNotifiableEventReceived(notifiableEvent)
|
||||
handleRingingCallEvent(notifiableEvent)
|
||||
}
|
||||
else -> {
|
||||
Timber.tag(loggerTag.value).d("Notifiable event ${pushData.eventId} is normal event: $notifiableEvent")
|
||||
val userPushStore = userPushStoreFactory.getOrCreate(userId)
|
||||
val areNotificationsEnabled = userPushStore.getNotificationEnabledForDevice().first()
|
||||
if (areNotificationsEnabled) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue