mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Atoll: Fix Timer Stop and Pause button overlap while expanded
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
This commit is contained in:
parent
8a60b0ede5
commit
072491d1e3
2 changed files with 20 additions and 17 deletions
|
|
@ -427,6 +427,11 @@ struct ContentView: View {
|
||||||
if newState == .closed {
|
if newState == .closed {
|
||||||
removeStickyTerminalClickMonitor()
|
removeStickyTerminalClickMonitor()
|
||||||
}
|
}
|
||||||
|
#if os(macOS)
|
||||||
|
if newState == .open {
|
||||||
|
TimerControlWindowManager.shared.hide()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.onChange(of: vm.isBatteryPopoverActive) { _, newPopoverState in
|
.onChange(of: vm.isBatteryPopoverActive) { _, newPopoverState in
|
||||||
runAfter(0.1) {
|
runAfter(0.1) {
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ struct TimerLiveActivity: View {
|
||||||
|
|
||||||
private var shouldShowControlWindow: Bool {
|
private var shouldShowControlWindow: Bool {
|
||||||
if !controlWindowEnabled { return false }
|
if !controlWindowEnabled { return false }
|
||||||
if shouldDisplayLabel { return false }
|
if showsLabel { return false }
|
||||||
|
|
||||||
let timerEligible = timerManager.isTimerActive && !timerManager.isExternalTimerActive
|
let timerEligible = timerManager.isTimerActive && !timerManager.isExternalTimerActive
|
||||||
if !timerEligible { return false }
|
if !timerEligible { return false }
|
||||||
|
|
@ -253,9 +253,6 @@ struct TimerLiveActivity: View {
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
requestControlWindowSync(forceRefresh: true)
|
requestControlWindowSync(forceRefresh: true)
|
||||||
if timerManager.isTimerActive && !timerManager.isFinished && !timerManager.isOvertime {
|
|
||||||
triggerTransientLabel()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
hideControlWindow()
|
hideControlWindow()
|
||||||
|
|
@ -528,15 +525,17 @@ struct TimerLiveActivity: View {
|
||||||
|
|
||||||
let syncDelay = max(0, delay)
|
let syncDelay = max(0, delay)
|
||||||
|
|
||||||
pendingControlWindowTask = Task.detached(priority: .userInitiated) { [syncDelay, forceRefresh] in
|
if syncDelay <= 0 {
|
||||||
if syncDelay > 0 {
|
syncControlWindow(forceRefresh: forceRefresh)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingControlWindowTask = Task { @MainActor [forceRefresh] in
|
||||||
let nanoseconds = UInt64(syncDelay * 1_000_000_000)
|
let nanoseconds = UInt64(syncDelay * 1_000_000_000)
|
||||||
try? await Task.sleep(nanoseconds: nanoseconds)
|
try? await Task.sleep(nanoseconds: nanoseconds)
|
||||||
}
|
|
||||||
|
|
||||||
guard !Task.isCancelled else { return }
|
guard !Task.isCancelled else { return }
|
||||||
|
|
||||||
await MainActor.run {
|
|
||||||
if shouldShowControlWindow {
|
if shouldShowControlWindow {
|
||||||
syncControlWindow(forceRefresh: forceRefresh)
|
syncControlWindow(forceRefresh: forceRefresh)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -546,7 +545,6 @@ struct TimerLiveActivity: View {
|
||||||
pendingControlWindowTask = nil
|
pendingControlWindowTask = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private func cancelControlWindowSync() {
|
private func cancelControlWindowSync() {
|
||||||
pendingControlWindowTask?.cancel()
|
pendingControlWindowTask?.cancel()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue