sealed для IStorageInfo

This commit is contained in:
Roman Pytkov
2025-01-04 03:16:50 +03:00
parent 8302e9442e
commit 72bac5e3da
2 changed files with 4 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ package com.github.nullptroma.wallenc.domain.interfaces
import kotlinx.coroutines.flow.StateFlow
import java.util.UUID
interface IStorageInfo {
sealed interface IStorageInfo {
val size: StateFlow<Long?>
val numberOfFiles: StateFlow<Int?>
val uuid: UUID

View File

@@ -9,9 +9,9 @@ class StorageFileManagementUseCase {
private var _storage: IStorage? = null
fun setStorage(storage: IStorageInfo) {
if(storage !is IStorage)
throw Exception("Cannot manage storage on StorageInfo")
_storage = storage
//if(storage !is IStorage)
// throw Exception("Can not manage storage on StorageInfo")
_storage = storage as IStorage
}
suspend fun getAllFiles(): List<IFile> {