From dfee6c33f3862472d3c425cc65e0a60a7e2549c0 Mon Sep 17 00:00:00 2001 From: TheMoonThatRises <58153205+TheMoonThatRises@users.noreply.github.com> Date: Wed, 4 Dec 2024 23:34:28 -0700 Subject: [PATCH] fix playlist loading --- .../PlaylistElements/PlaylistTopElement.swift | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Spwifiy/Views/MainViewOptions/PlaylistElements/PlaylistTopElement.swift b/Spwifiy/Views/MainViewOptions/PlaylistElements/PlaylistTopElement.swift index 59b780e..cf5e33a 100644 --- a/Spwifiy/Views/MainViewOptions/PlaylistElements/PlaylistTopElement.swift +++ b/Spwifiy/Views/MainViewOptions/PlaylistElements/PlaylistTopElement.swift @@ -66,13 +66,26 @@ struct PlaylistTopElement: View { avAudioPlayer.addBulkSongs( tracks: avAudioPlayer.isShuffled ? tracks.shuffled() : tracks ) + + avAudioPlayer.playingId = playlist?.id } label: { - Image(avAudioPlayer.playingId == playlist?.id ? "spwifiy.pause.fill" : "spwifiy.play.fill") - .resizable() - .frame(width: 40, height: 40) + Group { + if tracks.isEmpty { + ProgressView() + .progressViewStyle(.circular) + } else { + Image( + avAudioPlayer.playingId == playlist?.id && + avAudioPlayer.isPlaying ? "spwifiy.pause.fill" : "spwifiy.play.fill" + ) + .resizable() + } + } + .frame(width: 40, height: 40) } .buttonStyle(.plain) .cursorHover(.pointingHand) + .disabled(tracks.isEmpty) DotButton(toggle: $avAudioPlayer.isShuffled, image: Image("spwifiy.shuffle")) @@ -98,6 +111,7 @@ struct PlaylistTopElement: View { } .buttonStyle(.plain) .cursorHover(.pointingHand) + .disabled(tracks.isEmpty) Button {