Feed: will get Popular if source doesn’t support Latest

This commit is contained in:
Cuong M. Tran 2024-01-31 16:03:01 +07:00
parent 46e7e1fbca
commit 6a7db7b2e4
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
6 changed files with 24 additions and 9 deletions

View file

@ -195,7 +195,12 @@ fun FeedAddSearchDialog(
val context = LocalContext.current
val savedSearchStrings = remember {
savedSearches.map {
it?.name ?: context.stringResource(MR.strings.latest)
// KMK -->
it?.name ?: if (source.supportsLatest)
context.stringResource(MR.strings.latest)
else
context.stringResource(MR.strings.popular)
// KMK <--
}.toImmutableList()
}
RadioSelector(

View file

@ -112,7 +112,7 @@ fun SourcesScreen(
FastScrollLazyColumn(
state = lazyListState,
// KMK <--
// KMK <--
contentPadding = contentPadding + topSmallPaddingValues,
) {
items(

View file

@ -30,15 +30,13 @@ import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun GlobalSearchResultItem(
// SY -->
modifier: Modifier = Modifier,
// SY <--
title: String,
// SY -->
subtitle: String?,
// SY <--
onClick: () -> Unit,
// SY -->
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
// SY <--
content: @Composable () -> Unit,

View file

@ -130,7 +130,9 @@ open class FeedScreenModel(
dialog = Dialog.AddFeedSearch(
source,
(
(if (source.supportsLatest) persistentListOf(null) else persistentListOf()) +
// KMK -->
persistentListOf(null) +
// KMK <-->
getSourceSavedSearches(source.id)
).toImmutableList(),
),
@ -231,7 +233,12 @@ open class FeedScreenModel(
if (itemUI.source != null) {
withContext(coroutineDispatcher) {
if (itemUI.savedSearch == null) {
itemUI.source.getLatestUpdates(1)
// KMK -->
if (itemUI.source.supportsLatest)
itemUI.source.getLatestUpdates(1)
else
itemUI.source.getPopularManga(1)
// KMK <--
} else {
itemUI.source.getSearchManga(
1,

View file

@ -78,7 +78,12 @@ fun Screen.feedTab(): TabContent {
navigator.push(
BrowseSourceScreen(
source.id,
GetRemoteManga.QUERY_LATEST,
// KMK -->
listingQuery = if (!source.supportsLatest)
GetRemoteManga.QUERY_POPULAR
else
GetRemoteManga.QUERY_LATEST,
// KMK <--
),
)
},

View file

@ -7,7 +7,7 @@ data class FeedSavedSearch(
// Source for the saved search
val source: Long,
// If -1 then get latest, if set get the saved search
// If null then get latest/popular, if set get the saved search
val savedSearch: Long?,
// If the feed is a global or source specific feed