mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update auto hide option
This commit is contained in:
parent
233eb8ef71
commit
1a1953e8e6
5 changed files with 24 additions and 7 deletions
|
|
@ -630,15 +630,19 @@ class MusicManager: ObservableObject {
|
|||
|
||||
func togglePlay() {
|
||||
guard let controller = activeController else { return }
|
||||
let targetState = !isPlaying
|
||||
|
||||
Task {
|
||||
await MainActor.run {
|
||||
let newState = !isPlaying
|
||||
pendingOptimisticPlayState = newState
|
||||
applyPlayState(newState, animation: .smooth(duration: 0.18))
|
||||
pendingOptimisticPlayState = targetState
|
||||
applyPlayState(targetState, animation: .smooth(duration: 0.18))
|
||||
}
|
||||
|
||||
await controller.togglePlay()
|
||||
if targetState {
|
||||
await controller.play()
|
||||
} else {
|
||||
await controller.pause()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue