From a78224b9653249e85aa37dcaacb6ac7d6ff6b94a Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Fri, 27 Jun 2025 00:15:15 +0200 Subject: [PATCH] Add scheduled messages post alert --- .../Sources/ChatControllerAdminBanUsers.swift | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/submodules/TelegramUI/Sources/ChatControllerAdminBanUsers.swift b/submodules/TelegramUI/Sources/ChatControllerAdminBanUsers.swift index a7280cfbe2..cf28fe7d9a 100644 --- a/submodules/TelegramUI/Sources/ChatControllerAdminBanUsers.swift +++ b/submodules/TelegramUI/Sources/ChatControllerAdminBanUsers.swift @@ -389,6 +389,47 @@ extension ChatControllerImpl { return } + if let message = messages.values.compactMap({ $0 }).first(where: { message in message.attributes.contains(where: { $0 is PublishedSuggestedPostMessageAttribute }) }), let attribute = message.attributes.first(where: { $0 is PublishedSuggestedPostMessageAttribute }) as? PublishedSuggestedPostMessageAttribute { + let commit = { [weak self] in + guard let self else { + return + } + //TODO:localize + let titleString: String + let textString: String + switch attribute.currency { + case .stars: + titleString = "Stars Will Be Lost" + textString = "You won't receive **Stars** for this post if you delete it now. The post must remain visible for at least **24 hours** after publication." + case .ton: + titleString = "TON Will Be Lost" + textString = "You won't receive **TON** for this post if you delete it now. The post must remain visible for at least **24 hours** after publication." + } + self.present(standardTextAlertController( + theme: AlertControllerTheme(presentationData: self.presentationData), + title: titleString, + text: textString, + actions: [ + TextAlertAction(type: .destructiveAction, title: "Delete Anyway", action: { [weak self] in + guard let self else { + return + } + self.beginDeleteMessagesWithUndo(messageIds: messageIds, type: .forEveryone) + }), + TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_Cancel, action: {}) + ], + actionLayout: .vertical, + parseMarkdown: true + ), in: .window(.root)) + } + if let contextController { + contextController.dismiss(completion: commit) + } else { + commit() + } + return + } + let actionSheet = ActionSheetController(presentationData: self.presentationData) var items: [ActionSheetItem] = [] var personalPeerName: String?