Prepare update to Rust SDK 0.1.36 (#966)

* Update to Rust SDK 0.1.36

* Cancel fetching members when the we exit the room
This commit is contained in:
Jorge Martin Espinosa 2023-07-26 16:22:09 +02:00 committed by GitHub
parent c620e64ca6
commit a9d1a299f5
16 changed files with 99 additions and 55 deletions

View file

@ -517,42 +517,46 @@ private fun ReplyToContent(
}
}
private fun attachmentThumbnailInfoForInReplyTo(inReplyTo: InReplyTo.Ready) =
when (val type = inReplyTo.content.type) {
private fun attachmentThumbnailInfoForInReplyTo(inReplyTo: InReplyTo.Ready): AttachmentThumbnailInfo? {
val messageContent = inReplyTo.content as? MessageContent ?: return null
return when (val type = messageContent.type) {
is ImageMessageType -> AttachmentThumbnailInfo(
thumbnailSource = type.info?.thumbnailSource,
textContent = inReplyTo.content.body,
textContent = messageContent.body,
type = AttachmentThumbnailType.Image,
blurHash = type.info?.blurhash,
)
is VideoMessageType -> AttachmentThumbnailInfo(
thumbnailSource = type.info?.thumbnailSource,
textContent = inReplyTo.content.body,
textContent = messageContent.body,
type = AttachmentThumbnailType.Video,
blurHash = type.info?.blurhash,
)
is FileMessageType -> AttachmentThumbnailInfo(
thumbnailSource = type.info?.thumbnailSource,
textContent = inReplyTo.content.body,
textContent = messageContent.body,
type = AttachmentThumbnailType.File,
)
is LocationMessageType -> AttachmentThumbnailInfo(
textContent = inReplyTo.content.body,
textContent = messageContent.body,
type = AttachmentThumbnailType.Location,
)
is AudioMessageType -> AttachmentThumbnailInfo(
textContent = inReplyTo.content.body,
textContent = messageContent.body,
type = AttachmentThumbnailType.Audio,
)
else -> null
}
}
@Composable
private fun textForInReplyTo(inReplyTo: InReplyTo.Ready) =
when (inReplyTo.content.type) {
private fun textForInReplyTo(inReplyTo: InReplyTo.Ready): String {
val messageContent = inReplyTo.content as? MessageContent ?: return ""
return when (messageContent.type) {
is LocationMessageType -> stringResource(CommonStrings.common_shared_location)
else -> inReplyTo.content.body
else -> messageContent.body
}
}
@Preview
@Composable