Add scheduled messages post alert

This commit is contained in:
Isaac 2025-06-27 00:15:15 +02:00
parent 5f207b4231
commit a78224b965

View File

@ -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?