fixes voice track bugs

This commit is contained in:
Vitor Pamplona
2025-07-29 15:08:47 -04:00
parent 35a0b04020
commit c9de32c3fa
3 changed files with 6 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.amethyst.service.playback.composable.LoadThumbAndThenVideoView
import com.vitorpamplona.amethyst.service.playback.composable.VideoView
import com.vitorpamplona.amethyst.service.playback.composable.WaveformData
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
import com.vitorpamplona.amethyst.ui.navigation.routes.routeFor
@@ -183,7 +184,7 @@ fun AudioHeader(
nav: INav,
) {
val media = remember { noteEvent.stream() ?: noteEvent.download() }
val waveform = remember { noteEvent.wavefrom() }
val waveform = remember { noteEvent.wavefrom()?.let { WaveformData(it.wave) } }
val content = remember { noteEvent.content.ifBlank { null } }
val defaultBackground = MaterialTheme.colorScheme.background

View File

@@ -25,9 +25,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
@@ -51,11 +49,11 @@ fun RenderVoiceTrack(
) {
val noteEvent = note.event as? BaseVoiceEvent ?: return
AudioVoiceHeader(noteEvent, note, contentScale, accountViewModel, nav)
VoiceHeader(noteEvent, note, contentScale, accountViewModel, nav)
}
@Composable
fun AudioVoiceHeader(
fun VoiceHeader(
noteEvent: BaseVoiceEvent,
note: Note,
contentScale: ContentScale,

View File

@@ -154,6 +154,7 @@ import com.vitorpamplona.amethyst.ui.note.types.RenderTextModificationEvent
import com.vitorpamplona.amethyst.ui.note.types.RenderTorrent
import com.vitorpamplona.amethyst.ui.note.types.RenderTorrentComment
import com.vitorpamplona.amethyst.ui.note.types.VideoDisplay
import com.vitorpamplona.amethyst.ui.note.types.VoiceHeader
import com.vitorpamplona.amethyst.ui.painterRes
import com.vitorpamplona.amethyst.ui.screen.RenderFeedState
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
@@ -551,7 +552,7 @@ private fun FullBleedNoteCompose(
} else if (noteEvent is PictureEvent) {
PictureDisplay(baseNote, roundedCorner = true, ContentScale.FillWidth, PaddingValues(vertical = Size5dp), backgroundColor, accountViewModel = accountViewModel, nav)
} else if (noteEvent is BaseVoiceEvent) {
VoiceEventDisplay(baseNote, makeItShort = false, canPreview = true, backgroundColor = backgroundColor, ContentScale.FillWidth, accountViewModel = accountViewModel, nav = nav)
VoiceHeader(noteEvent, baseNote, ContentScale.FillWidth, accountViewModel, nav)
} else if (noteEvent is FileHeaderEvent) {
FileHeaderDisplay(baseNote, roundedCorner = true, ContentScale.FillWidth, accountViewModel = accountViewModel)
} else if (noteEvent is FileStorageHeaderEvent) {