From da71eb5bccbdbd22da7cd74b6ddcec031f069482 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Thu, 28 May 2026 15:59:53 +0800
Subject: [PATCH] Stabilize empty-drop tag removal confirmation
---
Apptag/ContentView.swift | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/Apptag/ContentView.swift b/Apptag/ContentView.swift
index d6ca151..3c68021 100644
--- a/Apptag/ContentView.swift
+++ b/Apptag/ContentView.swift
@@ -593,12 +593,11 @@
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(
@@ -607,6 +606,14 @@
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.
@@ -2111,7 +2118,6 @@
}
private func dismissTagRemovalDropConfirm() {
- resetTransientDragState(keepingPendingTagRemovalDrop: true)
tagRemovalDropSuppressFuturePrompt = false
withAnimation(.easeOut(duration: 0.18)) {
pendingTagRemovalDrop = nil
@@ -2122,15 +2128,17 @@
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) {
--
Gitblit v1.9.3