Skip to content

Commit

Permalink
use modern UIMenu for 'add as second device'
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Jan 23, 2025
1 parent 216d509 commit 7fb15e9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions deltachat-ios/Controller/QrCodeReaderController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QrCodeReaderController: UIViewController {

private lazy var moreButton: UIBarButtonItem = {
let image = UIImage(systemName: "ellipsis.circle")
return UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(moreButtonPressed))
return UIBarButtonItem(image: image, menu: moreButtonMenu())
}()

private lazy var infoLabel: UILabel = {
Expand Down Expand Up @@ -196,13 +196,13 @@ class QrCodeReaderController: UIViewController {
captureSession.stopRunning()
}

@objc private func moreButtonPressed() {
let alert = UIAlertController(title: title, message: nil, preferredStyle: .safeActionSheet)
alert.addAction(UIAlertAction(title: String.localized("troubleshooting"), style: .default, handler: { _ in
self.navigationController?.pushViewController(HelpViewController(dcContext: DcAccounts.shared.getSelected(), fragment: "#multiclient"), animated: true)
}))
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
@objc private func moreButtonMenu() -> UIMenu {
let actions = [
UIAction(title: String.localized("troubleshooting"), image: UIImage(systemName: "questionmark.circle")) { [weak self] _ in
self?.navigationController?.pushViewController(HelpViewController(dcContext: DcAccounts.shared.getSelected(), fragment: "#multiclient"), animated: true)
},
]
return UIMenu(children: actions)
}
}

Expand Down

0 comments on commit 7fb15e9

Please sign in to comment.