From ce7300b4bbc137b9e8f537889006b72fe00e7066 Mon Sep 17 00:00:00 2001 From: Jesse Horne Date: Tue, 28 Nov 2023 14:02:15 -0500 Subject: [PATCH] removed some repetition --- .../common/views/chat/item/FramedItemView.kt | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt index cdf07abb42..b8d7b15281 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt @@ -51,6 +51,19 @@ fun FramedItemView( @Composable fun Color.toQuote(): Color = if (isInDarkTheme()) lighter(0.12f) else darker(0.12f) + @Composable + fun ciQuotedMsgTextViewMarkdown(qi: CIQuote, lines: Int) { + MarkdownText( + qi.text, + qi.formattedText, + maxLines = lines, + overflow = TextOverflow.Ellipsis, + style = TextStyle(fontSize = 15.sp, color = MaterialTheme.colors.onSurface), + linkMode = linkMode, + uriHandler = if (appPlatform.isDesktop) uriHandler else null + ) + } + @Composable fun ciQuotedMsgTextView(qi: CIQuote, lines: Int) { if (appPlatform.isDesktop) { @@ -60,26 +73,10 @@ fun FramedItemView( onClick = { showMenu.value = true } ) ) { - MarkdownText( - qi.text, - qi.formattedText, - maxLines = lines, - overflow = TextOverflow.Ellipsis, - style = TextStyle(fontSize = 15.sp, color = MaterialTheme.colors.onSurface), - linkMode = linkMode, - uriHandler = if (appPlatform.isDesktop) uriHandler else null - ) + ciQuotedMsgTextViewMarkdown(qi, lines) } } else { - MarkdownText( - qi.text, - qi.formattedText, - maxLines = lines, - overflow = TextOverflow.Ellipsis, - style = TextStyle(fontSize = 15.sp, color = MaterialTheme.colors.onSurface), - linkMode = linkMode, - uriHandler = if (appPlatform.isDesktop) uriHandler else null - ) + ciQuotedMsgTextViewMarkdown(qi, lines) } }