From 655c7cd59fb470b9c1c47213c08ad6cfbd5c88b2 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 17 Mar 2025 14:17:24 +0800 Subject: [PATCH] DownloadWorker: Notify dowload failure on network error as well We can do special handling when ready but failure is a failure regardless. Notify the user about it. Also remove non-required default exception parameter as all instances of onFailure specify an appropriate exception. Signed-off-by: Aayush Gupta --- .../main/java/com/aurora/store/data/work/DownloadWorker.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt index a0e4118c1..cea43b2e9 100644 --- a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt +++ b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt @@ -205,7 +205,7 @@ class DownloadWorker @AssistedInject constructor( } } - private suspend fun onFailure(exception: Exception = Exception("Something went wrong!")): Result = + private suspend fun onFailure(exception: Exception): Result = withContext(NonCancellable) { Log.i(TAG, "Job failed: ${download.packageName}", exception) @@ -218,10 +218,6 @@ class DownloadWorker @AssistedInject constructor( notifyStatus(DownloadStatus.CANCELLED) } - is NoNetworkException -> { - // TODO: Notify user of network failure, maybe a notification & retry option - } - else -> { notifyStatus(DownloadStatus.FAILED) AuroraApp.events.send(InstallerEvent.Failed(download.packageName).apply {