fix: won’t show dialog if skip all then selection list is empty

This commit is contained in:
Cuong Tran 2024-03-10 00:07:18 +07:00
parent 89a5f2e702
commit cd016ab29e
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -92,6 +92,10 @@ class BulkFavoriteScreenModel(
fun addFavoriteDuplicate(skipAllDuplicates: Boolean = false) {
screenModelScope.launch {
val mangaList = if (skipAllDuplicates) getNotDuplicateLibraryMangas() else state.value.selection
if (mangaList.isEmpty()) {
toggleSelectionMode()
return@launch
}
val categories = getCategories()
val defaultCategoryId = libraryPreferences.defaultCategory().get()
val defaultCategory = categories.find { it.id == defaultCategoryId.toLong() }