mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 00:40:49 +00:00
linting cleanup
This commit is contained in:
parent
e0b667fd2d
commit
5cb6f97178
@ -258,11 +258,11 @@ fun EditPostView(
|
||||
Row(Modifier.heightIn(max = 200.dp)) {
|
||||
NoteCompose(
|
||||
baseNote = it,
|
||||
makeItShort = true,
|
||||
unPackReply = false,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = 1,
|
||||
modifier = MaterialTheme.colorScheme.replyModifier,
|
||||
isQuotedNote = true,
|
||||
unPackReply = false,
|
||||
makeItShort = true,
|
||||
quotesLeft = 1,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
@ -351,11 +351,11 @@ fun NewPostView(
|
||||
Row(Modifier.heightIn(max = 200.dp)) {
|
||||
NoteCompose(
|
||||
baseNote = it,
|
||||
makeItShort = true,
|
||||
unPackReply = false,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = 1,
|
||||
modifier = MaterialTheme.colorScheme.replyModifier,
|
||||
isQuotedNote = true,
|
||||
unPackReply = false,
|
||||
makeItShort = true,
|
||||
quotesLeft = 1,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
@ -519,11 +519,11 @@ fun DisplayFullNote(
|
||||
) {
|
||||
NoteCompose(
|
||||
baseNote = note,
|
||||
accountViewModel = accountViewModel,
|
||||
modifier = MaterialTheme.colorScheme.innerPostModifier,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
quotesLeft = quotesLeft - 1,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = quotesLeft - 1,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
@ -671,11 +671,11 @@ private fun DisplayNoteFromTag(
|
||||
if (canPreview && quotesLeft > 0) {
|
||||
NoteCompose(
|
||||
baseNote = baseNote,
|
||||
accountViewModel = accountViewModel,
|
||||
modifier = MaterialTheme.colorScheme.innerPostModifier,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = quotesLeft - 1,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
} else {
|
||||
|
@ -51,8 +51,8 @@ fun FeedLoaded(
|
||||
Row(Modifier.fillMaxWidth().animateItemPlacement()) {
|
||||
NoteCompose(
|
||||
item,
|
||||
routeForLastRead = routeForLastRead,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = false,
|
||||
isHiddenFeed = state.showHidden.value,
|
||||
quotesLeft = 3,
|
||||
|
@ -141,8 +141,8 @@ fun MultiSetCompose(
|
||||
|
||||
NoteCompose(
|
||||
baseNote = baseNote,
|
||||
routeForLastRead = null,
|
||||
modifier = HalfTopPadding,
|
||||
routeForLastRead = null,
|
||||
isBoostedNote = true,
|
||||
isHiddenFeed = showHidden,
|
||||
quotesLeft = 1,
|
||||
|
@ -189,8 +189,8 @@ import com.vitorpamplona.quartz.events.WikiNoteEvent
|
||||
@Composable
|
||||
fun NoteCompose(
|
||||
baseNote: Note,
|
||||
routeForLastRead: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
routeForLastRead: String? = null,
|
||||
isBoostedNote: Boolean = false,
|
||||
isQuotedNote: Boolean = false,
|
||||
unPackReply: Boolean = true,
|
||||
@ -216,8 +216,8 @@ fun NoteCompose(
|
||||
) { canPreview ->
|
||||
AcceptableNote(
|
||||
baseNote = baseNote,
|
||||
routeForLastRead = routeForLastRead,
|
||||
modifier = modifier,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = isBoostedNote,
|
||||
isQuotedNote = isQuotedNote,
|
||||
unPackReply = unPackReply,
|
||||
@ -235,8 +235,8 @@ fun NoteCompose(
|
||||
@Composable
|
||||
fun AcceptableNote(
|
||||
baseNote: Note,
|
||||
routeForLastRead: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
routeForLastRead: String? = null,
|
||||
isBoostedNote: Boolean = false,
|
||||
isQuotedNote: Boolean = false,
|
||||
unPackReply: Boolean = true,
|
||||
@ -272,8 +272,8 @@ fun AcceptableNote(
|
||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
||||
CheckNewAndRenderNote(
|
||||
baseNote = baseNote,
|
||||
routeForLastRead = routeForLastRead,
|
||||
modifier = modifier,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = isBoostedNote,
|
||||
isQuotedNote = isQuotedNote,
|
||||
unPackReply = unPackReply,
|
||||
@ -315,8 +315,8 @@ fun AcceptableNote(
|
||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
||||
CheckNewAndRenderNote(
|
||||
baseNote = baseNote,
|
||||
routeForLastRead = routeForLastRead,
|
||||
modifier = modifier,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = isBoostedNote,
|
||||
isQuotedNote = isQuotedNote,
|
||||
unPackReply = unPackReply,
|
||||
@ -343,7 +343,7 @@ fun calculateBackgroundColor(
|
||||
val defaultBackgroundColor = MaterialTheme.colorScheme.background
|
||||
val newItemColor = MaterialTheme.colorScheme.newItemBackgroundColor
|
||||
return remember(createdAt) {
|
||||
mutableStateOf<Color>(
|
||||
mutableStateOf(
|
||||
if (routeForLastRead != null) {
|
||||
val isNew = accountViewModel.loadAndMarkAsRead(routeForLastRead, createdAt)
|
||||
|
||||
@ -366,8 +366,8 @@ fun calculateBackgroundColor(
|
||||
@Composable
|
||||
private fun CheckNewAndRenderNote(
|
||||
baseNote: Note,
|
||||
routeForLastRead: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
routeForLastRead: String? = null,
|
||||
isBoostedNote: Boolean = false,
|
||||
isQuotedNote: Boolean = false,
|
||||
unPackReply: Boolean = true,
|
||||
@ -504,7 +504,7 @@ fun InnerNoteWithReactions(
|
||||
|
||||
if (isNotRepost) {
|
||||
if (makeItShort) {
|
||||
if (isBoostedNote) {
|
||||
if (!isBoostedNote) {
|
||||
} else {
|
||||
Spacer(modifier = DoubleVertSpacer)
|
||||
}
|
||||
@ -594,8 +594,7 @@ private fun RenderNoteRow(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit,
|
||||
) {
|
||||
val noteEvent = baseNote.event
|
||||
when (noteEvent) {
|
||||
when (val noteEvent = baseNote.event) {
|
||||
is AppDefinitionEvent -> RenderAppDefinition(baseNote, accountViewModel, nav)
|
||||
is AudioTrackEvent -> RenderAudioTrack(baseNote, false, accountViewModel, nav)
|
||||
is AudioHeaderEvent -> RenderAudioHeader(baseNote, false, accountViewModel, nav)
|
||||
@ -862,11 +861,11 @@ fun ReplyNoteComposition(
|
||||
) {
|
||||
NoteCompose(
|
||||
baseNote = replyingDirectlyTo,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = 0,
|
||||
modifier = MaterialTheme.colorScheme.replyModifier,
|
||||
isQuotedNote = true,
|
||||
unPackReply = false,
|
||||
makeItShort = true,
|
||||
quotesLeft = 0,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
@ -921,12 +920,12 @@ fun DisplayOtsIfInOriginal(
|
||||
editState: State<GenericLoadable<EditState>>,
|
||||
accountViewModel: AccountViewModel,
|
||||
) {
|
||||
val editState = (editState.value as? GenericLoadable.Loaded<EditState>)?.loaded?.modificationToShow?.value
|
||||
val editNote = (editState.value as? GenericLoadable.Loaded<EditState>)?.loaded?.modificationToShow?.value
|
||||
|
||||
if (editState == null) {
|
||||
if (editNote == null) {
|
||||
DisplayOts(note = note, accountViewModel = accountViewModel)
|
||||
} else {
|
||||
DisplayOts(note = editState, accountViewModel = accountViewModel)
|
||||
DisplayOts(note = editNote, accountViewModel = accountViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1018,7 +1017,7 @@ fun observeEdits(
|
||||
accountViewModel: AccountViewModel,
|
||||
): State<GenericLoadable<EditState>> {
|
||||
if (baseNote.event !is TextNoteEvent) {
|
||||
return remember { mutableStateOf(GenericLoadable.Empty<EditState>()) }
|
||||
return remember { mutableStateOf(GenericLoadable.Empty()) }
|
||||
}
|
||||
|
||||
val editState =
|
||||
@ -1027,14 +1026,14 @@ fun observeEdits(
|
||||
mutableStateOf(
|
||||
if (cached != null) {
|
||||
if (cached.isEmpty()) {
|
||||
GenericLoadable.Empty<EditState>()
|
||||
GenericLoadable.Empty()
|
||||
} else {
|
||||
val state = EditState()
|
||||
state.updateModifications(cached)
|
||||
GenericLoadable.Loaded<EditState>(state)
|
||||
GenericLoadable.Loaded(state)
|
||||
}
|
||||
} else {
|
||||
GenericLoadable.Loading<EditState>()
|
||||
GenericLoadable.Loading()
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1046,7 +1045,7 @@ fun observeEdits(
|
||||
accountViewModel.findModificationEventsForNote(it) { newModifications ->
|
||||
if (newModifications.isEmpty()) {
|
||||
if (editState.value !is GenericLoadable.Empty) {
|
||||
editState.value = GenericLoadable.Empty<EditState>()
|
||||
editState.value = GenericLoadable.Empty()
|
||||
}
|
||||
} else {
|
||||
if (editState.value is GenericLoadable.Loaded) {
|
||||
|
@ -83,9 +83,9 @@ fun RenderPostApproval(
|
||||
NoteCompose(
|
||||
it,
|
||||
modifier = MaterialTheme.colorScheme.replyModifier,
|
||||
isQuotedNote = true,
|
||||
unPackReply = false,
|
||||
makeItShort = true,
|
||||
isQuotedNote = true,
|
||||
quotesLeft = quotesLeft - 1,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
accountViewModel = accountViewModel,
|
||||
|
@ -90,8 +90,8 @@ fun RenderReport(
|
||||
note.replyTo?.lastOrNull()?.let {
|
||||
NoteCompose(
|
||||
baseNote = it,
|
||||
isQuotedNote = true,
|
||||
modifier = MaterialTheme.colorScheme.replyModifier,
|
||||
isQuotedNote = true,
|
||||
unPackReply = false,
|
||||
makeItShort = true,
|
||||
quotesLeft = quotesLeft - 1,
|
||||
|
@ -285,10 +285,10 @@ fun RenderThreadFeed(
|
||||
MaterialTheme.colorScheme.placeholderText
|
||||
},
|
||||
),
|
||||
parentBackgroundColor = background,
|
||||
isBoostedNote = false,
|
||||
unPackReply = false,
|
||||
quotesLeft = 3,
|
||||
parentBackgroundColor = background,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
@ -193,8 +193,8 @@ private fun DraftFeedLoaded(
|
||||
) {
|
||||
NoteCompose(
|
||||
item,
|
||||
routeForLastRead = routeForLastRead,
|
||||
modifier = MaterialTheme.colorScheme.maxWidthWithBackground,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = false,
|
||||
isHiddenFeed = state.showHidden.value,
|
||||
quotesLeft = 3,
|
||||
|
@ -24,7 +24,6 @@ import android.util.Log
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.vitorpamplona.amethyst.model.Account
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
|
@ -205,11 +205,11 @@ private fun RenderCardItem(
|
||||
is NoteCard ->
|
||||
NoteCardCompose(
|
||||
item,
|
||||
isBoostedNote = false,
|
||||
accountViewModel = accountViewModel,
|
||||
showHidden = showHidden,
|
||||
nav = nav,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = false,
|
||||
showHidden = showHidden,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
is ZapUserSetCard ->
|
||||
ZapUserSetCompose(
|
||||
@ -248,8 +248,8 @@ private fun RenderCardItem(
|
||||
@Composable
|
||||
fun NoteCardCompose(
|
||||
baseNote: NoteCard,
|
||||
modifier: Modifier = Modifier,
|
||||
routeForLastRead: String? = null,
|
||||
modifier: Modifier = remember { Modifier },
|
||||
isBoostedNote: Boolean = false,
|
||||
isQuotedNote: Boolean = false,
|
||||
unPackReply: Boolean = true,
|
||||
@ -259,12 +259,10 @@ fun NoteCardCompose(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit,
|
||||
) {
|
||||
val note = remember(baseNote) { baseNote.note }
|
||||
|
||||
NoteCompose(
|
||||
baseNote = note,
|
||||
routeForLastRead = routeForLastRead,
|
||||
baseNote = baseNote.note,
|
||||
modifier = modifier,
|
||||
routeForLastRead = routeForLastRead,
|
||||
isBoostedNote = isBoostedNote,
|
||||
isQuotedNote = isQuotedNote,
|
||||
unPackReply = unPackReply,
|
||||
|
Loading…
Reference in New Issue
Block a user