Чистка предупреждений
This commit is contained in:
@@ -18,7 +18,7 @@ import javax.inject.Singleton
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class TaskPipelineForegroundBootstrap @Inject constructor(
|
class TaskPipelineForegroundBootstrap @Inject constructor(
|
||||||
@ApplicationContext private val app: Context,
|
@param:ApplicationContext private val app: Context,
|
||||||
private val orchestrator: ITaskOrchestrator,
|
private val orchestrator: ITaskOrchestrator,
|
||||||
) {
|
) {
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -2,8 +2,8 @@ package com.github.nullptroma.wallenc.data.storages
|
|||||||
|
|
||||||
import com.github.nullptroma.wallenc.data.db.app.repository.StorageKeyMapRepository
|
import com.github.nullptroma.wallenc.data.db.app.repository.StorageKeyMapRepository
|
||||||
import com.github.nullptroma.wallenc.data.model.StorageKeyMap
|
import com.github.nullptroma.wallenc.data.model.StorageKeyMap
|
||||||
import com.github.nullptroma.wallenc.domain.datatypes.EncryptKey
|
|
||||||
import com.github.nullptroma.wallenc.data.storages.encrypt.EncryptedStorage
|
import com.github.nullptroma.wallenc.data.storages.encrypt.EncryptedStorage
|
||||||
|
import com.github.nullptroma.wallenc.domain.datatypes.EncryptKey
|
||||||
import com.github.nullptroma.wallenc.domain.encrypt.Encryptor
|
import com.github.nullptroma.wallenc.domain.encrypt.Encryptor
|
||||||
import com.github.nullptroma.wallenc.domain.interfaces.IStorage
|
import com.github.nullptroma.wallenc.domain.interfaces.IStorage
|
||||||
import com.github.nullptroma.wallenc.domain.interfaces.IUnlockManager
|
import com.github.nullptroma.wallenc.domain.interfaces.IUnlockManager
|
||||||
@@ -12,7 +12,6 @@ import kotlinx.coroutines.CoroutineDispatcher
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ class LocalStorageAccessor(
|
|||||||
return@withContext listOf()
|
return@withContext listOf()
|
||||||
|
|
||||||
val list = mutableListOf<IFile>()
|
val list = mutableListOf<IFile>()
|
||||||
scanStorage(baseStoragePath = path, maxDepth = 0, fileCallback = { _, CommonFile ->
|
scanStorage(baseStoragePath = path, maxDepth = 0, fileCallback = { _, commonFile ->
|
||||||
list.add(CommonFile)
|
list.add(commonFile)
|
||||||
})
|
})
|
||||||
return@withContext list
|
return@withContext list
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ class LocalStorageAccessor(
|
|||||||
|
|
||||||
val buf = mutableListOf<IFile>()
|
val buf = mutableListOf<IFile>()
|
||||||
var pageNumber = 0
|
var pageNumber = 0
|
||||||
scanStorage(baseStoragePath = path, maxDepth = 0, fileCallback = { _, CommonFile ->
|
scanStorage(baseStoragePath = path, maxDepth = 0, fileCallback = { _, commonFile ->
|
||||||
if (buf.size == DATA_PAGE_LENGTH) {
|
if (buf.size == DATA_PAGE_LENGTH) {
|
||||||
val page = DataPage(
|
val page = DataPage(
|
||||||
list = buf.toList(),
|
list = buf.toList(),
|
||||||
@@ -316,7 +316,7 @@ class LocalStorageAccessor(
|
|||||||
emit(page)
|
emit(page)
|
||||||
buf.clear()
|
buf.clear()
|
||||||
}
|
}
|
||||||
buf.add(CommonFile)
|
buf.add(commonFile)
|
||||||
})
|
})
|
||||||
// отправка последней страницы
|
// отправка последней страницы
|
||||||
val page = DataPage(
|
val page = DataPage(
|
||||||
|
|||||||
@@ -94,11 +94,11 @@ class CloseHandledStreamExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun OutputStream.onClosing(callback: ()->Unit): OutputStream {
|
fun OutputStream.onClosing(callback: ()->Unit): OutputStream {
|
||||||
return CloseHandledOutputStream(this, callback, {})
|
return CloseHandledOutputStream(this, callback) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun InputStream.onClosing(callback: ()->Unit): InputStream {
|
fun InputStream.onClosing(callback: ()->Unit): InputStream {
|
||||||
return CloseHandledInputStream(this, callback, {})
|
return CloseHandledInputStream(this, callback) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -7,22 +7,20 @@ import com.github.nullptroma.wallenc.domain.interfaces.IDirectory
|
|||||||
import com.github.nullptroma.wallenc.domain.interfaces.IFile
|
import com.github.nullptroma.wallenc.domain.interfaces.IFile
|
||||||
import com.github.nullptroma.wallenc.domain.interfaces.ILogger
|
import com.github.nullptroma.wallenc.domain.interfaces.ILogger
|
||||||
import com.github.nullptroma.wallenc.domain.interfaces.IStorageInfo
|
import com.github.nullptroma.wallenc.domain.interfaces.IStorageInfo
|
||||||
|
import com.github.nullptroma.wallenc.domain.tasks.ITaskOrchestrator
|
||||||
|
import com.github.nullptroma.wallenc.domain.tasks.TaskLogLevel
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.GetOpenedStoragesUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.GetOpenedStoragesUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.ManageLocalVaultUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.ManageLocalVaultUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.ManageStoragesEncryptionUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.ManageStoragesEncryptionUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.RemoveStorageUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.RemoveStorageUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.RenameStorageUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.RenameStorageUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.usecases.StorageFileManagementUseCase
|
import com.github.nullptroma.wallenc.domain.usecases.StorageFileManagementUseCase
|
||||||
import com.github.nullptroma.wallenc.domain.tasks.ITaskOrchestrator
|
|
||||||
import com.github.nullptroma.wallenc.domain.tasks.PipelineWork
|
|
||||||
import com.github.nullptroma.wallenc.domain.tasks.TaskLogLevel
|
|
||||||
import com.github.nullptroma.wallenc.presentation.ViewModelBase
|
import com.github.nullptroma.wallenc.presentation.ViewModelBase
|
||||||
import com.github.nullptroma.wallenc.presentation.extensions.toPrintable
|
import com.github.nullptroma.wallenc.presentation.extensions.toPrintable
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.combine
|
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.SharedFlow
|
import kotlinx.coroutines.flow.SharedFlow
|
||||||
|
import kotlinx.coroutines.flow.combine
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.system.measureTimeMillis
|
import kotlin.system.measureTimeMillis
|
||||||
@@ -116,7 +114,7 @@ class LocalVaultViewModel @Inject constructor(
|
|||||||
taskOrchestrator.enqueue(
|
taskOrchestrator.enqueue(
|
||||||
title = "Create storage",
|
title = "Create storage",
|
||||||
requiresForeground = false,
|
requiresForeground = false,
|
||||||
work = PipelineWork { ctx ->
|
work = { ctx ->
|
||||||
ctx.log(TaskLogLevel.Info, "Creating storage…")
|
ctx.log(TaskLogLevel.Info, "Creating storage…")
|
||||||
manageLocalVaultUseCase.createStorage()
|
manageLocalVaultUseCase.createStorage()
|
||||||
ctx.log(TaskLogLevel.Info, "Storage created")
|
ctx.log(TaskLogLevel.Info, "Storage created")
|
||||||
@@ -195,7 +193,7 @@ class LocalVaultViewModel @Inject constructor(
|
|||||||
taskOrchestrator.enqueue(
|
taskOrchestrator.enqueue(
|
||||||
title = "Disable encryption",
|
title = "Disable encryption",
|
||||||
requiresForeground = true,
|
requiresForeground = true,
|
||||||
work = PipelineWork { ctx ->
|
work = { ctx ->
|
||||||
try {
|
try {
|
||||||
ctx.log(TaskLogLevel.Info, "Disabling encryption…")
|
ctx.log(TaskLogLevel.Info, "Disabling encryption…")
|
||||||
manageStoragesEncryptionUseCase.clearAndDisableEncryption(storage) { p ->
|
manageStoragesEncryptionUseCase.clearAndDisableEncryption(storage) { p ->
|
||||||
@@ -221,7 +219,7 @@ class LocalVaultViewModel @Inject constructor(
|
|||||||
taskOrchestrator.enqueue(
|
taskOrchestrator.enqueue(
|
||||||
title = "Remove storage",
|
title = "Remove storage",
|
||||||
requiresForeground = true,
|
requiresForeground = true,
|
||||||
work = PipelineWork { ctx ->
|
work = { ctx ->
|
||||||
try {
|
try {
|
||||||
ctx.log(TaskLogLevel.Info, "Removing storage…")
|
ctx.log(TaskLogLevel.Info, "Removing storage…")
|
||||||
removeStorageUseCase.remove(storage)
|
removeStorageUseCase.remove(storage)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class TaskPipelineViewModel @Inject constructor(
|
|||||||
orchestrator.enqueue(
|
orchestrator.enqueue(
|
||||||
title = "Test task (${safeDurationSec}s)",
|
title = "Test task (${safeDurationSec}s)",
|
||||||
requiresForeground = true,
|
requiresForeground = true,
|
||||||
work = PipelineWork { ctx ->
|
work = { ctx ->
|
||||||
val steps = if (safeDurationSec == 0) 1 else safeDurationSec * 10
|
val steps = if (safeDurationSec == 0) 1 else safeDurationSec * 10
|
||||||
ctx.log(TaskLogLevel.Info, "Test task started for ${safeDurationSec}s")
|
ctx.log(TaskLogLevel.Info, "Test task started for ${safeDurationSec}s")
|
||||||
for (step in 0..steps) {
|
for (step in 0..steps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user