From 9d6f138e40a5322ee731f8096eaa3332c94a6532 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 18 May 2026 17:54:35 +0800
Subject: [PATCH] Speed up repeated app list opens

---
 Apptag/PreferencesView.swift |   49 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/Apptag/PreferencesView.swift b/Apptag/PreferencesView.swift
index cd28edb..88c00a4 100644
--- a/Apptag/PreferencesView.swift
+++ b/Apptag/PreferencesView.swift
@@ -140,7 +140,7 @@
         isApplyingSystemScheme = true
 
         DispatchQueue.global(qos: .userInitiated).async {
-            let scannedApps = AppIndexer.scan()
+            let scannedApps = AppIndexer.scan(useCache: false)
             let result = SmartStartService.applySystemInitialScheme(apps: scannedApps)
             let store = result.store
             let apps = TagEditor.annotate(apps: scannedApps, store: store)
@@ -217,6 +217,25 @@
     private var canRestorePreviousScheme: Bool {
         guard let path = categoryScheme.previousBackupPath else { return false }
         return FileManager.default.fileExists(atPath: path)
+    }
+
+    private func bubbleScopeOption(
+        _ title: String,
+        isSelected: Bool,
+        action: @escaping () -> Void
+    ) -> some View {
+        Button(action: action) {
+            HStack(spacing: 6) {
+                Image(systemName: isSelected ? "largecircle.fill.circle" : "circle")
+                    .font(.system(size: 13, weight: .medium))
+                    .frame(width: 16, height: 16)
+                Text(title)
+                    .font(.system(size: 13, weight: .medium))
+            }
+            .foregroundStyle(isSelected ? Color.accentColor : Color.primary)
+            .contentShape(Rectangle())
+        }
+        .buttonStyle(.plain)
     }
 
     private func syncSelectedLanguage() {
@@ -465,7 +484,6 @@
                     onRefresh: { scanApps() }
                 )
             }
-            .padding(.leading, 16)
             .tabItem { Label(tr("settings.tags"), systemImage: "tag.fill") }
             .onAppear { scanApps() }
 
@@ -580,15 +598,28 @@
 
                 Spacer(minLength: 22)
 
-                VStack(alignment: .leading, spacing: 5) {
-                    Toggle(tr("settings.uncommonBubble"), isOn: $showUncommonAppBubbles)
+                HStack(alignment: .center, spacing: 14) {
+                    Text(tr("settings.bubbleDisplayScope"))
                         .font(.system(size: 13, weight: .medium))
-                    Text(tr("settings.uncommonBubbleDesc"))
-                        .font(.caption)
-                        .foregroundStyle(.secondary)
-                        .fixedSize(horizontal: false, vertical: true)
+                        .frame(width: 190, alignment: .trailing)
+
+                    HStack(spacing: 20) {
+                        bubbleScopeOption(
+                            tr("settings.bubbleAllApps"),
+                            isSelected: !showUncommonAppBubbles
+                        ) {
+                            showUncommonAppBubbles = false
+                        }
+                        bubbleScopeOption(
+                            tr("settings.bubbleUncommonOnly"),
+                            isSelected: showUncommonAppBubbles
+                        ) {
+                            showUncommonAppBubbles = true
+                        }
+                    }
+                    .frame(width: 300, alignment: .leading)
                 }
-                .frame(width: 420, alignment: .leading)
+                .frame(width: 520, alignment: .center)
 
                 Spacer(minLength: 18)
             }

--
Gitblit v1.9.3