UpdatesFragment: Check if downloads are running instead of finished

Update all button otherwise shows cancel on first run

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-01-25 20:16:12 +05:30
parent 683c00ee0d
commit 1ebe86a22b
3 changed files with 3 additions and 1 deletions

View File

@@ -10,5 +10,6 @@ enum class DownloadStatus {
companion object {
val finished = listOf(FAILED, CANCELLED, COMPLETED)
val running = listOf(QUEUED, DOWNLOADING)
}
}

View File

@@ -29,6 +29,7 @@ data class Download(
val sharedLibs: List<SharedLib>
) : Parcelable {
val isFinished get() = downloadStatus in DownloadStatus.finished
val isRunning get() = downloadStatus in DownloadStatus.running
companion object {
fun fromApp(app: App): Download {

View File

@@ -95,7 +95,7 @@ class UpdatesFragment : BaseFragment(R.layout.fragment_updates) {
}.collectLatest { map ->
updateController(map)
binding.swipeRefreshLayout.isRefreshing = false
viewModel.updateAllEnqueued = map?.values?.all { it?.isFinished != true } ?: false
viewModel.updateAllEnqueued = map?.values?.all { it?.isRunning == true } ?: false
}
}