Always notify for incoming calls, even if notifications are disabled.

This commit is contained in:
Benoit Marty 2024-06-19 11:15:49 +02:00
parent 0886443fe7
commit 22d63d001c

View file

@ -96,17 +96,19 @@ class DefaultPushHandler @Inject constructor(
Timber.w("Unable to get a session") Timber.w("Unable to get a session")
return return
} }
val userPushStore = userPushStoreFactory.getOrCreate(userId) val notifiableEvent = notifiableEventResolver.resolveEvent(userId, pushData.roomId, pushData.eventId)
val areNotificationsEnabled = userPushStore.getNotificationEnabledForDevice().first() when (notifiableEvent) {
if (areNotificationsEnabled) { null -> Timber.tag(loggerTag.value).w("Unable to get a notification data")
val notifiableEvent = notifiableEventResolver.resolveEvent(userId, pushData.roomId, pushData.eventId) is NotifiableRingingCallEvent -> handleRingingCallEvent(notifiableEvent)
when (notifiableEvent) { else -> {
null -> Timber.tag(loggerTag.value).w("Unable to get a notification data") val userPushStore = userPushStoreFactory.getOrCreate(userId)
is NotifiableRingingCallEvent -> handleRingingCallEvent(notifiableEvent) val areNotificationsEnabled = userPushStore.getNotificationEnabledForDevice().first()
else -> onNotifiableEventReceived.onNotifiableEventReceived(notifiableEvent) if (areNotificationsEnabled) {
onNotifiableEventReceived.onNotifiableEventReceived(notifiableEvent)
} else {
Timber.tag(loggerTag.value).i("Notification are disabled for this device, ignore push.")
}
} }
} else {
Timber.tag(loggerTag.value).i("Notification are disabled for this device, ignore push.")
} }
} catch (e: Exception) { } catch (e: Exception) {
Timber.tag(loggerTag.value).e(e, "## handleInternal() failed") Timber.tag(loggerTag.value).e(e, "## handleInternal() failed")