From 2ee21cc5e125216817925c6556b74ee3be565a02 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sat, 17 Dec 2022 20:30:09 +0400 Subject: [PATCH] Fix web app QR scanner dismissal --- submodules/WebUI/Sources/WebAppController.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index 5db9d3f5b9..7d7b62fcea 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -828,7 +828,11 @@ public final class WebAppController: ViewController, AttachmentContainable { let controller = QrCodeScanScreen(context: self.context, subject: .custom(info: info)) controller.completion = { [weak self] result in if let strongSelf = self { - strongSelf.sendQrCodeScannedEvent(data: result) + if let result = result { + strongSelf.sendQrCodeScannedEvent(data: result) + } else { + strongSelf.sendQrCodeScannerClosedEvent() + } } } self.currentQrCodeScannerScreen = controller @@ -983,7 +987,7 @@ public final class WebAppController: ViewController, AttachmentContainable { self.webView?.sendEvent(name: "qr_text_received", data: paramsString) } - fileprivate func sendQrCodeScannerClosedEvent(data: String?) { + fileprivate func sendQrCodeScannerClosedEvent() { self.webView?.sendEvent(name: "scan_qr_popup_closed", data: nil) }