improvement(Vault): Clear search query on first back press
This commit is contained in:
parent
54fe90fcc0
commit
f8c77ea34d
|
@ -330,6 +330,24 @@ fun vaultListScreenState(
|
|||
val querySink = mutablePersistedFlow("query") { "" }
|
||||
val queryState = mutableComposeState(querySink)
|
||||
|
||||
// Intercept the back button while the
|
||||
// search query is not empty.
|
||||
interceptBackPress(
|
||||
interceptorFlow = querySink
|
||||
.map { it.isNotEmpty() }
|
||||
.distinctUntilChanged()
|
||||
.map { enabled ->
|
||||
if (enabled) {
|
||||
// lambda
|
||||
{
|
||||
queryState.value = ""
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
val cipherSink = EventFlow<DSecret>()
|
||||
|
||||
val itemSink = mutablePersistedFlow("lole") { "" }
|
||||
|
|
Loading…
Reference in New Issue