Simple refactoring

This commit is contained in:
Vitor Pamplona
2024-06-15 12:34:03 -04:00
parent 80d506be37
commit 545df83177
@@ -461,7 +461,14 @@ fun InnerNoteWithReactions(
horizontalArrangement = RowColSpacing10dp, horizontalArrangement = RowColSpacing10dp,
) { ) {
if (notBoostedNorQuote) { if (notBoostedNorQuote) {
AuthorAndRelayInformation(baseNote, accountViewModel, nav) Column(WidthAuthorPictureModifier, verticalArrangement = RowColSpacing5dp) {
// Draws the boosted picture outside the boosted card.
Box(modifier = Size55Modifier, contentAlignment = Alignment.BottomEnd) {
RenderAuthorImages(baseNote, nav, accountViewModel)
}
BadgeBox(baseNote, accountViewModel, nav)
}
} }
Column(Modifier.fillMaxWidth()) { Column(Modifier.fillMaxWidth()) {
@@ -1051,22 +1058,6 @@ fun observeEdits(
return editState return editState
} }
@Composable
private fun AuthorAndRelayInformation(
baseNote: Note,
accountViewModel: AccountViewModel,
nav: (String) -> Unit,
) {
Column(WidthAuthorPictureModifier, verticalArrangement = RowColSpacing5dp) {
// Draws the boosted picture outside the boosted card.
Box(modifier = Size55Modifier, contentAlignment = Alignment.BottomEnd) {
RenderAuthorImages(baseNote, nav, accountViewModel)
}
BadgeBox(baseNote, accountViewModel, nav)
}
}
@Composable @Composable
private fun BadgeBox( private fun BadgeBox(
baseNote: Note, baseNote: Note,
@@ -1088,9 +1079,7 @@ private fun RenderAuthorImages(
nav: (String) -> Unit, nav: (String) -> Unit,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
) { ) {
val isRepost = baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent if (baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent) {
if (isRepost) {
val baseRepost = baseNote.replyTo?.lastOrNull() val baseRepost = baseNote.replyTo?.lastOrNull()
if (baseRepost != null) { if (baseRepost != null) {
RepostNoteAuthorPicture(baseNote, baseRepost, accountViewModel, nav) RepostNoteAuthorPicture(baseNote, baseRepost, accountViewModel, nav)