Merge pull request #163 from Ebullioscopic/feature/media

Lyrics button is now colored, along with the live indicator
This commit is contained in:
Hariharan Mudaliar 2025-12-09 13:42:46 +05:30 • committed by GitHub
commit 8659a338dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 9 deletions

View file

@ -715,7 +715,7 @@ private struct MinimalisticReminderDetailsView: View {
private var playPauseButton: some View { private var playPauseButton: some View {
MinimalisticSquircircleButton( MinimalisticSquircircleButton(
icon: musicManager.isPlaying ? "pause.fill" : "play.fill", icon: musicManager.isPlaying ? (musicManager.isLiveStream ? "stop.fill" : "pause.fill") : "play.fill",
fontSize: 28, fontSize: 28,
fontWeight: .semibold, fontWeight: .semibold,
frameSize: CGSize(width: 60, height: 60), frameSize: CGSize(width: 60, height: 60),
@ -733,6 +733,7 @@ private struct MinimalisticReminderDetailsView: View {
icon: String, icon: String,
size: CGFloat = 18, size: CGFloat = 18,
isActive: Bool = false, isActive: Bool = false,
activeColor: Color = .red,
pressEffect: MinimalisticSquircircleButton.PressEffect = .none, pressEffect: MinimalisticSquircircleButton.PressEffect = .none,
symbolEffect: MinimalisticSquircircleButton.SymbolEffectStyle = .none, symbolEffect: MinimalisticSquircircleButton.SymbolEffectStyle = .none,
action: @escaping () -> Void action: @escaping () -> Void
@ -743,7 +744,7 @@ private struct MinimalisticReminderDetailsView: View {
fontWeight: .medium, fontWeight: .medium,
frameSize: CGSize(width: 40, height: 40), frameSize: CGSize(width: 40, height: 40),
cornerRadius: 16, cornerRadius: 16,
foregroundColor: isActive ? .red : .white.opacity(0.85), foregroundColor: isActive ? activeColor : .white.opacity(0.85),
pressEffect: pressEffect, pressEffect: pressEffect,
symbolEffectStyle: symbolEffect, symbolEffectStyle: symbolEffect,
action: action action: action
@ -767,6 +768,7 @@ private struct MinimalisticReminderDetailsView: View {
controlButton( controlButton(
icon: enableLyrics ? "quote.bubble.fill" : "quote.bubble", icon: enableLyrics ? "quote.bubble.fill" : "quote.bubble",
isActive: enableLyrics, isActive: enableLyrics,
activeColor: Color(nsColor: musicManager.avgColor),
symbolEffect: .replace symbolEffect: .replace
) { ) {
enableLyrics.toggle() enableLyrics.toggle()

View file

@ -259,7 +259,7 @@ struct MusicControlsView: View {
backwardConfig.action() backwardConfig.action()
} }
HoverButton(icon: musicManager.isPlaying ? "pause.fill" : "play.fill", scale: .large) { HoverButton(icon: musicManager.isPlaying ? (musicManager.isLiveStream ? "stop.fill" : "pause.fill") : "play.fill", scale: .large) {
MusicManager.shared.togglePlay() MusicManager.shared.togglePlay()
} }
@ -329,7 +329,7 @@ struct MusicControlsView: View {
case .lyrics: case .lyrics:
HoverButton( HoverButton(
icon: enableLyrics ? "quote.bubble.fill" : "quote.bubble", icon: enableLyrics ? "quote.bubble.fill" : "quote.bubble",
iconColor: enableLyrics ? .accentColor : .white, iconColor: enableLyrics ? Color(nsColor: MusicManager.shared.avgColor) : .white,
scale: .medium scale: .medium
) { ) {
enableLyrics.toggle() enableLyrics.toggle()

View file

@ -370,8 +370,7 @@ class MusicManager: ObservableObject {
} }
} else { } else {
let shouldClearForKnownDuration = let shouldClearForKnownDuration =
!isPlaying (duration > 10 && remaining > 5)
|| (duration > 10 && remaining > 5)
|| (liveStreamCompletionObservationCount == 0 || (liveStreamCompletionObservationCount == 0
&& liveStreamEdgeObservationCount == 0 && liveStreamEdgeObservationCount == 0
&& liveStreamCompletionReleaseCount >= 4) && liveStreamCompletionReleaseCount >= 4)
@ -394,9 +393,6 @@ class MusicManager: ObservableObject {
liveStreamEdgeObservationCount = 0 liveStreamEdgeObservationCount = 0
liveStreamCompletionObservationCount = 0 liveStreamCompletionObservationCount = 0
liveStreamCompletionReleaseCount = 0 liveStreamCompletionReleaseCount = 0
if !hasKnownDuration && isLiveStream {
isLiveStream = false
}
} }
} }