| | |
| | | quickSearchErrorMessage = nil |
| | | refreshQuickSearchResults() |
| | | } |
| | | .onChange(of: pendingUncategorizedDrop != nil) { _, active in |
| | | NotificationCenter.default.post( |
| | | name: .tagLauncherModalInteractionChanged, |
| | | object: nil, |
| | | userInfo: ["active": active] |
| | | ) |
| | | .onChange(of: pendingUncategorizedDrop != nil) { _, _ in |
| | | publishModalInteractionState() |
| | | } |
| | | .onChange(of: pendingTagRemovalDrop != nil) { _, _ in |
| | | publishModalInteractionState() |
| | | } |
| | | .onDisappear { |
| | | NotificationCenter.default.post( |
| | |
| | | userInfo: ["active": false] |
| | | ) |
| | | } |
| | | } |
| | | |
| | | private func publishModalInteractionState() { |
| | | NotificationCenter.default.post( |
| | | name: .tagLauncherModalInteractionChanged, |
| | | object: nil, |
| | | userInfo: ["active": pendingUncategorizedDrop != nil || pendingTagRemovalDrop != nil] |
| | | ) |
| | | } |
| | | |
| | | /// Set edit phase with synchronous notification BEFORE state change. |
| | |
| | | } |
| | | |
| | | private func dismissTagRemovalDropConfirm() { |
| | | resetTransientDragState(keepingPendingTagRemovalDrop: true) |
| | | tagRemovalDropSuppressFuturePrompt = false |
| | | withAnimation(.easeOut(duration: 0.18)) { |
| | | pendingTagRemovalDrop = nil |
| | |
| | | guard let pendingDrop = pendingTagRemovalDrop else { return } |
| | | let app = pendingDrop.app |
| | | let tagName = pendingDrop.tagName |
| | | if tagRemovalDropSuppressFuturePrompt { |
| | | let shouldSuppressFuturePrompt = tagRemovalDropSuppressFuturePrompt |
| | | if shouldSuppressFuturePrompt { |
| | | skipTagRemovalDropConfirm = true |
| | | } |
| | | resetTransientDragState(keepingPendingTagRemovalDrop: true) |
| | | tagRemovalDropSuppressFuturePrompt = false |
| | | withAnimation(.easeOut(duration: 0.16)) { |
| | | pendingTagRemovalDrop = nil |
| | | } |
| | | removeTagFromDroppedApp(app: app, tagName: tagName) |
| | | DispatchQueue.main.async { |
| | | removeTagFromDroppedApp(app: app, tagName: tagName) |
| | | } |
| | | } |
| | | |
| | | private func removeTagFromDroppedApp(app: AppInfo, tagName: String) { |