Merge pull request #6747 from vector-im/fix/mna/notification-lls-poll-start
[Notification] - Handle creation of notification for live location and poll start (PSG-41)
This commit is contained in:
commit
73e437de0b
1
changelog.d/6746.feature
Normal file
1
changelog.d/6746.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
[Notification] - Handle creation of notification for live location and poll start
|
@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Content
|
|||||||
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
|
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of the state event of type
|
* Content of the event of type
|
||||||
* [EventType.BEACON_LOCATION_DATA][org.matrix.android.sdk.api.session.events.model.EventType.BEACON_LOCATION_DATA]
|
* [EventType.BEACON_LOCATION_DATA][org.matrix.android.sdk.api.session.events.model.EventType.BEACON_LOCATION_DATA]
|
||||||
*
|
*
|
||||||
* It contains location data related to a live location share.
|
* It contains location data related to a live location share.
|
||||||
|
@ -65,9 +65,10 @@ class NotifiableEventResolver @Inject constructor(
|
|||||||
private val buildMeta: BuildMeta,
|
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 roomID = event.roomId ?: return null
|
||||||
val eventId = event.eventId ?: return null
|
val eventId = event.eventId ?: return null
|
||||||
if (event.getClearType() == EventType.STATE_ROOM_MEMBER) {
|
if (event.getClearType() == EventType.STATE_ROOM_MEMBER) {
|
||||||
@ -75,7 +76,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||||||
}
|
}
|
||||||
val timelineEvent = session.getRoom(roomID)?.getTimelineEvent(eventId) ?: return null
|
val timelineEvent = session.getRoom(roomID)?.getTimelineEvent(eventId) ?: return null
|
||||||
return when (event.getClearType()) {
|
return when (event.getClearType()) {
|
||||||
EventType.MESSAGE,
|
in nonEncryptedNotifiableEventTypes,
|
||||||
EventType.ENCRYPTED -> {
|
EventType.ENCRYPTED -> {
|
||||||
resolveMessageEvent(timelineEvent, session, canBeReplaced = false, isNoisy = isNoisy)
|
resolveMessageEvent(timelineEvent, session, canBeReplaced = false, isNoisy = isNoisy)
|
||||||
}
|
}
|
||||||
@ -161,9 +162,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||||||
event.attemptToDecryptIfNeeded(session)
|
event.attemptToDecryptIfNeeded(session)
|
||||||
// only convert encrypted messages to NotifiableMessageEvents
|
// only convert encrypted messages to NotifiableMessageEvents
|
||||||
when (event.root.getClearType()) {
|
when (event.root.getClearType()) {
|
||||||
EventType.MESSAGE,
|
in nonEncryptedNotifiableEventTypes -> {
|
||||||
in EventType.POLL_START,
|
|
||||||
in EventType.STATE_ROOM_BEACON_INFO -> {
|
|
||||||
val body = displayableEventFormatter.format(event, isDm = room.roomSummary()?.isDirect.orFalse(), appendAuthor = false).toString()
|
val body = displayableEventFormatter.format(event, isDm = room.roomSummary()?.isDirect.orFalse(), appendAuthor = false).toString()
|
||||||
val roomName = room.roomSummary()?.displayName ?: ""
|
val roomName = room.roomSummary()?.displayName ?: ""
|
||||||
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user