Skip to content

Commit

Permalink
can delete for everyone only for self-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Feb 25, 2025
1 parent 403c7e1 commit 0ea9f25
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1298,15 +1298,25 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
}
}

var canDeleteForEveryone = true
for msgId in ids {
if !dcContext.getMessage(id: msgId).isFromCurrentSender {
canDeleteForEveryone = false
break
}
}

let alert = UIAlertController(title: String.localized(stringID: "ask_delete_messages_simple", parameter: ids.count), message: nil, preferredStyle: .safeActionSheet)
alert.addAction(UIAlertAction(title: "Delete for Me", style: .destructive, handler: { _ in
self.dcContext.deleteMessages(msgIds: ids)
deleteInUi(ids: ids)
}))
alert.addAction(UIAlertAction(title: "Delete for Everyone", style: .destructive, handler: { _ in
self.dcContext.sendDeleteRequest(msgIds: ids)
deleteInUi(ids: ids)
}))
if canDeleteForEveryone {
alert.addAction(UIAlertAction(title: "Delete for Everyone", style: .destructive, handler: { _ in
self.dcContext.sendDeleteRequest(msgIds: ids)
deleteInUi(ids: ids)
}))
}
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in
self.dismiss(animated: true, completion: nil)
}))
Expand Down

0 comments on commit 0ea9f25

Please sign in to comment.