mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +00:00
Still needs some working
This commit is contained in:
parent
8fb0731ebb
commit
14114f5c8e
1 changed files with 19 additions and 15 deletions
|
|
@ -1044,9 +1044,7 @@ struct ContentView: View {
|
||||||
|
|
||||||
let interval = max(0, deadline.timeIntervalSinceNow)
|
let interval = max(0, deadline.timeIntervalSinceNow)
|
||||||
|
|
||||||
musicControlHideTask = Task { @MainActor [interval] in
|
musicControlHideTask = Task { [interval] in
|
||||||
defer { musicControlHideTask = nil }
|
|
||||||
|
|
||||||
if interval > 0 {
|
if interval > 0 {
|
||||||
let nanoseconds = UInt64(interval * 1_000_000_000)
|
let nanoseconds = UInt64(interval * 1_000_000_000)
|
||||||
try? await Task.sleep(nanoseconds: nanoseconds)
|
try? await Task.sleep(nanoseconds: nanoseconds)
|
||||||
|
|
@ -1054,12 +1052,16 @@ struct ContentView: View {
|
||||||
|
|
||||||
guard !Task.isCancelled else { return }
|
guard !Task.isCancelled else { return }
|
||||||
|
|
||||||
if let currentDeadline = musicControlVisibilityDeadline, currentDeadline <= Date() {
|
await MainActor.run {
|
||||||
musicControlVisibilityDeadline = nil
|
if let currentDeadline = musicControlVisibilityDeadline, currentDeadline <= Date() {
|
||||||
}
|
musicControlVisibilityDeadline = nil
|
||||||
|
}
|
||||||
|
|
||||||
if vm.notchState == .closed {
|
if vm.notchState == .closed {
|
||||||
scheduleMusicControlWindowSync(forceRefresh: false)
|
scheduleMusicControlWindowSync(forceRefresh: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
musicControlHideTask = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1101,9 +1103,7 @@ struct ContentView: View {
|
||||||
|
|
||||||
let syncDelay = max(0, delay)
|
let syncDelay = max(0, delay)
|
||||||
|
|
||||||
pendingMusicControlTask = Task { @MainActor [forceRefresh, syncDelay] in
|
pendingMusicControlTask = Task { [forceRefresh, syncDelay] in
|
||||||
defer { pendingMusicControlTask = nil }
|
|
||||||
|
|
||||||
if syncDelay > 0 {
|
if syncDelay > 0 {
|
||||||
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)
|
||||||
|
|
@ -1111,10 +1111,14 @@ struct ContentView: View {
|
||||||
|
|
||||||
guard !Task.isCancelled else { return }
|
guard !Task.isCancelled else { return }
|
||||||
|
|
||||||
if shouldShowMusicControlWindow() {
|
await MainActor.run {
|
||||||
syncMusicControlWindow(forceRefresh: forceRefresh)
|
if shouldShowMusicControlWindow() {
|
||||||
} else {
|
syncMusicControlWindow(forceRefresh: forceRefresh)
|
||||||
hideMusicControlWindow()
|
} else {
|
||||||
|
hideMusicControlWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingMusicControlTask = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue