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/AppDefaults.swift | 39 ++++++++++++++++++---------------------
1 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/Apptag/AppDefaults.swift b/Apptag/AppDefaults.swift
index 2f2f720..71e08d9 100644
--- a/Apptag/AppDefaults.swift
+++ b/Apptag/AppDefaults.swift
@@ -2,7 +2,7 @@
enum AppDefaults {
static let schemaVersionKey = "initialDefaultsSchemaVersion"
- static let currentSchemaVersion = 2
+ static let currentSchemaVersion = 3
static let tagFontSize: Double = 22
static let iconSize: Double = 80
@@ -22,34 +22,31 @@
"hideAppNames": hideAppNames,
"showDockIcon": showDockIcon,
"launchAtLogin": launchAtLogin,
- "showUncommonAppBubbles": showUncommonAppBubbles
+ "showUncommonAppBubbles": showUncommonAppBubbles,
+ "skipTagRemovalDropConfirm": false,
+ LauncherHotkeyRegistrationStore.mainStateKey: LauncherHotkeyRegistrationState.active.rawValue,
+ LauncherHotkeyRegistrationStore.quickSearchStateKey: LauncherHotkeyRegistrationState.active.rawValue
])
- migrateShortcutDefaultsIfNeeded()
+ removeShortcutCustomizationDefaults()
}
static func hasStoredValue(for key: String) -> Bool {
- let domain = Bundle.main.bundleIdentifier ?? "com.apptag.launcher"
+ let domain = Bundle.main.bundleIdentifier ?? AppIdentity.bundleIdentifier
return UserDefaults.standard.persistentDomain(forName: domain)?[key] != nil
}
- private static func migrateShortcutDefaultsIfNeeded() {
+ private static func removeShortcutCustomizationDefaults() {
let defaults = UserDefaults.standard
- guard defaults.integer(forKey: schemaVersionKey) < currentSchemaVersion else { return }
-
- defaults.set(LauncherHotkey.defaultMain.serialized, forKey: LauncherHotkeyKind.main.storageKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.main.pendingStorageKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.main.statusKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.main.conflictMessageKey)
-
- let quickSearchKey = LauncherHotkeyKind.quickSearch.storageKey
- let storedQuickSearch = defaults.string(forKey: quickSearchKey) ?? ""
- if storedQuickSearch.isEmpty {
- defaults.set(LauncherHotkey.defaultQuickSearch.serialized, forKey: quickSearchKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.quickSearch.pendingStorageKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.quickSearch.statusKey)
- defaults.removeObject(forKey: LauncherHotkeyKind.quickSearch.conflictMessageKey)
- }
-
+ [
+ "mainHotkey",
+ "quickSearchHotkey",
+ "mainHotkeyPending",
+ "quickSearchHotkeyPending",
+ "mainHotkeyStatus",
+ "quickSearchHotkeyStatus",
+ "mainHotkeyConflictMessage",
+ "quickSearchHotkeyConflictMessage"
+ ].forEach { defaults.removeObject(forKey: $0) }
defaults.set(currentSchemaVersion, forKey: schemaVersionKey)
}
}
--
Gitblit v1.9.3