Fix (BrowseSourceScreen): don't expand manga description if it's favorited

This commit is contained in:
Cuong-Tran 2025-02-17 14:37:09 +07:00
parent e6e839e6b3
commit 1247d4e466
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
2 changed files with 15 additions and 5 deletions

View file

@ -344,13 +344,13 @@ data class BrowseSourceScreen(
// KMK <--
navigator.push(
MangaScreen(
manga.id,
mangaId = manga.id,
// KMK -->
// Finding the entry to be merged to, so we don't want to expand description
// so that user can see the `Merge to another` button
smartSearchConfig != null,
fromSource = smartSearchConfig == null,
// KMK <--
smartSearchConfig,
smartSearchConfig = smartSearchConfig,
),
)
}

View file

@ -117,7 +117,11 @@ import uy.kohesive.injekt.api.get
class MangaScreen(
private val mangaId: Long,
/** If it is opened from Source then it will auto expand the manga description */
/**
* If it is opened from Source then it will auto expand the manga description.
* - `true`: Expand description if it's not favorited
* - `false`: Don't expand description
*/
val fromSource: Boolean = false,
private val smartSearchConfig: SourcesScreen.SmartSearchConfig? = null,
) : Screen(), AssistContentScreen {
@ -138,7 +142,13 @@ class MangaScreen(
val scope = rememberCoroutineScope()
val lifecycleOwner = LocalLifecycleOwner.current
val screenModel = rememberScreenModel {
MangaScreenModel(context, lifecycleOwner.lifecycle, mangaId, fromSource, smartSearchConfig != null)
MangaScreenModel(
context = context,
lifecycle = lifecycleOwner.lifecycle,
mangaId = mangaId,
isFromSource = fromSource,
smartSearched = smartSearchConfig != null,
)
}
val state by screenModel.state.collectAsStateWithLifecycle()