diff --git a/WebApp/src/jsMain/kotlin/main.kt b/WebApp/src/jsMain/kotlin/main.kt index e7af166..0088ade 100644 --- a/WebApp/src/jsMain/kotlin/main.kt +++ b/WebApp/src/jsMain/kotlin/main.kt @@ -110,6 +110,32 @@ fun main() { appendText("Alert") } ?: window.alert("Unable to load body") + document.body ?.appendElement("p", {}) + + document.body ?.appendElement("button") { + addEventListener("click", { webApp.requestWriteAccess() }) + appendText("Request write access without callback") + } ?: window.alert("Unable to load body") + + document.body ?.appendElement("button") { + addEventListener("click", { webApp.requestWriteAccess { document.body ?.log("Write access request result: $it") } }) + appendText("Request write access with callback") + } ?: window.alert("Unable to load body") + + document.body ?.appendElement("p", {}) + + document.body ?.appendElement("button") { + addEventListener("click", { webApp.requestContact() }) + appendText("Request contact without callback") + } ?: window.alert("Unable to load body") + + document.body ?.appendElement("button") { + addEventListener("click", { webApp.requestContact { document.body ?.log("Contact request result: $it") } }) + appendText("Request contact with callback") + } ?: window.alert("Unable to load body") + + document.body ?.appendElement("p", {}) + document.body ?.appendElement("button") { addEventListener("click", { webApp.showConfirm( @@ -171,6 +197,12 @@ fun main() { onSettingsButtonClicked { document.body ?.log("Settings button clicked") } + onWriteAccessRequested { + document.body ?.log("Write access request result: $it") + } + onContactRequested { + document.body ?.log("Contact request result: $it") + } } webApp.ready() }.onFailure { diff --git a/gradle.properties b/gradle.properties index 1141fbd..c0bea7a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2g kotlin_version=1.8.22 -telegram_bot_api_version=9.1.2 +telegram_bot_api_version=9.2.0 micro_utils_version=0.19.9 serialization_version=1.5.1 ktor_version=2.3.3