DownloadController: Fix first active download status not updating (#8069)
This commit is contained in:
parent
b8c1257645
commit
f98b4f4e39
2 changed files with 12 additions and 14 deletions
|
@ -75,7 +75,9 @@ class DownloadQueue(
|
||||||
Observable.from(this).filter { download -> download.status == Download.State.DOWNLOADING }
|
Observable.from(this).filter { download -> download.status == Download.State.DOWNLOADING }
|
||||||
|
|
||||||
@Deprecated("Use getStatusAsFlow instead")
|
@Deprecated("Use getStatusAsFlow instead")
|
||||||
fun getStatusObservable(): Observable<Download> = statusSubject.onBackpressureBuffer()
|
fun getStatusObservable(): Observable<Download> = statusSubject
|
||||||
|
.startWith(getActiveDownloads())
|
||||||
|
.onBackpressureBuffer()
|
||||||
|
|
||||||
fun getStatusAsFlow(): Flow<Download> = getStatusObservable().asFlow()
|
fun getStatusAsFlow(): Flow<Download> = getStatusObservable().asFlow()
|
||||||
|
|
||||||
|
|
|
@ -90,19 +90,6 @@ class DownloadController :
|
||||||
|
|
||||||
override fun createPresenter() = DownloadPresenter()
|
override fun createPresenter() = DownloadPresenter()
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
viewScope.launchUI {
|
|
||||||
presenter.getDownloadStatusFlow()
|
|
||||||
.collect(this@DownloadController::onStatusChange)
|
|
||||||
}
|
|
||||||
viewScope.launchUI {
|
|
||||||
presenter.getDownloadProgressFlow()
|
|
||||||
.collect(this@DownloadController::onUpdateDownloadedPages)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ComposeContent() {
|
override fun ComposeContent() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
@ -291,6 +278,15 @@ class DownloadController :
|
||||||
|
|
||||||
ViewCompat.setNestedScrollingEnabled(controllerBinding.root, true)
|
ViewCompat.setNestedScrollingEnabled(controllerBinding.root, true)
|
||||||
|
|
||||||
|
viewScope.launchUI {
|
||||||
|
presenter.getDownloadStatusFlow()
|
||||||
|
.collect(this@DownloadController::onStatusChange)
|
||||||
|
}
|
||||||
|
viewScope.launchUI {
|
||||||
|
presenter.getDownloadProgressFlow()
|
||||||
|
.collect(this@DownloadController::onUpdateDownloadedPages)
|
||||||
|
}
|
||||||
|
|
||||||
controllerBinding.root
|
controllerBinding.root
|
||||||
},
|
},
|
||||||
update = {
|
update = {
|
||||||
|
|
Reference in a new issue