feat: rank built-in commands alongside applications
This commit is contained in:
@@ -18,7 +18,8 @@ public final class LaunchHistory {
|
||||
self.defaults = defaults
|
||||
self.now = now
|
||||
for (identifier, value) in defaults.dictionary(forKey: Self.storageKey) ?? [:] {
|
||||
guard let url = URL(string: identifier), url.isFileURL,
|
||||
guard let url = URL(string: identifier),
|
||||
url.isFileURL || Application.commands.contains(where: { $0.id == url }),
|
||||
let record = value as? [String: Any],
|
||||
let count = record["count"] as? Int, count > 0,
|
||||
let lastLaunch = record["lastLaunch"] as? Date,
|
||||
@@ -26,7 +27,8 @@ public final class LaunchHistory {
|
||||
usage[url] = Usage(count: count, lastLaunch: lastLaunch)
|
||||
}
|
||||
for identifier in defaults.stringArray(forKey: Self.favoritesStorageKey) ?? [] {
|
||||
guard let url = URL(string: identifier), url.isFileURL else { continue }
|
||||
guard let url = URL(string: identifier),
|
||||
url.isFileURL || Application.commands.contains(where: { $0.id == url }) else { continue }
|
||||
favorites.insert(url)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user