Fix default category showing if nothing is in it

This commit is contained in:
Syer10
2025-10-07 18:21:11 -04:00
parent 616aa04c6c
commit 534293a7ed
3 changed files with 7 additions and 4 deletions

View File

@@ -9,4 +9,7 @@ fragment CategoryFragment on CategoryType {
key key
value value
} }
mangas {
totalCount
}
} }

View File

@@ -76,7 +76,9 @@ class CategoryRepositoryImpl(
.toFlow() .toFlow()
.map { .map {
val data = it.dataAssertNoErrors val data = it.dataAssertNoErrors
data.categories.nodes.map { it.categoryFragment.toCategory() } data.categories.nodes
.filterNot { it.categoryFragment.id == 0 && it.categoryFragment.mangas.totalCount == 0 }
.map { it.categoryFragment.toCategory() }
} }
override fun createCategory(name: String): Flow<Unit> = override fun createCategory(name: String): Flow<Unit> =

View File

@@ -8,7 +8,6 @@ package ca.gosyer.jui.ui.reader
import ca.gosyer.jui.core.lang.launchDefault import ca.gosyer.jui.core.lang.launchDefault
import ca.gosyer.jui.core.prefs.getAsFlow import ca.gosyer.jui.core.prefs.getAsFlow
import ca.gosyer.jui.domain.chapter.interactor.GetChapter
import ca.gosyer.jui.domain.chapter.interactor.GetChapterPages import ca.gosyer.jui.domain.chapter.interactor.GetChapterPages
import ca.gosyer.jui.domain.chapter.interactor.GetChapters import ca.gosyer.jui.domain.chapter.interactor.GetChapters
import ca.gosyer.jui.domain.chapter.interactor.UpdateChapter import ca.gosyer.jui.domain.chapter.interactor.UpdateChapter
@@ -36,6 +35,7 @@ import ca.gosyer.jui.ui.reader.model.ReaderPageSeparator
import ca.gosyer.jui.ui.reader.model.ViewerChapters import ca.gosyer.jui.ui.reader.model.ViewerChapters
import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ContextWrapper
import ca.gosyer.jui.uicore.vm.ViewModel import ca.gosyer.jui.uicore.vm.ViewModel
import com.diamondedge.logging.logging
import io.ktor.http.decodeURLQueryComponent import io.ktor.http.decodeURLQueryComponent
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
@@ -66,14 +66,12 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import me.tatarka.inject.annotations.Assisted import me.tatarka.inject.annotations.Assisted
import me.tatarka.inject.annotations.Inject import me.tatarka.inject.annotations.Inject
import com.diamondedge.logging.logging
@Inject @Inject
class ReaderMenuViewModel( class ReaderMenuViewModel(
private val readerPreferences: ReaderPreferences, private val readerPreferences: ReaderPreferences,
private val getManga: GetManga, private val getManga: GetManga,
private val getChapters: GetChapters, private val getChapters: GetChapters,
private val getChapter: GetChapter,
private val getChapterPages: GetChapterPages, private val getChapterPages: GetChapterPages,
private val updateChapter: UpdateChapter, private val updateChapter: UpdateChapter,
private val updateMangaMeta: UpdateMangaMeta, private val updateMangaMeta: UpdateMangaMeta,