mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 11:48:24 +00:00
fix: quoted NoteCompose stuck on the "new item" purple background
calculateBackgroundColor captured parentBackgroundColor?.value once inside remember(createdAt), so an inner NoteCompose (repost or reply preview) that first composed while the outer was still highlighted would snapshot the purple color and never observe the outer's fade back to the default background. - Repost inner notes now share the parent's bgColor State directly when they have no own read-tracking, so they fade in lockstep with the outer. - Reply previews no longer receive parentBackgroundColor at all; they rely on replyModifier for their own visual style and never inherit the purple "new item" highlight from the surrounding post.
This commit is contained in:
@@ -490,9 +490,12 @@ fun calculateBackgroundColor(
|
||||
val defaultBackgroundColor = MaterialTheme.colorScheme.background
|
||||
val newItemColor = MaterialTheme.colorScheme.newItemBackgroundColor
|
||||
|
||||
// Only fade in/out the "new item" highlight for items that track read state.
|
||||
// Inner notes (reposts/quotes) pass routeForLastRead = null and reuse the parent color directly,
|
||||
// so the LaunchedEffect would just park a coroutine for 5s per item during scroll.
|
||||
// Inner notes (reposts) pass routeForLastRead = null with the parent's bgColor state;
|
||||
// share it directly so the inner highlight fades in lockstep with the outer.
|
||||
if (routeForLastRead == null && parentBackgroundColor != null) {
|
||||
return parentBackgroundColor
|
||||
}
|
||||
|
||||
val isNew =
|
||||
remember(createdAt, routeForLastRead) {
|
||||
routeForLastRead != null && accountViewModel.loadAndMarkAsRead(routeForLastRead, createdAt)
|
||||
@@ -1493,7 +1496,6 @@ fun getGradient(backgroundColor: MutableState<Color>): Brush =
|
||||
@Composable
|
||||
fun ReplyNoteComposition(
|
||||
replyingDirectlyTo: Note,
|
||||
backgroundColor: MutableState<Color>,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
@@ -1504,7 +1506,6 @@ fun ReplyNoteComposition(
|
||||
unPackReply = ReplyRenderType.NONE,
|
||||
makeItShort = true,
|
||||
quotesLeft = 0,
|
||||
parentBackgroundColor = backgroundColor,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
@@ -109,7 +109,7 @@ fun RenderTextEvent(
|
||||
if (replyingDirectlyTo != null && canShowReply) {
|
||||
when (unPackReply) {
|
||||
ReplyRenderType.FULL -> {
|
||||
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
||||
ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav)
|
||||
Spacer(modifier = StdVertSpacer)
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ fun RenderZapPoll(
|
||||
}
|
||||
}
|
||||
if (replyingDirectlyTo != null) {
|
||||
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
||||
ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav)
|
||||
Spacer(modifier = StdVertSpacer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user