Skip to content

Commit

Permalink
Update updateDestination
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jul 22, 2024
1 parent a626e43 commit fec00b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ val IconPackDestinationScreen by navDestination<Unit> {

val state by viewModel.state.collectAsState()

val dragAndDropHandler = rememberDragAndDropFolderHandler {
viewModel.updateDestination(it.absolutePathString())
}
val dragAndDropHandler = rememberDragAndDropFolderHandler(onDrop = viewModel::updateDestination)
val isDragging by remember(dragAndDropHandler.isDragging) { mutableStateOf(dragAndDropHandler.isDragging) }

val scope = rememberCoroutineScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import io.github.composegears.valkyrie.settings.InMemorySettings
import io.github.composegears.valkyrie.ui.extension.updateState
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import java.nio.file.Path
import kotlin.io.path.absolutePathString

class IconPackDestinationViewModel(
private val inMemorySettings: InMemorySettings
Expand All @@ -20,10 +22,10 @@ class IconPackDestinationViewModel(
)
val state = _state.asStateFlow()

fun updateDestination(destination: String) {
fun updateDestination(path: Path) {
_state.updateState {
copy(
iconPackDestination = destination,
iconPackDestination = path.absolutePathString(),
nextButtonEnabled = true
)
}
Expand Down

0 comments on commit fec00b4

Please sign in to comment.