feat: show copy button on tap instead of long-hold (#449)
Changes message bubbles (user + assistant) so the copy button appears on a single tap rather than requiring a long-hold gesture. - UserBubble: combinedClickable → clickable with showCopyButton - AssistantBubble: combinedClickable → clickable with showCopyButton - Removed unused combinedClickable import + ExperimentalFoundationApi opt-in Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
c5e7f71784
commit
710b60bc6e
1 file changed
+4
-10
@@ -12,10 +12,8 @@ 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.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
|
||||||
@@ -149,7 +147,6 @@ fun ChatBubble(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun UserBubble(
|
private fun UserBubble(
|
||||||
message: ChatMessage,
|
message: ChatMessage,
|
||||||
@@ -224,10 +221,9 @@ private fun UserBubble(
|
|||||||
),
|
),
|
||||||
).background(brush = gradientBrush)
|
).background(brush = gradientBrush)
|
||||||
.testTag("chat_bubble_user")
|
.testTag("chat_bubble_user")
|
||||||
.combinedClickable(
|
.clickable(
|
||||||
role = Role.Button,
|
role = Role.Button,
|
||||||
onClick = {},
|
onClick = {
|
||||||
onLongClick = {
|
|
||||||
showCopyButton = true
|
showCopyButton = true
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -304,7 +300,6 @@ private fun UserBubble(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AssistantBubble(
|
private fun AssistantBubble(
|
||||||
message: ChatMessage,
|
message: ChatMessage,
|
||||||
@@ -362,10 +357,9 @@ private fun AssistantBubble(
|
|||||||
bottomEnd = 16.dp,
|
bottomEnd = 16.dp,
|
||||||
),
|
),
|
||||||
).testTag("chat_bubble_assistant")
|
).testTag("chat_bubble_assistant")
|
||||||
.combinedClickable(
|
.clickable(
|
||||||
role = Role.Button,
|
role = Role.Button,
|
||||||
onClick = {},
|
onClick = {
|
||||||
onLongClick = {
|
|
||||||
showCopyButton = true
|
showCopyButton = true
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user