Skip to content

Commit

Permalink
Make sure fetchBackgroundColor doesn't loop forever
Browse files Browse the repository at this point in the history
  • Loading branch information
aviwad committed Nov 19, 2024
1 parent 922c949 commit ebaf97e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SpotifyLyricsInMenubar/viewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ import NaturalLanguage
return Color(red: red/255, green: green/255, blue: blue/255) //(red, green, blue)
}

func fetchBackgroundColor() {
func fetchBackgroundColor(retry: Bool = true) {
guard let currentlyPlaying else {
return
}
Expand All @@ -320,7 +320,9 @@ import NaturalLanguage
if !currentlyPlayingLyrics.isEmpty, let currentlyPlayingName {
Task {
currentlyPlayingLyrics = try await fetchNetworkLyrics(for: currentlyPlaying, currentlyPlayingName, UserDefaults.standard.bool(forKey: "spotifyOrAppleMusic"))
fetchBackgroundColor()
if retry {
fetchBackgroundColor(retry: false)
}
}
}
// No SongObject found with the given trackID
Expand Down

0 comments on commit ebaf97e

Please sign in to comment.