mirror of
https://github.com/mihonapp/mihon.git
synced 2025-01-24 00:44:52 +01:00
Revert "Show no pinned sources message when attempting to migrate/search"
This reverts commit 6bb3070c578a330a98ca387a1f31c64bf6e31eb6. This doesn't quite work correctly, so reverting for now. We'll have to have more robust states or something to deal with this in the future.
This commit is contained in:
parent
75e23299b4
commit
29aee68ec7
@ -13,7 +13,6 @@ import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
|
|||||||
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchToolbar
|
import eu.kanade.presentation.browse.components.GlobalSearchToolbar
|
||||||
import eu.kanade.presentation.components.EmptyScreen
|
|
||||||
import eu.kanade.presentation.components.LazyColumn
|
import eu.kanade.presentation.components.LazyColumn
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.util.padding
|
import eu.kanade.presentation.util.padding
|
||||||
@ -50,7 +49,6 @@ fun GlobalSearchScreen(
|
|||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
GlobalSearchContent(
|
GlobalSearchContent(
|
||||||
items = state.items,
|
items = state.items,
|
||||||
isPinnedOnly = state.isPinnedOnly,
|
|
||||||
contentPadding = paddingValues,
|
contentPadding = paddingValues,
|
||||||
getManga = getManga,
|
getManga = getManga,
|
||||||
onClickSource = onClickSource,
|
onClickSource = onClickSource,
|
||||||
@ -63,20 +61,12 @@ fun GlobalSearchScreen(
|
|||||||
@Composable
|
@Composable
|
||||||
fun GlobalSearchContent(
|
fun GlobalSearchContent(
|
||||||
items: Map<CatalogueSource, SearchItemResult>,
|
items: Map<CatalogueSource, SearchItemResult>,
|
||||||
isPinnedOnly: Boolean,
|
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
getManga: @Composable (CatalogueSource, Manga) -> State<Manga>,
|
getManga: @Composable (CatalogueSource, Manga) -> State<Manga>,
|
||||||
onClickSource: (CatalogueSource) -> Unit,
|
onClickSource: (CatalogueSource) -> Unit,
|
||||||
onClickItem: (Manga) -> Unit,
|
onClickItem: (Manga) -> Unit,
|
||||||
onLongClickItem: (Manga) -> Unit,
|
onLongClickItem: (Manga) -> Unit,
|
||||||
) {
|
) {
|
||||||
if (items.isEmpty() && isPinnedOnly) {
|
|
||||||
EmptyScreen(
|
|
||||||
message = stringResource(R.string.no_pinned_sources),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
|
@ -3,17 +3,14 @@ package eu.kanade.presentation.browse
|
|||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchCardRow
|
import eu.kanade.presentation.browse.components.GlobalSearchCardRow
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchEmptyResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchEmptyResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
|
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
|
||||||
import eu.kanade.presentation.browse.components.GlobalSearchToolbar
|
import eu.kanade.presentation.browse.components.GlobalSearchToolbar
|
||||||
import eu.kanade.presentation.components.EmptyScreen
|
|
||||||
import eu.kanade.presentation.components.LazyColumn
|
import eu.kanade.presentation.components.LazyColumn
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.tachiyomi.R
|
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.search.MigrateSearchState
|
import eu.kanade.tachiyomi.ui.browse.migration.search.MigrateSearchState
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult
|
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult
|
||||||
@ -47,7 +44,6 @@ fun MigrateSearchScreen(
|
|||||||
MigrateSearchContent(
|
MigrateSearchContent(
|
||||||
sourceId = state.manga?.source ?: -1,
|
sourceId = state.manga?.source ?: -1,
|
||||||
items = state.items,
|
items = state.items,
|
||||||
isPinnedOnly = state.isPinnedOnly,
|
|
||||||
contentPadding = paddingValues,
|
contentPadding = paddingValues,
|
||||||
getManga = getManga,
|
getManga = getManga,
|
||||||
onClickSource = onClickSource,
|
onClickSource = onClickSource,
|
||||||
@ -61,20 +57,12 @@ fun MigrateSearchScreen(
|
|||||||
fun MigrateSearchContent(
|
fun MigrateSearchContent(
|
||||||
sourceId: Long,
|
sourceId: Long,
|
||||||
items: Map<CatalogueSource, SearchItemResult>,
|
items: Map<CatalogueSource, SearchItemResult>,
|
||||||
isPinnedOnly: Boolean,
|
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
getManga: @Composable (CatalogueSource, Manga) -> State<Manga>,
|
getManga: @Composable (CatalogueSource, Manga) -> State<Manga>,
|
||||||
onClickSource: (CatalogueSource) -> Unit,
|
onClickSource: (CatalogueSource) -> Unit,
|
||||||
onClickItem: (Manga) -> Unit,
|
onClickItem: (Manga) -> Unit,
|
||||||
onLongClickItem: (Manga) -> Unit,
|
onLongClickItem: (Manga) -> Unit,
|
||||||
) {
|
) {
|
||||||
if (items.isEmpty() && isPinnedOnly) {
|
|
||||||
EmptyScreen(
|
|
||||||
message = stringResource(R.string.no_pinned_sources),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
|
@ -22,11 +22,7 @@ class MigrateSearchScreenModel(
|
|||||||
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||||
private val sourceManager: SourceManager = Injekt.get(),
|
private val sourceManager: SourceManager = Injekt.get(),
|
||||||
private val getManga: GetManga = Injekt.get(),
|
private val getManga: GetManga = Injekt.get(),
|
||||||
) : SearchScreenModel<MigrateSearchState>(
|
) : SearchScreenModel<MigrateSearchState>(MigrateSearchState()) {
|
||||||
MigrateSearchState(
|
|
||||||
isPinnedOnly = sourcePreferences.searchPinnedSourcesOnly().get(),
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
extensionFilter = initialExtensionFilter
|
extensionFilter = initialExtensionFilter
|
||||||
@ -88,7 +84,6 @@ data class MigrateSearchState(
|
|||||||
val manga: Manga? = null,
|
val manga: Manga? = null,
|
||||||
val searchQuery: String? = null,
|
val searchQuery: String? = null,
|
||||||
val items: Map<CatalogueSource, SearchItemResult> = emptyMap(),
|
val items: Map<CatalogueSource, SearchItemResult> = emptyMap(),
|
||||||
val isPinnedOnly: Boolean,
|
|
||||||
val dialog: MigrateSearchDialog? = null,
|
val dialog: MigrateSearchDialog? = null,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -15,12 +15,7 @@ class GlobalSearchScreenModel(
|
|||||||
preferences: BasePreferences = Injekt.get(),
|
preferences: BasePreferences = Injekt.get(),
|
||||||
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||||
private val sourceManager: SourceManager = Injekt.get(),
|
private val sourceManager: SourceManager = Injekt.get(),
|
||||||
) : SearchScreenModel<GlobalSearchState>(
|
) : SearchScreenModel<GlobalSearchState>(GlobalSearchState(searchQuery = initialQuery)) {
|
||||||
GlobalSearchState(
|
|
||||||
searchQuery = initialQuery,
|
|
||||||
isPinnedOnly = sourcePreferences.searchPinnedSourcesOnly().get(),
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
|
|
||||||
val incognitoMode = preferences.incognitoMode()
|
val incognitoMode = preferences.incognitoMode()
|
||||||
val lastUsedSourceId = sourcePreferences.lastUsedSource()
|
val lastUsedSourceId = sourcePreferences.lastUsedSource()
|
||||||
@ -64,7 +59,6 @@ class GlobalSearchScreenModel(
|
|||||||
data class GlobalSearchState(
|
data class GlobalSearchState(
|
||||||
val searchQuery: String? = null,
|
val searchQuery: String? = null,
|
||||||
val items: Map<CatalogueSource, SearchItemResult> = emptyMap(),
|
val items: Map<CatalogueSource, SearchItemResult> = emptyMap(),
|
||||||
val isPinnedOnly: Boolean,
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val progress: Int = items.count { it.value !is SearchItemResult.Loading }
|
val progress: Int = items.count { it.value !is SearchItemResult.Loading }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user