mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Temporary fix for glitch, TODO: remove push up animation
This commit is contained in:
parent
3eb9122b9f
commit
80d132a85f
5 changed files with 177 additions and 64 deletions
|
|
@ -110,6 +110,23 @@ class DynamicIslandViewModel: NSObject, ObservableObject {
|
|||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
coordinator.$statsSecondRowExpansion
|
||||
.removeDuplicates()
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] _ in
|
||||
guard let self else { return }
|
||||
guard self.notchState == .open else { return }
|
||||
let updatedTarget = self.calculateDynamicNotchSize()
|
||||
guard self.notchSize != updatedTarget else { return }
|
||||
withAnimation(.easeInOut(duration: 0.3)) {
|
||||
self.notchSize = updatedTarget
|
||||
}
|
||||
if let delegate = AppDelegate.shared {
|
||||
delegate.ensureWindowSize(updatedTarget, animated: false, force: false)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
private func setupDetectorObserver() {
|
||||
|
|
@ -187,28 +204,12 @@ class DynamicIslandViewModel: NSObject, ObservableObject {
|
|||
|
||||
private func calculateDynamicNotchSize() -> CGSize {
|
||||
// Use minimalistic size if minimalistic UI is enabled
|
||||
var baseSize = Defaults[.enableMinimalisticUI] ? minimalisticOpenNotchSize : openNotchSize
|
||||
|
||||
// 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[.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
|
||||
let baseSize = Defaults[.enableMinimalisticUI] ? minimalisticOpenNotchSize : openNotchSize
|
||||
return statsAdjustedNotchSize(
|
||||
from: baseSize,
|
||||
isStatsTabActive: DynamicIslandViewCoordinator.shared.currentView == .stats,
|
||||
secondRowProgress: coordinator.statsSecondRowExpansion
|
||||
)
|
||||
}
|
||||
|
||||
func close() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue