upadete updatetheme

This commit is contained in:
neon443
2025-07-09 13:55:49 +01:00
parent e3e4108723
commit 3cc4a8c34b

View File

@@ -129,15 +129,14 @@ class HostsManager: ObservableObject, @unchecked Sendable {
} }
func updateTheme(_ theme: Theme) { func updateTheme(_ theme: Theme) {
guard let index = themes.firstIndex(where: { $0.id == theme.id }) else { if let index = themes.firstIndex(where: { $0.id == theme.id }) {
themes.append(theme)
saveThemes()
return
}
themes[index] = theme themes[index] = theme
if selectedTheme.id == theme.id { if selectedTheme.id == theme.id {
selectedTheme = theme selectedTheme = theme
} }
} else {
themes.append(theme)
}
saveThemes() saveThemes()
} }