- 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
+12
-14
@@ -10,10 +10,9 @@ import androidx.compose.animation.fadeOut
|
|||||||
import androidx.compose.animation.scaleIn
|
import androidx.compose.animation.scaleIn
|
||||||
import androidx.compose.animation.scaleOut
|
import androidx.compose.animation.scaleOut
|
||||||
import androidx.compose.foundation.BorderStroke
|
import androidx.compose.foundation.BorderStroke
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
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.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
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.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.luminance
|
import androidx.compose.ui.graphics.luminance
|
||||||
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
import androidx.compose.ui.platform.LocalClipboardManager
|
import androidx.compose.ui.platform.LocalClipboardManager
|
||||||
import androidx.compose.ui.platform.LocalConfiguration
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
@@ -129,7 +129,6 @@ fun ChatBubble(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun UserBubble(
|
private fun UserBubble(
|
||||||
message: ChatMessage,
|
message: ChatMessage,
|
||||||
@@ -203,13 +202,13 @@ private fun UserBubble(
|
|||||||
),
|
),
|
||||||
).background(brush = gradientBrush)
|
).background(brush = gradientBrush)
|
||||||
.testTag("chat_bubble_user")
|
.testTag("chat_bubble_user")
|
||||||
.combinedClickable(
|
.pointerInput(message.id) {
|
||||||
role = Role.Button,
|
detectTapGestures(
|
||||||
onClick = {},
|
onLongPress = {
|
||||||
onLongClick = {
|
|
||||||
showCopyButton = true
|
showCopyButton = true
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
|
},
|
||||||
color = Color.Transparent,
|
color = Color.Transparent,
|
||||||
tonalElevation = 0.dp,
|
tonalElevation = 0.dp,
|
||||||
) {
|
) {
|
||||||
@@ -270,7 +269,6 @@ private fun UserBubble(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AssistantBubble(
|
private fun AssistantBubble(
|
||||||
message: ChatMessage,
|
message: ChatMessage,
|
||||||
@@ -327,13 +325,13 @@ private fun AssistantBubble(
|
|||||||
bottomEnd = 16.dp,
|
bottomEnd = 16.dp,
|
||||||
),
|
),
|
||||||
).testTag("chat_bubble_assistant")
|
).testTag("chat_bubble_assistant")
|
||||||
.combinedClickable(
|
.pointerInput(message.id) {
|
||||||
role = Role.Button,
|
detectTapGestures(
|
||||||
onClick = {},
|
onLongPress = {
|
||||||
onLongClick = {
|
|
||||||
showCopyButton = true
|
showCopyButton = true
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
|
},
|
||||||
color = bubbleColor,
|
color = bubbleColor,
|
||||||
border =
|
border =
|
||||||
BorderStroke(
|
BorderStroke(
|
||||||
|
|||||||
Reference in new issue
Block a user