cleaner code, fewer warnings

This commit is contained in:
David Kaspar
2024-11-16 09:29:45 +01:00
parent 8216476916
commit f16143bec3
@@ -242,9 +242,9 @@ fun RenderThreadFeed(
// In that case, this screen will open with 0-1 items, and the scrollToItem below // In that case, this screen will open with 0-1 items, and the scrollToItem below
// will not change the state of the screen (too few items, scroll is not available) // will not change the state of the screen (too few items, scroll is not available)
// as the app loads the reaming of the thread the position of the reply changes // as the app loads the reaming of the thread the position of the reply changes
// and becuase there wasn't a possibility to scroll before and now there is one, // and because there wasn't a possibility to scroll before and now there is one,
// the screen stays at the top. Once the thread has enough replies, the lazy column // the screen stays at the top. Once the thread has enough replies, the lazy column
// updates with new items correctly. It just needs a few items to start the scrool. // updates with new items correctly. It just needs a few items to start the scroll.
// //
// This hack allows the list 1 second to fill up with more // This hack allows the list 1 second to fill up with more
// records before setting up the position on the feed. // records before setting up the position on the feed.
@@ -482,14 +482,22 @@ private fun FullBleedNoteCompose(
Spacer(modifier = Modifier.height(10.dp)) Spacer(modifier = Modifier.height(10.dp))
if (noteEvent is BadgeDefinitionEvent) { when (noteEvent) {
BadgeDisplay(baseNote = baseNote) is BadgeDefinitionEvent -> {
} else if (noteEvent is LongTextNoteEvent) { BadgeDisplay(baseNote = baseNote)
RenderLongFormHeaderForThread(noteEvent) }
} else if (noteEvent is WikiNoteEvent) {
RenderWikiHeaderForThread(noteEvent, accountViewModel, nav) is LongTextNoteEvent -> {
} else if (noteEvent is ClassifiedsEvent) { RenderLongFormHeaderForThread(noteEvent)
RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav) }
is WikiNoteEvent -> {
RenderWikiHeaderForThread(noteEvent, accountViewModel, nav)
}
is ClassifiedsEvent -> {
RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav)
}
} }
Row( Row(
@@ -510,11 +518,11 @@ private fun FullBleedNoteCompose(
nav = nav, nav = nav,
) )
} else if (noteEvent is VideoEvent) { } else if (noteEvent is VideoEvent) {
VideoDisplay(baseNote, false, true, backgroundColor, false, accountViewModel, nav) VideoDisplay(baseNote, makeItShort = false, canPreview = true, backgroundColor = backgroundColor, isFiniteHeight = false, accountViewModel = accountViewModel, nav = nav)
} else if (noteEvent is FileHeaderEvent) { } else if (noteEvent is FileHeaderEvent) {
FileHeaderDisplay(baseNote, true, false, accountViewModel) FileHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel)
} else if (noteEvent is FileStorageHeaderEvent) { } else if (noteEvent is FileStorageHeaderEvent) {
FileStorageHeaderDisplay(baseNote, true, false, accountViewModel) FileStorageHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel)
} else if (noteEvent is PeopleListEvent) { } else if (noteEvent is PeopleListEvent) {
DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav) DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav)
} else if (noteEvent is AudioTrackEvent) { } else if (noteEvent is AudioTrackEvent) {
@@ -561,9 +569,9 @@ private fun FullBleedNoteCompose(
} else if (noteEvent is GitRepositoryEvent) { } else if (noteEvent is GitRepositoryEvent) {
RenderGitRepositoryEvent(baseNote, accountViewModel, nav) RenderGitRepositoryEvent(baseNote, accountViewModel, nav)
} else if (noteEvent is GitPatchEvent) { } else if (noteEvent is GitPatchEvent) {
RenderGitPatchEvent(baseNote, false, true, quotesLeft = 3, backgroundColor, accountViewModel, nav) RenderGitPatchEvent(baseNote, makeItShort = false, canPreview = true, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav)
} else if (noteEvent is GitIssueEvent) { } else if (noteEvent is GitIssueEvent) {
RenderGitIssueEvent(baseNote, false, true, quotesLeft = 3, backgroundColor, accountViewModel, nav) RenderGitIssueEvent(baseNote, makeItShort = false, canPreview = true, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav)
} else if (noteEvent is AppDefinitionEvent) { } else if (noteEvent is AppDefinitionEvent) {
RenderAppDefinition(baseNote, accountViewModel, nav) RenderAppDefinition(baseNote, accountViewModel, nav)
} else if (noteEvent is DraftEvent) { } else if (noteEvent is DraftEvent) {
@@ -670,7 +678,7 @@ private fun FullBleedNoteCompose(
} }
} }
ReactionsRow(baseNote, true, true, editState, accountViewModel, nav) ReactionsRow(baseNote, showReactionDetail = true, addPadding = true, editState = editState, accountViewModel = accountViewModel, nav = nav)
} }
} }
@@ -922,14 +930,14 @@ private fun RenderWikiHeaderForThreadPreview() {
RenderWikiHeaderForThread(noteEvent = event, accountViewModel = accountViewModel, nav) RenderWikiHeaderForThread(noteEvent = event, accountViewModel = accountViewModel, nav)
RenderTextEvent( RenderTextEvent(
baseNote!!, baseNote!!,
false, makeItShort = false,
true, canPreview = true,
quotesLeft = 3, quotesLeft = 3,
unPackReply = false, unPackReply = false,
backgroundColor, backgroundColor = backgroundColor,
editState, editState = editState,
accountViewModel, accountViewModel = accountViewModel,
nav, nav = nav,
) )
} }
} }