Simple refactoring.

This commit is contained in:
Vitor Pamplona 2024-03-19 14:49:56 -04:00
parent b75c3e3031
commit a5496445d2
2 changed files with 25 additions and 67 deletions

View File

@ -728,57 +728,23 @@ private fun RenderNoteRow(
) { ) {
val noteEvent = baseNote.event val noteEvent = baseNote.event
when (noteEvent) { when (noteEvent) {
is AppDefinitionEvent -> { is AppDefinitionEvent -> RenderAppDefinition(baseNote, accountViewModel, nav)
RenderAppDefinition(baseNote, accountViewModel, nav) is AudioTrackEvent -> RenderAudioTrack(baseNote, accountViewModel, nav)
} is AudioHeaderEvent -> RenderAudioHeader(baseNote, accountViewModel, nav)
is AudioTrackEvent -> { is ReactionEvent -> RenderReaction(baseNote, quotesLeft, backgroundColor, accountViewModel, nav)
RenderAudioTrack(baseNote, accountViewModel, nav) is RepostEvent -> RenderRepost(baseNote, quotesLeft, backgroundColor, accountViewModel, nav)
} is GenericRepostEvent -> RenderRepost(baseNote, quotesLeft, backgroundColor, accountViewModel, nav)
is AudioHeaderEvent -> { is ReportEvent -> RenderReport(baseNote, quotesLeft, backgroundColor, accountViewModel, nav)
RenderAudioHeader(baseNote, accountViewModel, nav) is LongTextNoteEvent -> RenderLongFormContent(baseNote, accountViewModel, nav)
} is WikiNoteEvent -> RenderWikiContent(baseNote, accountViewModel, nav)
is ReactionEvent -> { is BadgeAwardEvent -> RenderBadgeAward(baseNote, backgroundColor, accountViewModel, nav)
RenderReaction(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) is FhirResourceEvent -> RenderFhirResource(baseNote, accountViewModel, nav)
} is PeopleListEvent -> DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav)
is RepostEvent -> { is RelaySetEvent -> DisplayRelaySet(baseNote, backgroundColor, accountViewModel, nav)
RenderRepost(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) is PinListEvent -> RenderPinListEvent(baseNote, backgroundColor, accountViewModel, nav)
} is EmojiPackEvent -> RenderEmojiPack(baseNote, true, backgroundColor, accountViewModel)
is GenericRepostEvent -> { is LiveActivitiesEvent -> RenderLiveActivityEvent(baseNote, accountViewModel, nav)
RenderRepost(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) is GitRepositoryEvent -> RenderGitRepositoryEvent(baseNote, accountViewModel, nav)
}
is ReportEvent -> {
RenderReport(baseNote, quotesLeft, backgroundColor, accountViewModel, nav)
}
is LongTextNoteEvent -> {
RenderLongFormContent(baseNote, accountViewModel, nav)
}
is WikiNoteEvent -> {
RenderWikiContent(baseNote, accountViewModel, nav)
}
is BadgeAwardEvent -> {
RenderBadgeAward(baseNote, backgroundColor, accountViewModel, nav)
}
is FhirResourceEvent -> {
RenderFhirResource(baseNote, accountViewModel, nav)
}
is PeopleListEvent -> {
DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav)
}
is RelaySetEvent -> {
DisplayRelaySet(baseNote, backgroundColor, accountViewModel, nav)
}
is PinListEvent -> {
RenderPinListEvent(baseNote, backgroundColor, accountViewModel, nav)
}
is EmojiPackEvent -> {
RenderEmojiPack(baseNote, true, backgroundColor, accountViewModel)
}
is LiveActivitiesEvent -> {
RenderLiveActivityEvent(baseNote, accountViewModel, nav)
}
is GitRepositoryEvent -> {
RenderGitRepositoryEvent(baseNote, accountViewModel, nav)
}
is GitPatchEvent -> { is GitPatchEvent -> {
RenderGitPatchEvent( RenderGitPatchEvent(
baseNote, baseNote,
@ -842,18 +808,10 @@ private fun RenderNoteRow(
nav, nav,
) )
} }
is FileHeaderEvent -> { is FileHeaderEvent -> FileHeaderDisplay(baseNote, true, accountViewModel)
FileHeaderDisplay(baseNote, true, accountViewModel) is VideoHorizontalEvent -> VideoDisplay(baseNote, makeItShort, canPreview, backgroundColor, accountViewModel, nav)
} is VideoVerticalEvent -> VideoDisplay(baseNote, makeItShort, canPreview, backgroundColor, accountViewModel, nav)
is VideoHorizontalEvent -> { is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, true, accountViewModel)
VideoDisplay(baseNote, makeItShort, canPreview, backgroundColor, accountViewModel, nav)
}
is VideoVerticalEvent -> {
VideoDisplay(baseNote, makeItShort, canPreview, backgroundColor, accountViewModel, nav)
}
is FileStorageHeaderEvent -> {
FileStorageHeaderDisplay(baseNote, true, accountViewModel)
}
is CommunityPostApprovalEvent -> { is CommunityPostApprovalEvent -> {
RenderPostApproval( RenderPostApproval(
baseNote, baseNote,

View File

@ -325,10 +325,10 @@ private fun RenderGitRepositoryEvent(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
nav: (String) -> Unit, nav: (String) -> Unit,
) { ) {
val title = remember(noteEvent) { noteEvent.name() ?: noteEvent.dTag() } val title = noteEvent.name() ?: noteEvent.dTag()
val summary = remember(noteEvent) { noteEvent.description() } val summary = noteEvent.description()
val web = remember(noteEvent) { noteEvent.web() } val web = noteEvent.web()
val clone = remember(noteEvent) { noteEvent.clone() } val clone = noteEvent.clone()
Row( Row(
modifier = modifier =