From 734eeecbc16642c596c5fc3781325ed3c0d2d0f7 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Wed, 14 May 2025 23:37:39 +0200 Subject: [PATCH] DROID-3444 Chats | Enhancement | Bookmark flow updates - minor fixes (#2403) --- .../presentation/ChatViewModel.kt | 2 +- .../anytype/feature_chats/ui/Attachments.kt | 19 ++++++++++++++----- .../anytype/feature_chats/ui/ChatBubble.kt | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt index f53955f466..6a64bc0682 100644 --- a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt +++ b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt @@ -830,7 +830,7 @@ class ChatViewModel @Inject constructor( // TODO } is ChatView.Message.Attachment.Bookmark -> { - // TODO + commands.emit(ViewModelCommand.Browse(attachment.url)) } is ChatView.Message.Attachment.Link -> { val wrapper = attachment.wrapper diff --git a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/Attachments.kt b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/Attachments.kt index 1d9576a328..cb25c8eb22 100644 --- a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/Attachments.kt +++ b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/Attachments.kt @@ -121,7 +121,10 @@ fun BubbleAttachments( url = attachment.url, title = attachment.title, description = attachment.description, - imageUrl = attachment.imageUrl + imageUrl = attachment.imageUrl, + onClick = { + onAttachmentClicked(attachment) + } ) } } @@ -204,10 +207,16 @@ fun Bookmark( url: String, title: String, description: String, - imageUrl: String? + imageUrl: String?, + onClick: () -> Unit ) { Card( - modifier = Modifier.fillMaxWidth().padding(4.dp), + modifier = Modifier + .fillMaxWidth() + .padding(4.dp) + .clip(RoundedCornerShape(12.dp)) + .clickable { onClick() } + , colors = CardDefaults.cardColors( containerColor = colorResource(R.color.shape_transparent_secondary) ), @@ -218,7 +227,6 @@ fun Bookmark( painter = rememberAsyncImagePainter(imageUrl), modifier = Modifier .fillMaxWidth() - .background(color = Color.Red) .aspectRatio(1.91f), contentDescription = null, contentScale = ContentScale.Crop @@ -256,7 +264,8 @@ fun BookmarkPreview() { url = "algo.tv", title = "Algo - Video Automation", description = "Algo is a data-visualization studio specializing in video automation.", - imageUrl = null + imageUrl = null, + onClick = {} ) } diff --git a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt index a15595a97e..39b16bc07c 100644 --- a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt +++ b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt @@ -71,7 +71,7 @@ import com.anytypeio.anytype.feature_chats.R import com.anytypeio.anytype.feature_chats.presentation.ChatView import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi -@OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun Bubble( modifier: Modifier = Modifier,