Added default category in settings

This commit is contained in:
Vicnet
2023-10-06 08:32:21 +02:00
parent c3a068a1c0
commit e547aa2146
3 changed files with 29 additions and 1 deletions

View File

@@ -85,6 +85,17 @@ struct MainView: View {
}
.task {
await viewModel.loadCategoryList()
if userSettings.defaultCategory != "" {
if let cat = viewModel.categories.first(where: { c in
if c.name == userSettings.defaultCategory {
return true
}
return false
}) {
self.selectedCategory = cat
}
}
}
.refreshable {
await viewModel.loadCategoryList(needsUpdate: true)