adding some labels to crossfades

This commit is contained in:
Vitor Pamplona 2023-11-24 11:54:35 -05:00
parent df823102da
commit dc3c730e3b

View File

@ -313,7 +313,7 @@ fun CheckHiddenNoteCompose(
}.distinctUntilChanged() }.distinctUntilChanged()
}.observeAsState(accountViewModel.isNoteHidden(note)) }.observeAsState(accountViewModel.isNoteHidden(note))
Crossfade(targetState = isHidden) { Crossfade(targetState = isHidden, label = "CheckHiddenNoteCompose") {
if (!it) { if (!it) {
LoadedNoteCompose( LoadedNoteCompose(
note = note, note = note,
@ -353,17 +353,13 @@ fun LoadedNoteCompose(
) )
} }
val scope = rememberCoroutineScope()
WatchForReports(note, accountViewModel) { newState -> WatchForReports(note, accountViewModel) { newState ->
if (state != newState) { if (state != newState) {
scope.launch(Dispatchers.Main) {
state = newState state = newState
} }
} }
}
Crossfade(targetState = state) { Crossfade(targetState = state, label = "LoadedNoteCompose") {
RenderReportState( RenderReportState(
it, it,
note, note,
@ -398,7 +394,7 @@ fun RenderReportState(
) { ) {
var showReportedNote by remember { mutableStateOf(false) } var showReportedNote by remember { mutableStateOf(false) }
Crossfade(targetState = !state.isAcceptable && !showReportedNote) { showHiddenNote -> Crossfade(targetState = !state.isAcceptable && !showReportedNote, label = "RenderReportState") { showHiddenNote ->
if (showHiddenNote) { if (showHiddenNote) {
HiddenNote( HiddenNote(
state.relevantReports, state.relevantReports,