feat: Display stickers in messages (#200)

This commit introduces the ability to display stickers within message bubbles.

Key changes:
- `Attachments.kt`: Added handling for `AttachmentType.STICKER`. If an attachment type is unsupported, a placeholder text is now displayed.
- `Sticker.kt`: New composable created to render `VkStickerDomain` using `AsyncImage`.
- `MessageBubble.kt`:
    - Adjusted background alpha for sticker messages to make the bubble transparent.
    - Minor refactoring of `minDateContainerWidth` and `dateContainerWidth` initialization.
- `VkStickerDomain.kt`: Added `getUrl()` function to construct sticker image URLs, with options for specifying width and background.
This commit is contained in:
2025-06-26 19:54:33 +03:00
committed by GitHub
parent 93d81f1e9e
commit 60a30b9422
4 changed files with 98 additions and 21 deletions
@@ -21,4 +21,12 @@ data class VkStickerDomain(
return null
}
fun getUrl(width: Int = 256, withBackground: Boolean = false): String? = when {
withBackground && backgroundImages != null -> {
backgroundImages.firstOrNull { it.width >= width }?.url
}
images != null -> images.firstOrNull { it.width >= width }?.url
else -> "https://vk.com/sticker/1-${id}-${width}b"
}
}