mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
added lyrics feature
This commit is contained in:
parent
0d61a4024f
commit
13e60c5211
8 changed files with 464 additions and 47 deletions
|
|
@ -83,7 +83,34 @@ class DynamicIslandViewModel: NSObject, ObservableObject {
|
|||
let updatedTarget = self.calculateDynamicNotchSize()
|
||||
guard self.notchState == .open else { return }
|
||||
guard self.notchSize != updatedTarget else { return }
|
||||
self.notchSize = updatedTarget
|
||||
withAnimation(.smooth) {
|
||||
self.notchSize = updatedTarget
|
||||
}
|
||||
if let delegate = AppDelegate.shared {
|
||||
delegate.ensureWindowSize(updatedTarget, animated: true, force: false)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
// Observe settings + lyrics changes to dynamically resize the notch
|
||||
let enableLyricsPublisher = Defaults.publisher(.enableLyrics).map { $0.newValue }
|
||||
|
||||
enableLyricsPublisher
|
||||
.combineLatest(MusicManager.shared.$currentLyrics)
|
||||
.removeDuplicates { $0.0 == $1.0 && $0.1 == $1.1 }
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] _ in
|
||||
guard let self else { return }
|
||||
guard Defaults[.enableMinimalisticUI] else { return }
|
||||
let updatedTarget = self.calculateDynamicNotchSize()
|
||||
guard self.notchState == .open else { return }
|
||||
guard self.notchSize != updatedTarget else { return }
|
||||
withAnimation(.smooth) {
|
||||
self.notchSize = updatedTarget
|
||||
}
|
||||
if let delegate = AppDelegate.shared {
|
||||
delegate.ensureWindowSize(updatedTarget, animated: true, force: false)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
|
@ -171,27 +198,32 @@ class DynamicIslandViewModel: NSObject, ObservableObject {
|
|||
if Defaults[.enableMinimalisticUI] {
|
||||
let extraHeight = ReminderLiveActivityManager.additionalHeight(forRowCount: minimalisticReminderRowCount)
|
||||
baseSize.height += extraHeight
|
||||
|
||||
// Add extra height for lyrics if enabled in settings
|
||||
if Defaults[.enableLyrics] {
|
||||
baseSize.height += 24 // Additional height for lyrics display
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Only apply dynamic sizing when on stats tab and stats are enabled
|
||||
guard DynamicIslandViewCoordinator.shared.currentView == .stats && Defaults[.enableStatsFeature] else {
|
||||
return baseSize
|
||||
}
|
||||
|
||||
|
||||
let enabledGraphsCount = [
|
||||
Defaults[.showCpuGraph],
|
||||
Defaults[.showMemoryGraph],
|
||||
Defaults[.showMemoryGraph],
|
||||
Defaults[.showGpuGraph],
|
||||
Defaults[.showNetworkGraph],
|
||||
Defaults[.showDiskGraph]
|
||||
].filter { $0 }.count
|
||||
|
||||
|
||||
// If 4+ graphs are enabled, increase width
|
||||
if enabledGraphsCount >= 4 {
|
||||
let extraWidth: CGFloat = CGFloat(enabledGraphsCount - 3) * 120
|
||||
return CGSize(width: baseSize.width + extraWidth, height: baseSize.height)
|
||||
}
|
||||
|
||||
|
||||
return baseSize
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue