Skip to content

Commit

Permalink
Implement event to process paste button state
Browse files Browse the repository at this point in the history
  • Loading branch information
Steyrix committed Nov 3, 2023
1 parent 656d466 commit 8d3a211
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MainScreenContract {

data object SwapLanguages : Event()

data object MakePasteAvailable : Event()

data class PasteButtonClick(
val text: String?
) : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class MainScreenViewModel
is MainScreenContract.Event.SwapLanguages -> {
processSwapLanguages()
}
is MainScreenContract.Event.MakePasteAvailable -> {
processMakePasteAvailable()
}
else -> {
// TODO: implement
}
Expand Down Expand Up @@ -79,4 +82,18 @@ class MainScreenViewModel
)
}
}

private fun processMakePasteAvailable() {
setState {
val newPasteButtonState = inputViewState.pasteButtonState.copy(
isVisible = true
)

copy(
inputViewState = inputViewState.copy(
pasteButtonState = newPasteButtonState
)
)
}
}
}

0 comments on commit 8d3a211

Please sign in to comment.