mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Nothing Playing
This commit is contained in:
parent
12f8bc28ba
commit
b46d88c79a
5 changed files with 118 additions and 60 deletions
|
|
@ -111,7 +111,7 @@ struct LockScreenMusicPanel: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
if isActive {
|
||||
if isActive && musicManager.hasActiveSession {
|
||||
panelContent
|
||||
} else {
|
||||
Color.clear
|
||||
|
|
|
|||
|
|
@ -45,72 +45,98 @@ struct MinimalisticMusicPlayerView: View {
|
|||
private let skipMagnitude: CGFloat = 8
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
// Header area with album art (matching DynamicIslandHeader height of 24pt)
|
||||
GeometryReader { headerGeo in
|
||||
let albumArtWidth: CGFloat = 50
|
||||
let spacing: CGFloat = 10
|
||||
let visualizerWidth: CGFloat = useMusicVisualizer ? 24 : 0
|
||||
let textWidth = max(0, headerGeo.size.width - albumArtWidth - spacing - (useMusicVisualizer ? (visualizerWidth + spacing) : 0))
|
||||
HStack(alignment: .center, spacing: spacing) {
|
||||
MinimalisticAlbumArtView(vm: vm, albumArtNamespace: albumArtNamespace)
|
||||
.frame(width: albumArtWidth, height: albumArtWidth)
|
||||
if !musicManager.hasActiveSession {
|
||||
// Nothing playing state
|
||||
VStack(spacing: 0) {
|
||||
Spacer(minLength: 0)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
Image(systemName: "music.note.slash")
|
||||
.font(.system(size: 24, weight: .light))
|
||||
.foregroundColor(.gray)
|
||||
Text("Nothing Playing")
|
||||
.font(.system(size: 12, weight: .medium))
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
Spacer(minLength: 0)
|
||||
|
||||
timerCountdownSection
|
||||
|
||||
reminderList
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: calculateDynamicHeight())
|
||||
.animation(.smooth(duration: 0.3), value: dynamicHeightSignature)
|
||||
} else {
|
||||
VStack(spacing: 0) {
|
||||
// Header area with album art (matching DynamicIslandHeader height of 24pt)
|
||||
GeometryReader { headerGeo in
|
||||
let albumArtWidth: CGFloat = 50
|
||||
let spacing: CGFloat = 10
|
||||
let visualizerWidth: CGFloat = useMusicVisualizer ? 24 : 0
|
||||
let textWidth = max(0, headerGeo.size.width - albumArtWidth - spacing - (useMusicVisualizer ? (visualizerWidth + spacing) : 0))
|
||||
HStack(alignment: .center, spacing: spacing) {
|
||||
MinimalisticAlbumArtView(vm: vm, albumArtNamespace: albumArtNamespace)
|
||||
.frame(width: albumArtWidth, height: albumArtWidth)
|
||||
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
if !musicManager.songTitle.isEmpty {
|
||||
MarqueeText(
|
||||
$musicManager.songTitle,
|
||||
font: .system(size: 12, weight: .semibold),
|
||||
nsFont: .subheadline,
|
||||
textColor: .white,
|
||||
frameWidth: textWidth
|
||||
)
|
||||
}
|
||||
|
||||
Text(musicManager.artistName)
|
||||
.font(.system(size: 10, weight: .regular))
|
||||
.foregroundColor(Defaults[.playerColorTinting] ? Color(nsColor: musicManager.avgColor).ensureMinimumBrightness(factor: 0.6) : .gray)
|
||||
.lineLimit(1)
|
||||
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
if !musicManager.songTitle.isEmpty {
|
||||
MarqueeText(
|
||||
$musicManager.songTitle,
|
||||
font: .system(size: 12, weight: .semibold),
|
||||
nsFont: .subheadline,
|
||||
textColor: .white,
|
||||
frameWidth: textWidth
|
||||
)
|
||||
}
|
||||
.frame(width: textWidth, alignment: .leading)
|
||||
|
||||
Text(musicManager.artistName)
|
||||
.font(.system(size: 10, weight: .regular))
|
||||
.foregroundColor(Defaults[.playerColorTinting] ? Color(nsColor: musicManager.avgColor).ensureMinimumBrightness(factor: 0.6) : .gray)
|
||||
.lineLimit(1)
|
||||
|
||||
}
|
||||
.frame(width: textWidth, alignment: .leading)
|
||||
|
||||
if useMusicVisualizer {
|
||||
visualizer
|
||||
.frame(width: visualizerWidth)
|
||||
if useMusicVisualizer {
|
||||
visualizer
|
||||
.frame(width: visualizerWidth)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 50)
|
||||
|
||||
// Compact progress bar
|
||||
progressBar
|
||||
.padding(.top, 6)
|
||||
|
||||
// Compact playback controls
|
||||
if shouldShowControlHUDRow {
|
||||
controlHUDRow
|
||||
.padding(.top, 4)
|
||||
} else {
|
||||
playbackControls
|
||||
.padding(.top, 4)
|
||||
}
|
||||
.frame(height: 50)
|
||||
|
||||
// Compact progress bar
|
||||
progressBar
|
||||
.padding(.top, 6)
|
||||
|
||||
// Compact playback controls
|
||||
if shouldShowControlHUDRow {
|
||||
controlHUDRow
|
||||
.padding(.top, 4)
|
||||
} else {
|
||||
playbackControls
|
||||
.padding(.top, 4)
|
||||
}
|
||||
|
||||
if enableLyrics {
|
||||
lyricsView
|
||||
.padding(.top, 10)
|
||||
if enableLyrics {
|
||||
lyricsView
|
||||
.padding(.top, 10)
|
||||
}
|
||||
|
||||
timerCountdownSection
|
||||
|
||||
reminderList
|
||||
}
|
||||
|
||||
timerCountdownSection
|
||||
|
||||
reminderList
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, -15)
|
||||
.padding(.bottom, ReminderLiveActivityManager.baselineMinimalisticBottomPadding)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: calculateDynamicHeight(), alignment: .top)
|
||||
.animation(.smooth(duration: 0.3), value: dynamicHeightSignature)
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, -15)
|
||||
.padding(.bottom, ReminderLiveActivityManager.baselineMinimalisticBottomPadding)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: calculateDynamicHeight(), alignment: .top)
|
||||
.animation(.smooth(duration: 0.3), value: dynamicHeightSignature)
|
||||
}
|
||||
|
||||
// MARK: - TypingLyricView
|
||||
|
|
|
|||
|
|
@ -521,8 +521,14 @@ struct NotchHomeView: View {
|
|||
@ObservedObject var batteryModel = BatteryStatusViewModel.shared
|
||||
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
|
||||
@ObservedObject private var extensionNotchExperienceManager = ExtensionNotchExperienceManager.shared
|
||||
@ObservedObject private var musicManager = MusicManager.shared
|
||||
@Default(.showStandardMediaControls) private var showStandardMediaControls
|
||||
let albumArtNamespace: Namespace.ID
|
||||
|
||||
/// Whether the music player should actively display (enabled AND has real content).
|
||||
private var shouldShowMusicPlayer: Bool {
|
||||
showStandardMediaControls && musicManager.hasActiveSession
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
|
|
@ -546,14 +552,14 @@ struct NotchHomeView: View {
|
|||
}
|
||||
} else {
|
||||
// Normal mode: Show full music player with optional calendar and webcam
|
||||
if showStandardMediaControls {
|
||||
if shouldShowMusicPlayer {
|
||||
MusicPlayerView(albumArtNamespace: albumArtNamespace)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if Defaults[.showCalendar] {
|
||||
Group {
|
||||
if showStandardMediaControls {
|
||||
if shouldShowMusicPlayer {
|
||||
CalendarView()
|
||||
} else {
|
||||
StandaloneCalendarView()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue