mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 18:26:35 +02:00
don't use image gallery for secret message
This commit is contained in:
@@ -796,55 +796,29 @@ fun CoreSecretMessage(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (localSecretContent.paragraphs.size == 1) {
|
if (localSecretContent.paragraphs.size == 1) {
|
||||||
RenderSecretParagraphOptimized(
|
localSecretContent.paragraphs[0].words.forEach { word ->
|
||||||
localSecretContent.paragraphs[0].words.toImmutableList(),
|
RenderWordWithPreview(
|
||||||
|
word,
|
||||||
context,
|
context,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
} else if (localSecretContent.paragraphs.size > 1) {
|
} else if (localSecretContent.paragraphs.size > 1) {
|
||||||
val spaceWidth = measureSpaceWidth(LocalTextStyle.current)
|
val spaceWidth = measureSpaceWidth(LocalTextStyle.current)
|
||||||
|
|
||||||
Column(CashuCardBorders) {
|
Column(CashuCardBorders) {
|
||||||
localSecretContent.paragraphs.forEach { paragraph ->
|
localSecretContent.paragraphs.forEach { paragraph ->
|
||||||
RenderSecretParagraphOptimized(
|
FlowRow(
|
||||||
paragraph.words.toImmutableList(),
|
modifier = Modifier.align(if (paragraph.isRTL) Alignment.End else Alignment.Start),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(spaceWidth),
|
||||||
|
) {
|
||||||
|
paragraph.words.forEach { word ->
|
||||||
|
RenderWordWithPreview(
|
||||||
|
word,
|
||||||
context,
|
context,
|
||||||
spaceWidth,
|
|
||||||
paragraph.isRTL,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
|
||||||
@Composable
|
|
||||||
private fun RenderSecretParagraphOptimized(
|
|
||||||
words: ImmutableList<Segment>,
|
|
||||||
context: RenderContext,
|
|
||||||
spaceWidth: Dp? = null,
|
|
||||||
isRTL: Boolean = false,
|
|
||||||
) {
|
|
||||||
// Check if we need single-image optimization
|
|
||||||
val imageSegments = words.filter { it is ImageSegment || it is Base64Segment }
|
|
||||||
|
|
||||||
if (imageSegments.size > 1) {
|
|
||||||
// Multiple images - use gallery logic
|
|
||||||
RenderWordsWithImageGallery(words, context)
|
|
||||||
} else {
|
|
||||||
// Single or no images - render directly with FlowRow for optimal performance
|
|
||||||
val actualSpaceWidth = spaceWidth ?: measureSpaceWidth(LocalTextStyle.current)
|
|
||||||
|
|
||||||
CompositionLocalProvider(
|
|
||||||
LocalLayoutDirection provides if (isRTL) LayoutDirection.Rtl else LayoutDirection.Ltr,
|
|
||||||
LocalTextStyle provides LocalTextStyle.current,
|
|
||||||
) {
|
|
||||||
FlowRow(
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(actualSpaceWidth),
|
|
||||||
) {
|
|
||||||
words.forEach { word ->
|
|
||||||
RenderWordWithPreview(word, context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user