Skip to content

Commit

Permalink
cleaner code, fewer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
davotoula committed Nov 16, 2024
1 parent 8216476 commit f16143b
Showing 1 changed file with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ fun RenderThreadFeed(
// 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)
// 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
// 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
// records before setting up the position on the feed.
Expand Down Expand Up @@ -482,14 +482,22 @@ private fun FullBleedNoteCompose(

Spacer(modifier = Modifier.height(10.dp))

if (noteEvent is BadgeDefinitionEvent) {
BadgeDisplay(baseNote = baseNote)
} else if (noteEvent is LongTextNoteEvent) {
RenderLongFormHeaderForThread(noteEvent)
} else if (noteEvent is WikiNoteEvent) {
RenderWikiHeaderForThread(noteEvent, accountViewModel, nav)
} else if (noteEvent is ClassifiedsEvent) {
RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav)
when (noteEvent) {
is BadgeDefinitionEvent -> {
BadgeDisplay(baseNote = baseNote)
}

is LongTextNoteEvent -> {
RenderLongFormHeaderForThread(noteEvent)
}

is WikiNoteEvent -> {
RenderWikiHeaderForThread(noteEvent, accountViewModel, nav)
}

is ClassifiedsEvent -> {
RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav)
}
}

Row(
Expand All @@ -510,11 +518,11 @@ private fun FullBleedNoteCompose(
nav = nav,
)
} 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) {
FileHeaderDisplay(baseNote, true, false, accountViewModel)
FileHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel)
} else if (noteEvent is FileStorageHeaderEvent) {
FileStorageHeaderDisplay(baseNote, true, false, accountViewModel)
FileStorageHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel)
} else if (noteEvent is PeopleListEvent) {
DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav)
} else if (noteEvent is AudioTrackEvent) {
Expand Down Expand Up @@ -561,9 +569,9 @@ private fun FullBleedNoteCompose(
} else if (noteEvent is GitRepositoryEvent) {
RenderGitRepositoryEvent(baseNote, accountViewModel, nav)
} 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) {
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) {
RenderAppDefinition(baseNote, accountViewModel, nav)
} else if (noteEvent is DraftEvent) {
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -922,14 +930,14 @@ private fun RenderWikiHeaderForThreadPreview() {
RenderWikiHeaderForThread(noteEvent = event, accountViewModel = accountViewModel, nav)
RenderTextEvent(
baseNote!!,
false,
true,
makeItShort = false,
canPreview = true,
quotesLeft = 3,
unPackReply = false,
backgroundColor,
editState,
accountViewModel,
nav,
backgroundColor = backgroundColor,
editState = editState,
accountViewModel = accountViewModel,
nav = nav,
)
}
}
Expand Down

0 comments on commit f16143b

Please sign in to comment.