mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-09-10 02:39:56 +00:00
improvements according to latest changes
This commit is contained in:
@@ -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"}")
|
||||
|
Reference in New Issue
Block a user