소스 검색

Avoid duplicate hidden-app restore entries for the same link.

Deduplicate hidden apps by URL before building the restore menu so repeated links appear only once.

Made-with: Cursor
huzaifahayat12 3 달 전
부모
커밋
d0100af483
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      google_apps/LauncherRootView.swift

+ 10 - 1
google_apps/LauncherRootView.swift

@@ -81,9 +81,18 @@ struct LauncherRootView: View {
         let hiddenIDs = decodeUUIDSet(from: hiddenLauncherAppIDsData)
         guard !hiddenIDs.isEmpty else { return [] }
         let allApps = LauncherApp.sampleApps + customApps
-        return allApps
+        let sortedHiddenApps = allApps
             .filter { hiddenIDs.contains($0.id) }
             .sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }
+
+        var seenLinkKeys = Set<String>()
+        return sortedHiddenApps.filter { app in
+            guard let webURL = app.webURL else { return true }
+            let linkKey = webURL.absoluteString.lowercased()
+            guard !seenLinkKeys.contains(linkKey) else { return false }
+            seenLinkKeys.insert(linkKey)
+            return true
+        }
     }
 
     var body: some View {