From f3cbfb9ededf4334b2c2d33152649ae89b709e77 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Tue, 3 Sep 2024 15:51:29 +0400 Subject: [PATCH] Fix webapp alert buttons order --- submodules/WebUI/Sources/WebAppController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index 2ec23b4284..3973cf0954 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -992,7 +992,7 @@ public final class WebAppController: ViewController, AttachmentContainable { let title = json["title"] as? String var alertButtons: [TextAlertAction] = [] - for buttonJson in buttons { + for buttonJson in buttons.reversed() { if let button = buttonJson as? [String: Any], let id = button["id"] as? String, let type = button["type"] as? String { let buttonAction = { self.sendAlertButtonEvent(id: id) @@ -1032,6 +1032,7 @@ public final class WebAppController: ViewController, AttachmentContainable { var actionLayout: TextAlertContentActionLayout = .horizontal if alertButtons.count > 2 { actionLayout = .vertical + alertButtons = Array(alertButtons.reversed()) } let alertController = textAlertController(context: self.context, updatedPresentationData: self.controller?.updatedPresentationData, title: title, text: message, actions: alertButtons, actionLayout: actionLayout) alertController.dismissed = { byOutsideTap in