mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update Focus Toast timing
This commit is contained in:
parent
031186e81e
commit
c9458fe738
1 changed files with 7 additions and 2 deletions
|
|
@ -24,6 +24,11 @@ struct DoNotDisturbLiveActivity: View {
|
||||||
@State private var cleanupTask: Task<Void, Never>?
|
@State private var cleanupTask: Task<Void, Never>?
|
||||||
@State private var labelIntrinsicWidth: CGFloat = 0
|
@State private var labelIntrinsicWidth: CGFloat = 0
|
||||||
|
|
||||||
|
private enum ToastTiming {
|
||||||
|
static let activeDisplay: UInt64 = 1800 // focus enabled toast linger
|
||||||
|
static let inactiveDisplay: UInt64 = 1500 // focus disabled toast linger
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
iconWing
|
iconWing
|
||||||
|
|
@ -331,7 +336,7 @@ struct DoNotDisturbLiveActivity: View {
|
||||||
|
|
||||||
collapseTask?.cancel()
|
collapseTask?.cancel()
|
||||||
collapseTask = Task { @MainActor in
|
collapseTask = Task { @MainActor in
|
||||||
try? await Task.sleep(for: .milliseconds(focusToastMode ? 900 : 320))
|
try? await Task.sleep(for: .milliseconds(focusToastMode ? ToastTiming.inactiveDisplay : 320))
|
||||||
withAnimation(.smooth(duration: 0.32)) {
|
withAnimation(.smooth(duration: 0.32)) {
|
||||||
isExpanded = false
|
isExpanded = false
|
||||||
if focusToastMode {
|
if focusToastMode {
|
||||||
|
|
@ -355,7 +360,7 @@ struct DoNotDisturbLiveActivity: View {
|
||||||
cleanupTask?.cancel()
|
cleanupTask?.cancel()
|
||||||
|
|
||||||
collapseTask = Task { @MainActor in
|
collapseTask = Task { @MainActor in
|
||||||
try? await Task.sleep(for: .milliseconds(1150))
|
try? await Task.sleep(for: .milliseconds(ToastTiming.activeDisplay))
|
||||||
withAnimation(.smooth(duration: 0.32)) {
|
withAnimation(.smooth(duration: 0.32)) {
|
||||||
isExpanded = false
|
isExpanded = false
|
||||||
showInactiveIcon = false
|
showInactiveIcon = false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue