feat(ui): добавлены новые состояния и компоненты для отображения статуса работы

This commit is contained in:
2026-05-13 17:22:31 +03:00
parent 6c18a1d741
commit f551efe4a6
40 changed files with 1787 additions and 542 deletions

View File

@@ -12,17 +12,21 @@ class RunStorageSyncUseCase(
) {
private val running = AtomicBoolean(false)
fun enqueue(reason: String) {
/**
* @param displayTitle заголовок задачи в UI (локализованный на стороне вызова)
* @param logReason техническая метка для логов (не для UI)
*/
fun enqueue(displayTitle: String, logReason: String) {
orchestrator.enqueue(
title = "Storage sync ($reason)",
title = displayTitle,
dispatcher = Dispatchers.IO,
work = { ctx ->
if (!running.compareAndSet(false, true)) {
ctx.log(TaskLogLevel.Info, "Storage sync skipped: already running")
ctx.log(TaskLogLevel.Info, "Storage sync skipped (already running), reason=$logReason")
return@enqueue
}
try {
ctx.log(TaskLogLevel.Info, "Storage sync started")
ctx.log(TaskLogLevel.Info, "Storage sync started, reason=$logReason")
ctx.reportProgress(null, "Storage sync: started")
syncEngine.syncAllGroups { fraction, label ->
ctx.reportProgress(fraction, label)