Feed: will get Popular if source doesn’t support Latest
This commit is contained in:
parent
46e7e1fbca
commit
6a7db7b2e4
6 changed files with 24 additions and 9 deletions
|
|
@ -195,7 +195,12 @@ fun FeedAddSearchDialog(
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val savedSearchStrings = remember {
|
val savedSearchStrings = remember {
|
||||||
savedSearches.map {
|
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()
|
}.toImmutableList()
|
||||||
}
|
}
|
||||||
RadioSelector(
|
RadioSelector(
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ fun SourcesScreen(
|
||||||
|
|
||||||
FastScrollLazyColumn(
|
FastScrollLazyColumn(
|
||||||
state = lazyListState,
|
state = lazyListState,
|
||||||
// KMK <--
|
// KMK <--
|
||||||
contentPadding = contentPadding + topSmallPaddingValues,
|
contentPadding = contentPadding + topSmallPaddingValues,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
|
|
|
||||||
|
|
@ -30,15 +30,13 @@ import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun GlobalSearchResultItem(
|
fun GlobalSearchResultItem(
|
||||||
// SY -->
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
// SY <--
|
|
||||||
title: String,
|
title: String,
|
||||||
// SY -->
|
// SY -->
|
||||||
subtitle: String?,
|
subtitle: String?,
|
||||||
// SY <--
|
// SY <--
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
// SY -->
|
// SY -->
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
// SY <--
|
// SY <--
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,9 @@ open class FeedScreenModel(
|
||||||
dialog = Dialog.AddFeedSearch(
|
dialog = Dialog.AddFeedSearch(
|
||||||
source,
|
source,
|
||||||
(
|
(
|
||||||
(if (source.supportsLatest) persistentListOf(null) else persistentListOf()) +
|
// KMK -->
|
||||||
|
persistentListOf(null) +
|
||||||
|
// KMK <-->
|
||||||
getSourceSavedSearches(source.id)
|
getSourceSavedSearches(source.id)
|
||||||
).toImmutableList(),
|
).toImmutableList(),
|
||||||
),
|
),
|
||||||
|
|
@ -231,7 +233,12 @@ open class FeedScreenModel(
|
||||||
if (itemUI.source != null) {
|
if (itemUI.source != null) {
|
||||||
withContext(coroutineDispatcher) {
|
withContext(coroutineDispatcher) {
|
||||||
if (itemUI.savedSearch == null) {
|
if (itemUI.savedSearch == null) {
|
||||||
itemUI.source.getLatestUpdates(1)
|
// KMK -->
|
||||||
|
if (itemUI.source.supportsLatest)
|
||||||
|
itemUI.source.getLatestUpdates(1)
|
||||||
|
else
|
||||||
|
itemUI.source.getPopularManga(1)
|
||||||
|
// KMK <--
|
||||||
} else {
|
} else {
|
||||||
itemUI.source.getSearchManga(
|
itemUI.source.getSearchManga(
|
||||||
1,
|
1,
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,12 @@ fun Screen.feedTab(): TabContent {
|
||||||
navigator.push(
|
navigator.push(
|
||||||
BrowseSourceScreen(
|
BrowseSourceScreen(
|
||||||
source.id,
|
source.id,
|
||||||
GetRemoteManga.QUERY_LATEST,
|
// KMK -->
|
||||||
|
listingQuery = if (!source.supportsLatest)
|
||||||
|
GetRemoteManga.QUERY_POPULAR
|
||||||
|
else
|
||||||
|
GetRemoteManga.QUERY_LATEST,
|
||||||
|
// KMK <--
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ data class FeedSavedSearch(
|
||||||
// Source for the saved search
|
// Source for the saved search
|
||||||
val source: Long,
|
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?,
|
val savedSearch: Long?,
|
||||||
|
|
||||||
// If the feed is a global or source specific feed
|
// If the feed is a global or source specific feed
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue