From 4f5d7c13209555a114761f5027299f3ba1b42217 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 08 Jun 2026 13:27:09 +0800
Subject: [PATCH] Release 7.8.22 Apple default app catalog

---
 Apptag/ApptagApp.swift |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/Apptag/ApptagApp.swift b/Apptag/ApptagApp.swift
index a70b9e2..e155bc6 100644
--- a/Apptag/ApptagApp.swift
+++ b/Apptag/ApptagApp.swift
@@ -210,6 +210,15 @@
         setupLaunchAtLogin()
         suppressReopenUntil = Date().addingTimeInterval(1.0)
         configureApplicationMenuWhenAvailable(retries: 200)
+        warmAppIndexInBackground()
+        relocalizeDefaultAppNotesForCurrentLanguageAsync()
+    }
+
+    /// Pre-scan application folders so the first App Grid open can hydrate from cache quickly.
+    private func warmAppIndexInBackground() {
+        DispatchQueue.global(qos: .utility).async {
+            _ = AppIndexer.scan(useCache: true)
+        }
     }
 
     func applicationDidBecomeActive(_ notification: Notification) {
@@ -450,6 +459,19 @@
         ) { [weak self] _ in
             self?.setupMenuBar()
             self?.configureApplicationMenuWhenAvailable()
+            self?.relocalizeDefaultAppNotesForCurrentLanguageAsync()
+        }
+    }
+
+    private func relocalizeDefaultAppNotesForCurrentLanguageAsync() {
+        DispatchQueue.global(qos: .utility).async {
+            let apps = AppIndexer.scan(useCache: true)
+            let appleChanged = AppleDefaultAppCatalog.relocalizeDefaultNotesForCurrentLanguage(apps: apps)
+            let smartStartChanged = SmartStartService.relocalizeDefaultNotesForCurrentLanguage(apps: apps)
+            guard appleChanged || smartStartChanged else { return }
+            DispatchQueue.main.async {
+                NotificationCenter.default.post(name: .tagLauncherDataDidChange, object: nil)
+            }
         }
     }
 

--
Gitblit v1.9.3