mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +00:00
HotFix: Focus Mode Detection
This commit is contained in:
parent
07c0a7f0ae
commit
a5734c2246
2 changed files with 166 additions and 34 deletions
|
|
@ -56,6 +56,7 @@ struct DoNotDisturbLiveActivity: View {
|
|||
.onAppear(perform: handleInitialState)
|
||||
.onChange(of: manager.isDoNotDisturbActive, handleFocusStateChange)
|
||||
.onChange(of: manager.focusToastTrigger, handleFocusModeSwitchToast)
|
||||
.onChange(of: focusToastMode, handleToastModeSettingChange)
|
||||
.onDisappear(perform: cancelPendingTasks)
|
||||
}
|
||||
|
||||
|
|
@ -388,6 +389,31 @@ struct DoNotDisturbLiveActivity: View {
|
|||
}
|
||||
}
|
||||
|
||||
/// When the user toggles between toast / persistent mode while focus is active,
|
||||
/// re-expand the view so the wings become visible again.
|
||||
private func handleToastModeSettingChange(_ oldValue: Bool, _ newToastMode: Bool) {
|
||||
guard manager.isDoNotDisturbActive else { return }
|
||||
|
||||
cancelPendingTasks()
|
||||
|
||||
if newToastMode {
|
||||
// Switched TO toast mode — show a brief expansion then collapse.
|
||||
withAnimation(.spring(response: 0.35, dampingFraction: 0.85)) {
|
||||
isExpanded = true
|
||||
showInactiveIcon = false
|
||||
iconScale = 1.0
|
||||
}
|
||||
scheduleTransientCollapse()
|
||||
} else {
|
||||
// Switched TO persistent mode — ensure wings are expanded.
|
||||
withAnimation(.spring(response: 0.35, dampingFraction: 0.85)) {
|
||||
isExpanded = true
|
||||
showInactiveIcon = false
|
||||
iconScale = 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func triggerInactiveAnimation() {
|
||||
withAnimation(.spring(response: 0.3, dampingFraction: 0.9)) {
|
||||
isExpanded = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue