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:
1 parent
9fd8a555f1
commit
d8c75e72e4
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 {
|
||||
downloadJob = null
|
||||
@@ -230,6 +234,10 @@ class DownloadManager(
|
||||
}
|
||||
|
||||
}
|
||||
delay(TERMINAL_STATE_DURATION)
|
||||
if (downloadState.value is DownloadState.Error) {
|
||||
updateDownloadProgressState(DownloadState.Idle, 0f)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
downloadJob = null
|
||||
|
||||
Reference in new issue
Block a user