Support showing push notifications for poll start events.

This commit is contained in:
Onuray Sahin 2022-03-08 14:06:28 +03:00
parent bdc9bc0d4d
commit 9fa285e6ca

View file

@ -94,7 +94,7 @@ class NotifiableEventResolver @Inject constructor(
}
suspend fun resolveInMemoryEvent(session: Session, event: Event, canBeReplaced: Boolean): NotifiableEvent? {
if (event.getClearType() != EventType.MESSAGE) return null
if (event.getClearType() !in listOf(EventType.MESSAGE, EventType.POLL_START)) return null
// Ignore message edition
if (event.isEdition()) return null
@ -153,7 +153,8 @@ class NotifiableEventResolver @Inject constructor(
event.attemptToDecryptIfNeeded(session)
// only convert encrypted messages to NotifiableMessageEvents
when (event.root.getClearType()) {
EventType.MESSAGE -> {
EventType.MESSAGE,
EventType.POLL_START -> {
val body = displayableEventFormatter.format(event, isDm = room.roomSummary()?.isDirect.orFalse(), appendAuthor = false).toString()
val roomName = room.roomSummary()?.displayName ?: ""
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
@ -185,7 +186,7 @@ class NotifiableEventResolver @Inject constructor(
soundName = null
)
}
else -> null
else -> null
}
}
}