improvements according to latest changes

This commit is contained in:
2025-07-08 18:41:18 +06:00
parent 8d8fa74779
commit d0029603ce
3 changed files with 46 additions and 2 deletions

View File

@@ -163,6 +163,34 @@ fun main() {
Text("Answer in chat button")
}
H3 { Text("Hide keyboard") }
val hideCountdown = remember { mutableStateOf<Int?>(null) }
Button({
onClick {
hideCountdown.value = 5
}
}) {
if (hideCountdown.value == null) {
Text("Hide")
} else {
Text("Hide in ${hideCountdown.value} seconds")
}
}
LaunchedEffect(hideCountdown.value) {
val value = hideCountdown.value
when {
value == null -> return@LaunchedEffect
value > 0 -> {
delay(1000)
hideCountdown.value = hideCountdown.value ?.minus(1)
}
else -> {
webApp.hideKeyboard()
hideCountdown.value = null
}
}
}
P()
H3 { Text("User info") }
Text("Allow to write in private messages: ${webApp.initDataUnsafe.user ?.allowsWriteToPM ?: "User unavailable"}")