mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Code review fixes.
This commit is contained in:
parent
7fa43f0d1b
commit
a47b589e72
2 changed files with 6 additions and 3 deletions
|
@ -406,3 +406,5 @@ fun Event.isInvitation(): Boolean = type == EventType.STATE_ROOM_MEMBER &&
|
|||
fun Event.getPollContent(): MessagePollContent? {
|
||||
return content.toModel<MessagePollContent>()
|
||||
}
|
||||
|
||||
fun Event.supportsNotification() = this.getClearType() in EventType.MESSAGE + EventType.POLL_START
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
|
|||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.events.model.isEdition
|
||||
import org.matrix.android.sdk.api.session.events.model.isImageMessage
|
||||
import org.matrix.android.sdk.api.session.events.model.supportsNotification
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
|
||||
|
@ -94,7 +95,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
}
|
||||
|
||||
suspend fun resolveInMemoryEvent(session: Session, event: Event, canBeReplaced: Boolean): NotifiableEvent? {
|
||||
if (event.getClearType() !in listOf(EventType.MESSAGE, EventType.POLL_START)) return null
|
||||
if (!event.supportsNotification()) return null
|
||||
|
||||
// Ignore message edition
|
||||
if (event.isEdition()) return null
|
||||
|
@ -154,7 +155,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
// only convert encrypted messages to NotifiableMessageEvents
|
||||
when (event.root.getClearType()) {
|
||||
EventType.MESSAGE,
|
||||
EventType.POLL_START -> {
|
||||
in 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
|
||||
|
@ -186,7 +187,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
soundName = null
|
||||
)
|
||||
}
|
||||
else -> null
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue