Fix default group expand state

This commit is contained in:
Rafał Kobyłko 2023-05-01 19:48:01 +02:00
parent a64820fc99
commit 1cbb009254
2 changed files with 6 additions and 2 deletions

View File

@ -62,10 +62,14 @@ internal class GroupsLocalSource(
fun deleteGroup(id: String) {
val local = getGroups()
val newList = local.list.filterNot { it.id == id }
preferences.putString(
KeyGroups, json.encodeToString(
local.copy(list = local.list.filterNot { it.id == id })
local.copy(
list = newList,
isDefaultGroupExpanded = if (newList.isEmpty()) true else local.isDefaultGroupExpanded
)
)
)
}

View File

@ -105,7 +105,7 @@ internal class ServicesViewModel(
}
}
if (group.isExpanded || result.isInEditMode) {
if (group.isExpanded || result.isInEditMode || groupedServices.size == 1) {
services.forEach { service ->
add(ServicesListItem.ServiceItem(service))
}