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