Display poll notifications in the notification drawer (#1467)
Display notifications for polls as if they were message events.
This commit is contained in:
parent
70dfbd7c31
commit
f10040f729
3 changed files with 21 additions and 5 deletions
|
|
@ -61,7 +61,10 @@ sealed interface NotificationContent {
|
||||||
) : MessageLike
|
) : MessageLike
|
||||||
data object RoomRedaction : MessageLike
|
data object RoomRedaction : MessageLike
|
||||||
data object Sticker : MessageLike
|
data object Sticker : MessageLike
|
||||||
data class Poll(val question: String) : MessageLike
|
data class Poll(
|
||||||
|
val senderId: UserId,
|
||||||
|
val question: String,
|
||||||
|
) : MessageLike
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface StateEvent : NotificationContent {
|
sealed interface StateEvent : NotificationContent {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
|
||||||
}
|
}
|
||||||
MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction
|
MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction
|
||||||
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
||||||
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(question)
|
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,22 @@ class NotifiableEventResolver @Inject constructor(
|
||||||
NotificationContent.MessageLike.KeyVerificationStart -> null.also {
|
NotificationContent.MessageLike.KeyVerificationStart -> null.also {
|
||||||
Timber.tag(loggerTag.value).d("Ignoring notification for verification ${content.javaClass.simpleName}")
|
Timber.tag(loggerTag.value).d("Ignoring notification for verification ${content.javaClass.simpleName}")
|
||||||
}
|
}
|
||||||
is NotificationContent.MessageLike.Poll -> null.also {
|
is NotificationContent.MessageLike.Poll -> {
|
||||||
// TODO Polls: handle notification rendering
|
buildNotifiableMessageEvent(
|
||||||
Timber.tag(loggerTag.value).d("Ignoring notification for poll")
|
sessionId = userId,
|
||||||
|
senderId = content.senderId,
|
||||||
|
roomId = roomId,
|
||||||
|
eventId = eventId,
|
||||||
|
noisy = isNoisy,
|
||||||
|
timestamp = this.timestamp,
|
||||||
|
senderName = senderDisplayName,
|
||||||
|
body = stringProvider.getString(CommonStrings.common_poll_summary, content.question),
|
||||||
|
imageUriString = null,
|
||||||
|
roomName = roomDisplayName,
|
||||||
|
roomIsDirect = isDirect,
|
||||||
|
roomAvatarPath = roomAvatarUrl,
|
||||||
|
senderAvatarPath = senderAvatarUrl,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
is NotificationContent.MessageLike.ReactionContent -> null.also {
|
is NotificationContent.MessageLike.ReactionContent -> null.also {
|
||||||
Timber.tag(loggerTag.value).d("Ignoring notification for reaction")
|
Timber.tag(loggerTag.value).d("Ignoring notification for reaction")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue