This commit is contained in:
machiav3lli 2022-05-31 03:25:00 +02:00
parent a09692884e
commit 7db5ab0b6a
2 changed files with 11 additions and 9 deletions

View File

@ -153,6 +153,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
handleNextTask(false)
}
} else {
// TODO if disable then refresh app lists
cancelTasks { it.repositoryId == repository.id }
val cancelledTask = cancelCurrentTask { it.task?.repositoryId == repository.id }
handleNextTask(cancelledTask?.hasUpdates == true)

View File

@ -48,6 +48,7 @@ import com.looker.droidify.entity.Cancelable
import com.looker.droidify.entity.Connecting
import com.looker.droidify.entity.Details
import com.looker.droidify.entity.DonateType
import com.looker.droidify.entity.Downloading
import com.looker.droidify.entity.Install
import com.looker.droidify.entity.Launch
import com.looker.droidify.entity.PackageState
@ -245,23 +246,23 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
}
}
private suspend fun updateDownloadState(state: DownloadService.State?) {
val status = when (state) {
private suspend fun updateDownloadState(downloadState: DownloadService.State?) {
val packageState = when (downloadState) {
is DownloadService.State.Pending -> Pending
is DownloadService.State.Connecting -> Connecting
is DownloadService.State.Downloading -> com.looker.droidify.entity.Downloading(
state.read,
state.total
is DownloadService.State.Downloading -> Downloading(
downloadState.read,
downloadState.total
)
else -> null
}
val downloading = status is Cancelable
val downloading = packageState is Cancelable
this.downloading = downloading
viewModel.state.value = state
viewModel.state.value = packageState
updateButtons()
if (state is DownloadService.State.Success && isResumed && !rootInstallerEnabled) {
if (downloadState is DownloadService.State.Success && isResumed && !rootInstallerEnabled) {
withContext(Dispatchers.Default) {
AppInstaller.getInstance(context)?.defaultInstaller?.install(state.release.cacheFileName)
AppInstaller.getInstance(context)?.defaultInstaller?.install(downloadState.release.cacheFileName)
}
}
}