Fix: Allow retention of apk till "consumed" (closes #260)

This commit is contained in:
machiav3lli 2022-08-03 01:45:40 +02:00
parent cb94485e82
commit 3861582d66

View File

@ -30,6 +30,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.Disposable
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
@ -194,12 +195,12 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
mutableStateSubject.emit(State.Success(task.packageName, task.name, task.release))
consumed = true
}
//if (!consumed) { TODO investigate if there's resulting issues
scope.launch {
if (!consumed) { //TODO investigate if there's resulting issues
MainScope().launch {
AppInstaller.getInstance(this@DownloadService)
?.defaultInstaller?.install(task.name, task.release.cacheFileName)
}
//}
}
}
private fun validatePackage(task: Task, file: File): ValidationError? {