diff --git a/data/services/src/main/java/com/twofasapp/data/services/local/GroupsLocalSource.kt b/data/services/src/main/java/com/twofasapp/data/services/local/GroupsLocalSource.kt index 5b6246d0..75271ed8 100644 --- a/data/services/src/main/java/com/twofasapp/data/services/local/GroupsLocalSource.kt +++ b/data/services/src/main/java/com/twofasapp/data/services/local/GroupsLocalSource.kt @@ -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 + ) ) ) } diff --git a/feature/home/src/main/java/com/twofasapp/feature/home/ui/services/ServicesViewModel.kt b/feature/home/src/main/java/com/twofasapp/feature/home/ui/services/ServicesViewModel.kt index 13beda46..002e1e63 100644 --- a/feature/home/src/main/java/com/twofasapp/feature/home/ui/services/ServicesViewModel.kt +++ b/feature/home/src/main/java/com/twofasapp/feature/home/ui/services/ServicesViewModel.kt @@ -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)) }