New release v2.3.8
This commit is contained in:
@@ -430,6 +430,31 @@ class SettingsService {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Favorite Models
|
||||
|
||||
var favoriteModelIds: Set<String> {
|
||||
get {
|
||||
guard let json = cache["favoriteModelIds"],
|
||||
let data = json.data(using: .utf8),
|
||||
let ids = try? JSONDecoder().decode([String].self, from: data) else { return [] }
|
||||
return Set(ids)
|
||||
}
|
||||
set {
|
||||
let sorted = newValue.sorted()
|
||||
if let data = try? JSONEncoder().encode(sorted),
|
||||
let json = String(data: data, encoding: .utf8) {
|
||||
cache["favoriteModelIds"] = json
|
||||
DatabaseService.shared.setSetting(key: "favoriteModelIds", value: json)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func toggleFavoriteModel(_ id: String) {
|
||||
var favs = favoriteModelIds
|
||||
if favs.contains(id) { favs.remove(id) } else { favs.insert(id) }
|
||||
favoriteModelIds = favs
|
||||
}
|
||||
|
||||
// MARK: - Anytype MCP Settings
|
||||
|
||||
var anytypeMcpEnabled: Bool {
|
||||
|
||||
Reference in New Issue
Block a user