feat: add channel message support and refactor UI components
- Implement `VkChannelMessage` domain and data models for channel message attachments - Add `CHANNEL_MESSAGE` to `AttachmentType` and map it to relevant UI resources and strings - Refactor `Sticker` and `Gift` composables to accept URL strings instead of domain objects for better decoupling - Simplify `AppTheme` by removing redundant color animations and passing the color scheme directly to `MaterialExpressiveTheme` - Update `LoginScreen` to include a theme toggle (classic vs. light) and improve back-button behavior by resetting error states - Bump VK API version from 5.238 to 5.263 - Adjust layout and padding for sticker and gift attachment previews
This commit is contained in:
+5
-2
@@ -119,12 +119,15 @@ fun Attachments(
|
||||
|
||||
AttachmentType.STICKER -> {
|
||||
Sticker(
|
||||
item = attachment as VkStickerDomain
|
||||
url = (attachment as VkStickerDomain).getUrl(
|
||||
width = 256,
|
||||
withBackground = false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
AttachmentType.GIFT -> {
|
||||
Gift(item = attachment as VkGiftDomain)
|
||||
Gift(url = (attachment as VkGiftDomain).getDefaultThumbSizeOrLess())
|
||||
}
|
||||
|
||||
AttachmentType.VIDEO_MESSAGE -> {
|
||||
|
||||
+6
-7
@@ -21,25 +21,24 @@ import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import dev.meloda.fast.model.api.domain.VkGiftDomain
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun Gift(
|
||||
modifier: Modifier = Modifier,
|
||||
item: VkGiftDomain
|
||||
url: String
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier.width(192.dp),
|
||||
modifier = modifier
|
||||
.width(208.dp)
|
||||
.padding(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||
) {
|
||||
AsyncImage(
|
||||
model = item.getDefaultThumbSizeOrLess(),
|
||||
model = url,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.padding(8.dp)
|
||||
.fillMaxWidth()
|
||||
modifier = Modifier.size(192.dp)
|
||||
)
|
||||
|
||||
Row(
|
||||
|
||||
+6
-10
@@ -10,27 +10,23 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.compose.AsyncImage
|
||||
import dev.meloda.fast.model.api.domain.VkStickerDomain
|
||||
|
||||
@Composable
|
||||
fun Sticker(
|
||||
modifier: Modifier = Modifier,
|
||||
item: VkStickerDomain
|
||||
url: String?
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier.size(192.dp),
|
||||
modifier = modifier
|
||||
.size(208.dp)
|
||||
.padding(8.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
AsyncImage(
|
||||
model = item.getUrl(
|
||||
width = 256,
|
||||
withBackground = false
|
||||
),
|
||||
model = url,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.padding(8.dp)
|
||||
.fillMaxSize()
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user