Skip to content

Commit

Permalink
iteration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Logomann committed Aug 22, 2024
1 parent 2b1f787 commit 2cb5294
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ class FilterIndustryViewModel(
val error: LiveData<ResponseError>
get() = _error

/* fun writeSharedPrefs() {
viewModelScope.launch {
interactor.writeSharedPrefs(
SaveFiltersSharedPrefs(
industries = _selectedIndustry.value,
null,
null,
null,
false
)
)
}
}*/

fun itemChecked(industries: Industries) {
val newList = ArrayList<Industries>()
_industries.value?.forEach { industry ->
Expand Down Expand Up @@ -113,7 +99,13 @@ class FilterIndustryViewModel(
newSortedList.add(it)
}
}
_industries.postValue(newSortedList)
if (sortedList.isNotEmpty()) {
_industries.postValue(newSortedList)
} else {
_industries.postValue(newSortedList)
_error.postValue(ResponseError.NOT_FOUND)
}

}
}

0 comments on commit 2cb5294

Please sign in to comment.