Maxing out post size when on Twitter-like interfaces.

This commit is contained in:
Vitor Pamplona
2023-02-20 17:36:20 -05:00
parent dbcd5ed7fe
commit a24e6391dc
7 changed files with 12 additions and 7 deletions
@@ -28,6 +28,7 @@ import androidx.navigation.NavController
fun ExpandableRichTextViewer( fun ExpandableRichTextViewer(
content: String, content: String,
canPreview: Boolean, canPreview: Boolean,
modifier: Modifier = Modifier,
tags: List<List<String>>?, tags: List<List<String>>?,
navController: NavController navController: NavController
) { ) {
@@ -36,7 +37,7 @@ fun ExpandableRichTextViewer(
val text = if (showFullText) content else content.take(350) val text = if (showFullText) content else content.take(350)
Box(contentAlignment = Alignment.BottomCenter) { Box(contentAlignment = Alignment.BottomCenter) {
RichTextViewer(text, canPreview, tags, navController) RichTextViewer(text, canPreview, modifier, tags, navController)
if (content.length > 350 && !showFullText) { if (content.length > 350 && !showFullText) {
Row( Row(
@@ -45,12 +45,11 @@ fun isValidURL(url: String?): Boolean {
fun RichTextViewer( fun RichTextViewer(
content: String, content: String,
canPreview: Boolean, canPreview: Boolean,
modifier: Modifier = Modifier,
tags: List<List<String>>?, tags: List<List<String>>?,
navController: NavController navController: NavController,
) { ) {
Column( Column(modifier = modifier.animateContentSize()) {
Modifier
.animateContentSize()) {
// FlowRow doesn't work well with paragraphs. So we need to split them // FlowRow doesn't work well with paragraphs. So we need to split them
content.split('\n').forEach { paragraph -> content.split('\n').forEach { paragraph ->
@@ -37,6 +37,7 @@ import java.util.Locale
fun TranslateableRichTextViewer( fun TranslateableRichTextViewer(
content: String, content: String,
canPreview: Boolean, canPreview: Boolean,
modifier: Modifier = Modifier,
tags: List<List<String>>?, tags: List<List<String>>?,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
navController: NavController navController: NavController
@@ -70,6 +71,7 @@ fun TranslateableRichTextViewer(
ExpandableRichTextViewer( ExpandableRichTextViewer(
toBeViewed, toBeViewed,
canPreview, canPreview,
modifier,
tags, tags,
navController navController
) )
@@ -224,6 +224,7 @@ fun ChatroomMessageCompose(baseNote: Note, routeForLastRead: String?, innerQuote
TranslateableRichTextViewer( TranslateableRichTextViewer(
eventContent, eventContent,
canPreview, canPreview,
Modifier,
note.event?.tags, note.event?.tags,
accountViewModel, accountViewModel,
navController navController
@@ -232,6 +233,7 @@ fun ChatroomMessageCompose(baseNote: Note, routeForLastRead: String?, innerQuote
TranslateableRichTextViewer( TranslateableRichTextViewer(
"Could Not decrypt the message", "Could Not decrypt the message",
true, true,
Modifier,
note.event?.tags, note.event?.tags,
accountViewModel, accountViewModel,
navController navController
@@ -312,6 +312,7 @@ fun NoteCompose(
TranslateableRichTextViewer( TranslateableRichTextViewer(
eventContent, eventContent,
canPreview, canPreview,
Modifier.fillMaxWidth(),
noteEvent.tags, noteEvent.tags,
accountViewModel, accountViewModel,
navController navController
@@ -128,14 +128,13 @@ open class CardFeedViewModel(val dataSource: FeedFilter<Note>): ViewModel() {
val scope = CoroutineScope(Job() + Dispatchers.Default) val scope = CoroutineScope(Job() + Dispatchers.Default)
scope.launch { scope.launch {
try { try {
delay(50) delay(150)
refresh() refresh()
} finally { } finally {
withContext(NonCancellable) { withContext(NonCancellable) {
handlerWaiting.set(false) handlerWaiting.set(false)
} }
} }
handlerWaiting.set(false)
} }
} }
@@ -218,6 +218,7 @@ fun NoteMaster(baseNote: Note, accountViewModel: AccountViewModel, navController
TranslateableRichTextViewer( TranslateableRichTextViewer(
eventContent, eventContent,
canPreview, canPreview,
Modifier.fillMaxWidth(),
note.event?.tags, note.event?.tags,
accountViewModel, accountViewModel,
navController navController