Add OS metadata, preference hooks, and slider polish

This commit is contained in:
Micha
2025-11-19 18:15:33 +01:00
parent 4efe1a2324
commit d3f9126245
4 changed files with 104 additions and 60 deletions

View File

@@ -292,6 +292,13 @@ private extension APIv2_12 {
case securityUpdateCount = "security_update_count"
case rebootRequired = "reboot_required"
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
updateCount = try container.decodeIfPresent(Int.self, forKey: .updateCount) ?? 0
securityUpdateCount = try container.decodeIfPresent(Int.self, forKey: .securityUpdateCount) ?? 0
rebootRequired = try container.decodeIfPresent(Bool.self, forKey: .rebootRequired) ?? false
}
}
let label: String
@@ -309,6 +316,16 @@ private extension APIv2_12 {
case endOfLife = "end_of_life"
case updates
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
label = try container.decodeIfPresent(String.self, forKey: .label) ?? ""
distribution = try container.decodeIfPresent(String.self, forKey: .distribution) ?? ""
version = try container.decodeIfPresent(String.self, forKey: .version) ?? ""
architecture = try container.decodeIfPresent(String.self, forKey: .architecture) ?? ""
endOfLife = try container.decodeIfPresent(Bool.self, forKey: .endOfLife) ?? false
updates = try container.decodeIfPresent(Updates.self, forKey: .updates)
}
}
func toDomain() -> ServerInfo {