mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Handling notifications for beacon_info and poll_start events
This commit is contained in:
parent
de240b7318
commit
89f31b093e
1 changed files with 5 additions and 6 deletions
|
@ -65,9 +65,10 @@ class NotifiableEventResolver @Inject constructor(
|
|||
private val buildMeta: BuildMeta,
|
||||
) {
|
||||
|
||||
// private val eventDisplay = RiotEventDisplay(context)
|
||||
private val nonEncryptedNotifiableEventTypes: List<String> =
|
||||
listOf(EventType.MESSAGE) + EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO
|
||||
|
||||
suspend fun resolveEvent(event: Event/*, roomState: RoomState?, bingRule: PushRule?*/, session: Session, isNoisy: Boolean): NotifiableEvent? {
|
||||
suspend fun resolveEvent(event: Event, session: Session, isNoisy: Boolean): NotifiableEvent? {
|
||||
val roomID = event.roomId ?: return null
|
||||
val eventId = event.eventId ?: return null
|
||||
if (event.getClearType() == EventType.STATE_ROOM_MEMBER) {
|
||||
|
@ -75,7 +76,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
}
|
||||
val timelineEvent = session.getRoom(roomID)?.getTimelineEvent(eventId) ?: return null
|
||||
return when (event.getClearType()) {
|
||||
EventType.MESSAGE,
|
||||
in nonEncryptedNotifiableEventTypes,
|
||||
EventType.ENCRYPTED -> {
|
||||
resolveMessageEvent(timelineEvent, session, canBeReplaced = false, isNoisy = isNoisy)
|
||||
}
|
||||
|
@ -161,9 +162,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
event.attemptToDecryptIfNeeded(session)
|
||||
// only convert encrypted messages to NotifiableMessageEvents
|
||||
when (event.root.getClearType()) {
|
||||
EventType.MESSAGE,
|
||||
in EventType.POLL_START,
|
||||
in EventType.STATE_ROOM_BEACON_INFO -> {
|
||||
in nonEncryptedNotifiableEventTypes -> {
|
||||
val body = displayableEventFormatter.format(event, isDm = room.roomSummary()?.isDirect.orFalse(), appendAuthor = false).toString()
|
||||
val roomName = room.roomSummary()?.displayName ?: ""
|
||||
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
||||
|
|
Loading…
Reference in a new issue