MangaPresenter: Incognito and downloaded only label related tweaks (#7535)

When manga screen takes time to load incognito and downloaded only label doesn't show up. It's fixed in the pr.

(cherry picked from commit b034f503f8ce9327187c2024b7ee74779f397bb8)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt
This commit is contained in:
AntsyLich 2022-07-17 02:45:05 +06:00 committed by Jobobby04
parent 19fcc129c0
commit a99aaade5d

View File

@ -233,6 +233,17 @@ class MangaPresenter(
_state.update { if (it is MangaScreenState.Success) func(it) else it }
}
private var incognitoMode = false
set(value) {
updateSuccessState { it.copy(isIncognitoMode = value) }
field = value
}
private var downloadedOnlyMode = false
set(value) {
updateSuccessState { it.copy(isDownloadedOnlyMode = value) }
field = value
}
override fun onCreate(savedState: Bundle?) {
super.onCreate(savedState)
@ -322,6 +333,8 @@ class MangaPresenter(
isFromSource = isFromSource,
trackingAvailable = trackManager.hasLoggedServices(),
chapters = chapterItems,
isIncognitoMode = incognitoMode,
isDownloadedOnlyMode = downloadedOnlyMode,
// SY -->
meta = raiseMetadata(flatMetadata, source),
mergedData = mergedData,
@ -363,13 +376,13 @@ class MangaPresenter(
preferences.incognitoMode()
.asImmediateFlow { incognito ->
updateSuccessState { it.copy(isIncognitoMode = incognito) }
incognitoMode = incognito
}
.launchIn(presenterScope)
preferences.downloadedOnly()
.asImmediateFlow { downloadedOnly ->
updateSuccessState { it.copy(isDownloadedOnlyMode = downloadedOnly) }
downloadedOnlyMode = downloadedOnly
}
.launchIn(presenterScope)
}