Skip to content

Commit

Permalink
Set "show lyrics" to a state variable instead of app storage. "Don't …
Browse files Browse the repository at this point in the history
…Show Lyrics" is not saved in userdefaults anymore. Patched some cases where lyrics would update when showLyrics was false.
  • Loading branch information
aviwad committed Apr 20, 2024
1 parent 16b75fc commit fc0b9f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct SpotifyLyricsInMenubarApp: App {
@AppStorage("launchOnLogin") var launchOnLogin: Bool = false
// True: means Apple Music, False: Spotify
@AppStorage("spotifyOrAppleMusic") var spotifyOrAppleMusic: Bool = false
@AppStorage("showLyrics") var showLyrics: Bool = true
@State var showLyrics: Bool = true
@AppStorage("hasOnboarded") var hasOnboarded: Bool = false
@AppStorage("truncationLength") var truncationLength: Int = 40
@Environment(\.openWindow) var openWindow
Expand All @@ -32,7 +32,7 @@ struct SpotifyLyricsInMenubarApp: App {
}
viewmodel.currentlyPlayingLyrics = try await viewmodel.fetchNetworkLyrics(for: currentlyPlaying, currentlyPlayingName, spotifyOrAppleMusic)
print("HELLOO")
if viewmodel.isPlaying, !viewmodel.currentlyPlayingLyrics.isEmpty {
if viewmodel.isPlaying, !viewmodel.currentlyPlayingLyrics.isEmpty, showLyrics {
viewmodel.startLyricUpdater(appleMusicOrSpotify: spotifyOrAppleMusic)
}
}
Expand Down Expand Up @@ -236,7 +236,7 @@ struct SpotifyLyricsInMenubarApp: App {
Task {
if let nowPlaying, let currentlyPlayingName = viewmodel.currentlyPlayingName, let lyrics = await viewmodel.fetch(for: nowPlaying, currentlyPlayingName, spotifyOrAppleMusic) {
viewmodel.currentlyPlayingLyrics = lyrics
if viewmodel.isPlaying, !viewmodel.currentlyPlayingLyrics.isEmpty {
if viewmodel.isPlaying, !viewmodel.currentlyPlayingLyrics.isEmpty, showLyrics {
print("STARTING UPDATER")
viewmodel.startLyricUpdater(appleMusicOrSpotify: spotifyOrAppleMusic)
}
Expand Down

0 comments on commit fc0b9f0

Please sign in to comment.