From d4698301ad600daf517a40689cb9df366eca9d8c Mon Sep 17 00:00:00 2001 From: bpavuk Date: Sun, 7 Jul 2024 20:05:24 +0300 Subject: [PATCH] Bot API 7.7 fixed event handler for onScanQRPopupClosed event --- .../src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/EventHandler.kt | 1 + .../src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/EventHandler.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/EventHandler.kt index ae62aaf2b9..584d54221c 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/EventHandler.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/EventHandler.kt @@ -10,3 +10,4 @@ typealias QRTextReceivedEventHandler = WebApp.(String) -> Boolean typealias TextReceivedEventHandler = WebApp.(String) -> Unit typealias WriteAccessRequestedHandler = WebApp.(Boolean) -> Unit typealias ContactRequestedHandler = WebApp.(Boolean) -> Unit +typealias onScanQRPopupClosedHandler = WebApp.() -> Unit diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt index 25cbc020d2..8ef1569ca8 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt @@ -275,7 +275,7 @@ fun WebApp.onContactRequested(eventHandler: ContactRequestedHandler) = onEvent(E /** * @return The callback which should be used in case you want to turn off events handling */ -fun WebApp.onScanQRPopupClosed(eventHandler: EventHandler) = onEvent(EventType.ScanQRPopupClosed, eventHandler) +fun WebApp.onScanQRPopupClosed(eventHandler: onScanQRPopupClosedHandler) = onEvent(EventType.ScanQRPopupClosed, eventHandler) fun WebApp.isInitDataSafe(botToken: String) = TelegramAPIUrlsKeeper(botToken).checkWebAppData( initData,