diff --git a/app/src/main/java/eu/kanade/core/preference/CheckboxState.kt b/app/src/main/java/eu/kanade/core/preference/CheckboxState.kt new file mode 100644 index 0000000000..12635d04f5 --- /dev/null +++ b/app/src/main/java/eu/kanade/core/preference/CheckboxState.kt @@ -0,0 +1,10 @@ +package eu.kanade.core.preference + +import androidx.compose.ui.state.ToggleableState +import tachiyomi.core.preference.CheckboxState + +fun CheckboxState.TriState.asToggleableState() = when (this) { + is CheckboxState.TriState.Exclude -> ToggleableState.Indeterminate + is CheckboxState.TriState.Include -> ToggleableState.On + is CheckboxState.TriState.None -> ToggleableState.Off +} diff --git a/app/src/main/java/eu/kanade/core/prefs/PreferenceMutableState.kt b/app/src/main/java/eu/kanade/core/preference/PreferenceMutableState.kt similarity index 96% rename from app/src/main/java/eu/kanade/core/prefs/PreferenceMutableState.kt rename to app/src/main/java/eu/kanade/core/preference/PreferenceMutableState.kt index c33b240919..2c641ccc0e 100644 --- a/app/src/main/java/eu/kanade/core/prefs/PreferenceMutableState.kt +++ b/app/src/main/java/eu/kanade/core/preference/PreferenceMutableState.kt @@ -1,4 +1,4 @@ -package eu.kanade.core.prefs +package eu.kanade.core.preference import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf diff --git a/app/src/main/java/eu/kanade/core/prefs/CheckboxState.kt b/app/src/main/java/eu/kanade/core/prefs/CheckboxState.kt deleted file mode 100644 index c3b54ecabf..0000000000 --- a/app/src/main/java/eu/kanade/core/prefs/CheckboxState.kt +++ /dev/null @@ -1,12 +0,0 @@ -package eu.kanade.core.prefs - -import androidx.compose.ui.state.ToggleableState -import tachiyomi.core.preference.CheckboxState - -fun CheckboxState.TriState.asState(): ToggleableState { - return when (this) { - is CheckboxState.TriState.Exclude -> ToggleableState.Indeterminate - is CheckboxState.TriState.Include -> ToggleableState.On - is CheckboxState.TriState.None -> ToggleableState.Off - } -} diff --git a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt index 9ac162e1ba..e5b2285c69 100644 --- a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt @@ -1,6 +1,5 @@ package eu.kanade.data.source -import eu.kanade.domain.source.model.SourcePagingSourceType import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.SourceManager @@ -8,6 +7,10 @@ import eu.kanade.tachiyomi.source.model.FilterList import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import tachiyomi.data.DatabaseHandler +import tachiyomi.data.source.SourceLatestPagingSource +import tachiyomi.data.source.SourcePagingSourceType +import tachiyomi.data.source.SourcePopularPagingSource +import tachiyomi.data.source.SourceSearchPagingSource import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount import tachiyomi.source.local.LocalSource @@ -35,9 +38,7 @@ class SourceRepositoryImpl( sourceIdsWithCount .filterNot { it.source == LocalSource.ID } .map { (sourceId, count) -> - val source = sourceManager.getOrStub(sourceId).run { - sourceMapper(this) - } + val source = sourceMapper(sourceManager.getOrStub(sourceId)) source to count } } diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt index 0fefeeee65..3a2574b813 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt @@ -1,8 +1,8 @@ package eu.kanade.domain.source.interactor -import eu.kanade.domain.source.model.SourcePagingSourceType import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.tachiyomi.source.model.FilterList +import tachiyomi.data.source.SourcePagingSourceType class GetRemoteManga( private val repository: SourceRepository, diff --git a/app/src/main/java/eu/kanade/domain/source/model/SourcePagingSourceType.kt b/app/src/main/java/eu/kanade/domain/source/model/SourcePagingSourceType.kt deleted file mode 100644 index 456f65f7cb..0000000000 --- a/app/src/main/java/eu/kanade/domain/source/model/SourcePagingSourceType.kt +++ /dev/null @@ -1,6 +0,0 @@ -package eu.kanade.domain.source.model - -import androidx.paging.PagingSource -import eu.kanade.tachiyomi.source.model.SManga - -typealias SourcePagingSourceType = PagingSource diff --git a/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt b/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt index 5b6c2b2152..0783815bbb 100644 --- a/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt +++ b/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt @@ -1,8 +1,8 @@ package eu.kanade.domain.source.repository -import eu.kanade.domain.source.model.SourcePagingSourceType import eu.kanade.tachiyomi.source.model.FilterList import kotlinx.coroutines.flow.Flow +import tachiyomi.data.source.SourcePagingSourceType import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount diff --git a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt index a27bf3d096..4ec361735e 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems -import eu.kanade.data.source.NoResultsException import eu.kanade.presentation.browse.components.BrowseSourceComfortableGrid import eu.kanade.presentation.browse.components.BrowseSourceCompactGrid import eu.kanade.presentation.browse.components.BrowseSourceList @@ -25,6 +24,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import kotlinx.coroutines.flow.StateFlow +import tachiyomi.data.source.NoResultsException import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.manga.model.Manga import tachiyomi.presentation.core.components.material.Scaffold diff --git a/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt b/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt index 91b75cf4b9..68f073f9e1 100644 --- a/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt @@ -21,7 +21,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.asToggleableState import eu.kanade.tachiyomi.R import tachiyomi.core.preference.CheckboxState import tachiyomi.domain.category.model.Category @@ -110,7 +110,7 @@ fun ChangeCategoryDialog( when (checkbox) { is CheckboxState.TriState -> { TriStateCheckbox( - state = checkbox.asState(), + state = checkbox.asToggleableState(), onClick = { onChange(checkbox) }, ) } diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt index 3b451f36f2..706deeb06d 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt @@ -14,7 +14,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLayoutDirection -import eu.kanade.core.prefs.PreferenceMutableState +import eu.kanade.core.preference.PreferenceMutableState import eu.kanade.tachiyomi.ui.library.LibraryItem import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt index 6c9fc418bd..c3bba5f473 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.unit.dp -import eu.kanade.core.prefs.PreferenceMutableState +import eu.kanade.core.preference.PreferenceMutableState import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.library.LibraryItem import tachiyomi.domain.library.model.LibraryDisplayMode diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt index 7f7df1b05d..95010c4ece 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt @@ -13,7 +13,7 @@ import androidx.paging.filter import androidx.paging.map import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.asState import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay import eu.kanade.domain.library.service.LibraryPreferences diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt index 8955b891fd..1dbc928e6f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt @@ -7,8 +7,8 @@ import androidx.compose.ui.util.fastAny import androidx.compose.ui.util.fastMap import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope -import eu.kanade.core.prefs.PreferenceMutableState -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.PreferenceMutableState +import eu.kanade.core.preference.asState import eu.kanade.core.util.fastDistinctBy import eu.kanade.core.util.fastFilter import eu.kanade.core.util.fastFilterNot diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 0ae05e24a2..1b3469be6a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.asState import eu.kanade.core.util.addOrRemove import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags import eu.kanade.domain.chapter.interactor.SetReadStatus diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt index 0ad008f67b..d91d49da34 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreTab.kt @@ -17,7 +17,7 @@ import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.TabOptions -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.asState import eu.kanade.domain.base.BasePreferences import eu.kanade.presentation.more.MoreScreen import eu.kanade.presentation.util.Tab diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt index 5815a585a3..7a44527c30 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope -import eu.kanade.core.prefs.asState +import eu.kanade.core.preference.asState import eu.kanade.core.util.addOrRemove import eu.kanade.core.util.insertSeparators import eu.kanade.domain.chapter.interactor.SetReadStatus diff --git a/app/src/main/java/eu/kanade/data/source/SourcePagingSource.kt b/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt similarity index 94% rename from app/src/main/java/eu/kanade/data/source/SourcePagingSource.kt rename to data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt index c5b724be70..8b4fb03413 100644 --- a/app/src/main/java/eu/kanade/data/source/SourcePagingSource.kt +++ b/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt @@ -1,7 +1,7 @@ -package eu.kanade.data.source +package tachiyomi.data.source +import androidx.paging.PagingSource import androidx.paging.PagingState -import eu.kanade.domain.source.model.SourcePagingSourceType import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -9,6 +9,8 @@ import eu.kanade.tachiyomi.source.model.SManga import tachiyomi.core.util.lang.awaitSingle import tachiyomi.core.util.lang.withIOContext +typealias SourcePagingSourceType = PagingSource + abstract class SourcePagingSource( protected val source: CatalogueSource, ) : SourcePagingSourceType() {