Переключение языка

This commit is contained in:
2026-05-18 15:35:06 +03:00
parent f3f99aed5a
commit f99d79fece
46 changed files with 1368 additions and 424 deletions

View File

@@ -1,5 +1,6 @@
package com.github.nullptroma.wallenc.domain.interfaces
import com.github.nullptroma.wallenc.domain.tasks.TaskProgressLabel
import java.util.UUID
enum class StorageSyncGroupEncryptionKind {
@@ -24,10 +25,10 @@ interface IStorageSyncGroupStore {
interface IStorageSyncEngine {
suspend fun syncAllGroups(
reportProgress: (suspend (fraction: Float?, label: String?) -> Unit)? = null,
reportProgress: (suspend (fraction: Float?, label: TaskProgressLabel?) -> Unit)? = null,
)
suspend fun syncGroup(
groupId: String,
reportProgress: (suspend (fraction: Float?, label: String?) -> Unit)? = null,
reportProgress: (suspend (fraction: Float?, label: TaskProgressLabel?) -> Unit)? = null,
)
}

View File

@@ -5,11 +5,13 @@ import com.github.nullptroma.wallenc.domain.errors.WallencException
interface TaskContext {
val taskId: TaskId
suspend fun reportProgress(fraction: Float?, label: String?)
suspend fun reportProgress(fraction: Float?, label: TaskProgressLabel? = null)
suspend fun reportProgress(progress: TaskProgress) = reportProgress(progress.fraction, progress.label)
fun log(level: TaskLogLevel, message: String)
fun log(level: TaskLogLevel, key: TaskLogKey)
fun fail(error: WallencException): Nothing
}

View File

@@ -0,0 +1,9 @@
package com.github.nullptroma.wallenc.domain.tasks
import com.github.nullptroma.wallenc.domain.errors.WallencException
sealed class TaskLogKey {
data object SyncStarted : TaskLogKey()
data object SyncFinished : TaskLogKey()
data class SyncFailed(val error: WallencException) : TaskLogKey()
}

View File

@@ -3,5 +3,6 @@ package com.github.nullptroma.wallenc.domain.tasks
data class TaskLogLine(
val timestampMs: Long,
val level: TaskLogLevel,
val message: String,
val message: String = "",
val logKey: TaskLogKey? = null,
)

View File

@@ -3,5 +3,5 @@ package com.github.nullptroma.wallenc.domain.tasks
data class TaskProgress(
/** 0f..1f or null if indeterminate */
val fraction: Float?,
val label: String?,
val label: TaskProgressLabel? = null,
)

View File

@@ -0,0 +1,50 @@
package com.github.nullptroma.wallenc.domain.tasks
sealed class TaskProgressLabel {
data object SyncNoGroups : TaskProgressLabel()
data object SyncStarted : TaskProgressLabel()
data object SyncCompleted : TaskProgressLabel()
data class SyncPreparing(val groupCount: Int) : TaskProgressLabel()
data class SyncGroupPreparing(val groupId: String) : TaskProgressLabel()
data class SyncGroupNotFound(val groupId: String) : TaskProgressLabel()
data class SyncGroupSkippedTooFewStorages(val groupId: String) : TaskProgressLabel()
data class SyncGroupSkippedIncompatibleEncryption(val groupId: String, val count: Int) : TaskProgressLabel()
data class SyncGroupAcquiringLocks(val groupId: String) : TaskProgressLabel()
data class SyncGroupLockProgress(val groupId: String, val current: Int, val total: Int) : TaskProgressLabel()
data class SyncGroupLockFailed(val groupId: String) : TaskProgressLabel()
data class SyncGroupReadingJournals(val groupId: String) : TaskProgressLabel()
data class SyncGroupCancelled(val groupId: String) : TaskProgressLabel()
data class SyncGroupJournalProgress(val groupId: String, val current: Int, val total: Int) : TaskProgressLabel()
data class SyncGroupNoJournalEntries(val groupId: String) : TaskProgressLabel()
data class SyncGroupProcessingEntries(val groupId: String, val count: Int) : TaskProgressLabel()
data class SyncGroupEntryProgress(val groupId: String, val current: Int, val total: Int) : TaskProgressLabel()
data class SyncGroupCompleted(val groupId: String) : TaskProgressLabel()
data class SyncGroupRenewingLocks(val groupId: String) : TaskProgressLabel()
data class SyncGroupLockRenewalFailed(val groupId: String) : TaskProgressLabel()
data class ClearContentProgress(val done: Int, val total: Int) : TaskProgressLabel()
data class VaultTask(val step: VaultTaskStep) : TaskProgressLabel()
data class TestElapsed(val elapsedSec: Int, val totalSec: Int) : TaskProgressLabel()
}
enum class VaultTaskStep {
DumpStorageLog,
CreateStorage,
EnableEncryption,
DecryptRunning,
CloseStorage,
DisableEncryption,
RenameStorage,
RemoveStorage,
ClearSyncLock,
AddRemoteVault,
RemoveRemoteVault,
RetryRemoteVault,
Save2FaToken,
Delete2FaToken,
SaveTextSecret,
DeleteTextSecret,
}