From 2d10d367749c253c2be8e9f6d08c8e146c666b06 Mon Sep 17 00:00:00 2001 From: Vladislav Kibenko Date: Wed, 19 Feb 2025 13:30:52 +0500 Subject: [PATCH] Use a proper script to call an event in Mini Apps --- submodules/WebUI/Sources/WebAppWebView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/WebUI/Sources/WebAppWebView.swift b/submodules/WebUI/Sources/WebAppWebView.swift index f1be891cc92..520f6860a57 100644 --- a/submodules/WebUI/Sources/WebAppWebView.swift +++ b/submodules/WebUI/Sources/WebAppWebView.swift @@ -227,7 +227,7 @@ final class WebAppWebView: WKWebView { } func sendEvent(name: String, data: String?) { - let script = "window.TelegramGameProxy.receiveEvent(\"\(name)\", \(data ?? "null"))" + let script = "window.TelegramGameProxy && window.TelegramGameProxy.receiveEvent && window.TelegramGameProxy.receiveEvent(\"\(name)\", \(data ?? "null"))" self.evaluateJavaScript(script, completionHandler: { _, _ in }) }