Новый конвейер задач и уведомлений

This commit is contained in:
2026-04-21 01:52:31 +03:00
parent 52353ea4a0
commit 75162e2d64
12 changed files with 474 additions and 195 deletions

View File

@@ -1,6 +1,7 @@
package com.github.nullptroma.wallenc.domain.tasks
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.CoroutineDispatcher
interface ITaskOrchestrator {
val pipelineState: StateFlow<PipelineState>
@@ -9,14 +10,11 @@ interface ITaskOrchestrator {
fun enqueue(
title: String,
requiresForeground: Boolean = true,
dispatcher: CoroutineDispatcher,
work: PipelineWork,
): TaskId
fun cancel(taskId: TaskId): Boolean
/** Cancels the currently running task, if any. */
fun cancelCurrent(): Boolean
fun cancelAll()
}

View File

@@ -2,5 +2,5 @@ package com.github.nullptroma.wallenc.domain.tasks
data class PipelineState(
val tasks: List<PipelineTask>,
val currentTaskId: TaskId?,
val runningTaskIds: Set<TaskId>,
)

View File

@@ -1,8 +1,10 @@
package com.github.nullptroma.wallenc.domain.tasks
import kotlinx.coroutines.CoroutineDispatcher
data class PipelineTask(
val id: TaskId,
val title: String,
val requiresForeground: Boolean,
val dispatcher: CoroutineDispatcher,
val state: TaskRunState,
)

View File

@@ -1,9 +1,14 @@
package com.github.nullptroma.wallenc.domain.tasks
data class TaskForegroundItem(
val taskId: TaskId,
val title: String,
val progress: TaskProgress?,
)
sealed class TaskForegroundUiState {
data object Hidden : TaskForegroundUiState()
data class Visible(
val title: String,
val progress: TaskProgress?,
val tasks: List<TaskForegroundItem>,
) : TaskForegroundUiState()
}