mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Clean up
This commit is contained in:
parent
a09692884e
commit
7db5ab0b6a
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user