- Replaced `.combinedClickable` with `.pointerInput` keyed on the message `id`.
- Removed `onClick = {}` interception, allowing tap events to naturally pass through to internal components like Markdown hyperlinks.
- Removed unused `@OptIn(ExperimentalFoundationApi::class)`.
This commit is contained in:
1 file changed
+16
-18
@@ -10,10 +10,9 @@ import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.scaleIn
|
||||
import androidx.compose.animation.scaleOut
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -53,6 +52,7 @@ import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.luminance
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalClipboardManager
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
@@ -129,7 +129,6 @@ fun ChatBubble(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun UserBubble(
|
||||
message: ChatMessage,
|
||||
@@ -203,13 +202,13 @@ private fun UserBubble(
|
||||
),
|
||||
).background(brush = gradientBrush)
|
||||
.testTag("chat_bubble_user")
|
||||
.combinedClickable(
|
||||
role = Role.Button,
|
||||
onClick = {},
|
||||
onLongClick = {
|
||||
showCopyButton = true
|
||||
},
|
||||
),
|
||||
.pointerInput(message.id) {
|
||||
detectTapGestures(
|
||||
onLongPress = {
|
||||
showCopyButton = true
|
||||
},
|
||||
)
|
||||
},
|
||||
color = Color.Transparent,
|
||||
tonalElevation = 0.dp,
|
||||
) {
|
||||
@@ -270,7 +269,6 @@ private fun UserBubble(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun AssistantBubble(
|
||||
message: ChatMessage,
|
||||
@@ -327,13 +325,13 @@ private fun AssistantBubble(
|
||||
bottomEnd = 16.dp,
|
||||
),
|
||||
).testTag("chat_bubble_assistant")
|
||||
.combinedClickable(
|
||||
role = Role.Button,
|
||||
onClick = {},
|
||||
onLongClick = {
|
||||
showCopyButton = true
|
||||
},
|
||||
),
|
||||
.pointerInput(message.id) {
|
||||
detectTapGestures(
|
||||
onLongPress = {
|
||||
showCopyButton = true
|
||||
},
|
||||
)
|
||||
},
|
||||
color = bubbleColor,
|
||||
border =
|
||||
BorderStroke(
|
||||
|
||||
Reference in new issue
Block a user