mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 20:57:24 +01:00
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.
This commit is contained in:
parent
9ebeff04e6
commit
b034f503f8
@ -147,6 +147,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)
|
||||
|
||||
@ -174,6 +185,8 @@ class MangaPresenter(
|
||||
isFromSource = isFromSource,
|
||||
trackingAvailable = trackManager.hasLoggedServices(),
|
||||
chapters = chapterItems,
|
||||
isIncognitoMode = incognitoMode,
|
||||
isDownloadedOnlyMode = downloadedOnlyMode
|
||||
)
|
||||
|
||||
// Update state
|
||||
@ -195,13 +208,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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user