Skip to content

Commit

Permalink
better names for recently added confirmation callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Oct 29, 2024
1 parent 59638dd commit e97fd50
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deltachat-ios/Controller/ChatListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,15 @@ class ChatListViewController: UITableViewController {
}

// MARK: - alerts
private func showDeleteChatConfirmationAlert(chatId: Int, callback: (() -> Void)? = nil) {
private func showDeleteChatConfirmationAlert(chatId: Int, didDelete: (() -> Void)? = nil) {
let alert = UIAlertController(
title: nil,
message: String.localizedStringWithFormat(String.localized("ask_delete_named_chat"), dcContext.getChat(chatId: chatId).name),
preferredStyle: .safeActionSheet
)
alert.addAction(UIAlertAction(title: String.localized("menu_delete_chat"), style: .destructive, handler: { _ in
self.deleteChat(chatId: chatId, animated: true)
callback?()
didDelete?()
}))
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
Expand Down
4 changes: 2 additions & 2 deletions deltachat-ios/Controller/NewChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ extension NewChatViewController: ContactListDelegate {

// MARK: - alerts
extension NewChatViewController {
private func askToDeleteContact(contactId: Int, indexPath: IndexPath, callback: (() -> Void)? = nil) {
private func askToDeleteContact(contactId: Int, indexPath: IndexPath, didDelete: (() -> Void)? = nil) {
let contact = dcContext.getContact(id: contactId)
let alert = UIAlertController(
title: String.localizedStringWithFormat(String.localized("ask_delete_contact"), contact.nameNAddr),
Expand All @@ -357,7 +357,7 @@ extension NewChatViewController {
)
alert.addAction(UIAlertAction(title: String.localized("delete"), style: .destructive, handler: { [weak self] _ in
self?.deleteContact(contactId: contactId, indexPath: indexPath)
callback?()
didDelete?()
}))
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
present(alert, animated: true, completion: nil)
Expand Down
4 changes: 2 additions & 2 deletions deltachat-ios/Helper/MuteDialog.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

struct MuteDialog {
public static func show(viewController: UIViewController, callback: @escaping (_ duration: Int) -> Void) {
public static func show(viewController: UIViewController, didSelectMute: @escaping (_ duration: Int) -> Void) {
let forever = -1
let options: [(name: String, duration: Int)] = [
("mute_for_one_hour", Time.oneHour),
Expand All @@ -14,7 +14,7 @@ struct MuteDialog {
let alert = UIAlertController(title: String.localized("menu_mute"), message: nil, preferredStyle: .safeActionSheet)
for (name, duration) in options {
alert.addAction(UIAlertAction(title: String.localized(name), style: .default, handler: { _ in
callback(duration)
didSelectMute(duration)
}))
}
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
Expand Down

0 comments on commit e97fd50

Please sign in to comment.