fix(download): expire the sticky error state

A download error stayed in the state flow forever: the dictionaries
section replayed it as a snackbar on every recomposition and screens
created later picked it up long after the failure, even while a newer
download was already running. Error states now decay to idle after the
same grace period as success, unless a newer state has replaced them.
This commit is contained in:
OneWay committed 2026-10-15 13:38:00 +08:00
1 parent 6889dd2c45
commit 123615e1f8
1 file changed
+8
@@ -135,6 +135,10 @@ class DownloadManager(
} }
} }
delay(TERMINAL_STATE_DURATION)
if (downloadState.value is DownloadState.Error) {
updateDownloadProgressState(DownloadState.Idle, 0f)
}
} }
} finally { } finally {
downloadJob = null downloadJob = null
@@ -230,6 +234,10 @@ class DownloadManager(
} }
} }
delay(TERMINAL_STATE_DURATION)
if (downloadState.value is DownloadState.Error) {
updateDownloadProgressState(DownloadState.Idle, 0f)
}
} }
} finally { } finally {
downloadJob = null downloadJob = null