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 7d57144384
commit 8f916eaece
@@ -96,18 +96,20 @@ 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 areNotificationsEnabled = userPushStore.getNotificationEnabledForDevice().first()
if (areNotificationsEnabled) {
val notifiableEvent = notifiableEventResolver.resolveEvent(userId, pushData.roomId, pushData.eventId) val notifiableEvent = notifiableEventResolver.resolveEvent(userId, pushData.roomId, pushData.eventId)
when (notifiableEvent) { when (notifiableEvent) {
null -> Timber.tag(loggerTag.value).w("Unable to get a notification data") null -> Timber.tag(loggerTag.value).w("Unable to get a notification data")
is NotifiableRingingCallEvent -> handleRingingCallEvent(notifiableEvent) is NotifiableRingingCallEvent -> handleRingingCallEvent(notifiableEvent)
else -> onNotifiableEventReceived.onNotifiableEventReceived(notifiableEvent) else -> {
} val userPushStore = userPushStoreFactory.getOrCreate(userId)
val areNotificationsEnabled = userPushStore.getNotificationEnabledForDevice().first()
if (areNotificationsEnabled) {
onNotifiableEventReceived.onNotifiableEventReceived(notifiableEvent)
} else { } else {
Timber.tag(loggerTag.value).i("Notification are disabled for this device, ignore push.") 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")
} }