Tried to fix the detach animation

This commit is contained in:
Hariharan Mudaliar 2026-01-28 20:14:04 +05:30
commit a1678afe0a
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
4 changed files with 46 additions and 201 deletions

View file

@ -102,9 +102,6 @@ class DynamicIslandViewCoordinator: ObservableObject {
}
@Published var statsSecondRowExpansion: CGFloat = 1
private var statsSecondRowWorkItem: DispatchWorkItem?
private let statsSecondRowRevealDelay: TimeInterval = 0.5
private let statsSecondRowAnimationDuration: TimeInterval = 0.3
@Published var notesLayoutState: NotesLayoutState = .list
@Published var selectedExtensionExperienceID: String?
@ -206,22 +203,8 @@ class DynamicIslandViewCoordinator: ObservableObject {
private func handleStatsTabTransition(from oldValue: NotchViews, to newValue: NotchViews) {
guard oldValue != newValue else { return }
statsSecondRowWorkItem?.cancel()
if newValue == .stats && Defaults[.enableStatsFeature] {
statsSecondRowExpansion = 0
let workItem = DispatchWorkItem { [weak self] in
guard let self else { return }
withAnimation(.easeInOut(duration: self.statsSecondRowAnimationDuration)) {
self.statsSecondRowExpansion = 1
}
self.statsSecondRowWorkItem = nil
}
statsSecondRowWorkItem = workItem
DispatchQueue.main.asyncAfter(deadline: .now() + statsSecondRowRevealDelay, execute: workItem)
} else {
withAnimation(.easeInOut(duration: 0.2)) {
statsSecondRowExpansion = 0
}
statsSecondRowExpansion = 1
}
}