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
|
|
@ -17793,6 +17793,10 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Nothing Playing" : {
|
||||
"comment" : "A label displayed when there is nothing playing in the music player.",
|
||||
"isCommentAutoGenerated" : true
|
||||
},
|
||||
"Notify before" : {
|
||||
"comment" : "A label describing the slider that allows the user to set a reminder lead time.",
|
||||
"isCommentAutoGenerated" : true,
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ struct LockScreenMusicPanel: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
if isActive {
|
||||
if isActive && musicManager.hasActiveSession {
|
||||
panelContent
|
||||
} else {
|
||||
Color.clear
|
||||
|
|
|
|||
|
|
@ -45,6 +45,31 @@ struct MinimalisticMusicPlayerView: View {
|
|||
private let skipMagnitude: CGFloat = 8
|
||||
|
||||
var body: some View {
|
||||
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
|
||||
|
|
@ -112,6 +137,7 @@ struct MinimalisticMusicPlayerView: View {
|
|||
.frame(height: calculateDynamicHeight(), alignment: .top)
|
||||
.animation(.smooth(duration: 0.3), value: dynamicHeightSignature)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TypingLyricView
|
||||
|
||||
|
|
|
|||
|
|
@ -521,9 +521,15 @@ 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 {
|
||||
if !coordinator.firstLaunch {
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -78,6 +78,28 @@ class MusicManager: ObservableObject {
|
|||
@Published var isPlaying = false
|
||||
@Published var album: String = "Self Love"
|
||||
@Published var isPlayerIdle: Bool = true
|
||||
|
||||
/// Whether there is an active music session with real metadata.
|
||||
/// Returns `false` only when the metadata is still placeholder/fallback defaults
|
||||
/// (i.e. nothing has been played since app launch, or the controller returned
|
||||
/// unknown/not-playing placeholders). Paused music with real metadata is still
|
||||
/// considered an active session.
|
||||
private static let placeholderTitles: Set<String> = [
|
||||
"i'm handsome", "unknown", "not playing"
|
||||
]
|
||||
private static let placeholderArtists: Set<String> = [
|
||||
"me", "unknown"
|
||||
]
|
||||
|
||||
var hasActiveSession: Bool {
|
||||
if isPlaying { return true }
|
||||
let trimmedTitle = songTitle.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
||||
let trimmedArtist = artistName.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
||||
let hasRealTitle = !trimmedTitle.isEmpty && !Self.placeholderTitles.contains(trimmedTitle)
|
||||
let hasRealArtist = !trimmedArtist.isEmpty && !Self.placeholderArtists.contains(trimmedArtist)
|
||||
return hasRealTitle || hasRealArtist
|
||||
}
|
||||
|
||||
@Published var animations: DynamicIslandAnimations = .init()
|
||||
@Published var avgColor: NSColor = .white
|
||||
@Published var bundleIdentifier: String? = nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue