fix android desktop card bugs

This commit is contained in:
2026-09-26 12:58:21 +08:00
parent 43e9e1b916
commit 284b9cc028
8 changed files with 339 additions and 211 deletions
@@ -590,7 +590,7 @@ object AppContainer {
homeWidgetJob = scope.launch {
player.state
.map { st ->
Triple(st.current?.musicId, st.isPlaying, st.current?.isLove == true)
st.current to st.isPlaying
}
.distinctUntilChanged()
.collect {
@@ -675,13 +675,13 @@ object AppContainer {
updateCover: Boolean = true,
) {
val st = player.state.value
val current = st.current ?: return
val coverPath = if (updateCover) widgetCoverCache.resolveForWidget(current) else null
val current = st.current
val coverPath = if (updateCover && current != null) widgetCoverCache.resolveForWidget(current) else null
PlatformServices.homeWidget.update(
songName = current.musicName,
artist = current.artist,
songName = current?.musicName,
artist = current?.artist,
isPlaying = st.isPlaying,
favorite = current.isLove == true,
favorite = current?.isLove == true,
coverPath = coverPath,
playText = I18n.t("play_text"),
)