start updating up to 18.2.0

This commit is contained in:
2024-09-07 02:43:05 +06:00
parent 346755b41c
commit ab362e8c3b
3 changed files with 46 additions and 6 deletions

View File

@@ -182,7 +182,7 @@ fun main() {
val hex = Color.Hex(r, g, b)
webApp.setHeaderColor(hex)
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
textContent = "Header color: ${hex.value.uppercase()} (click to change)"
textContent = "Header color: ${webApp.headerColor ?.uppercase()} (click to change)"
}
addEventListener("click", {
updateHeaderColor()
@@ -192,6 +192,38 @@ fun main() {
document.body ?.appendElement("p", {})
document.body ?.appendElement("button") {
fun updateBackgroundColor() {
val (r, g, b) = Random.nextUBytes(3)
val hex = Color.Hex(r, g, b)
webApp.setBackgroundColor(hex)
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
textContent = "Background color: ${webApp.backgroundColor ?.uppercase()} (click to change)"
}
addEventListener("click", {
updateBackgroundColor()
})
updateBackgroundColor()
} ?: window.alert("Unable to load body")
document.body ?.appendElement("p", {})
document.body ?.appendElement("button") {
fun updateBottomBarColor() {
val (r, g, b) = Random.nextUBytes(3)
val hex = Color.Hex(r, g, b)
webApp.setBottomBarColor(hex)
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
textContent = "Bottom bar color: ${webApp.bottomBarColor ?.uppercase()} (click to change)"
}
addEventListener("click", {
updateBottomBarColor()
})
updateBottomBarColor()
} ?: window.alert("Unable to load body")
document.body ?.appendElement("p", {})
fun Element.updateCloudStorageContent() {
clear()
webApp.cloudStorage.getAll {
@@ -287,6 +319,16 @@ fun main() {
}
show()
}
secondaryButton.apply {
setText("Secondary button")
onClick {
document.body ?.log("Secondary button clicked")
hapticFeedback.notificationOccurred(
HapticFeedbackType.Warning
)
}
show()
}
onSettingsButtonClicked {
document.body ?.log("Settings button clicked")
}