mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Fixed: The progress the not tracked when we resume the downloads.
This commit is contained in:
parent
b4ba2ed848
commit
0f16730120
@ -25,7 +25,6 @@ import com.tonyodev.fetch2.Download
|
||||
import com.tonyodev.fetch2.Error
|
||||
import com.tonyodev.fetch2.Fetch
|
||||
import com.tonyodev.fetch2.FetchListener
|
||||
import com.tonyodev.fetch2.Status
|
||||
import com.tonyodev.fetch2core.DownloadBlock
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
@ -33,7 +32,6 @@ import io.reactivex.schedulers.Schedulers
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import org.kiwix.kiwixmobile.core.CoreApp
|
||||
import org.kiwix.kiwixmobile.core.dao.DownloadRoomDao
|
||||
import org.kiwix.kiwixmobile.core.dao.entities.DownloadRoomEntity
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
@ -72,8 +70,10 @@ class DownloadMonitorService : Service() {
|
||||
{
|
||||
try {
|
||||
synchronized(lock) {
|
||||
if (getActiveDownloads().isEmpty()) {
|
||||
stopForegroundServiceForDownloads()
|
||||
fetch.hasActiveDownloads(includeAddedDownloads = true) {
|
||||
if (!it) {
|
||||
stopForegroundServiceForDownloads()
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ignore: Exception) {
|
||||
@ -87,9 +87,6 @@ class DownloadMonitorService : Service() {
|
||||
)
|
||||
}
|
||||
|
||||
private fun getActiveDownloads(): List<DownloadRoomEntity> =
|
||||
downloadRoomDao.downloadRoomEntity().blockingFirst().filter { it.status != Status.PAUSED }
|
||||
|
||||
private fun setupUpdater() {
|
||||
updaterDisposable = updater.subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(
|
||||
{ it.invoke() },
|
||||
|
Loading…
x
Reference in New Issue
Block a user