Skip to content

Commit

Permalink
order webxdc-menu my usage
Browse files Browse the repository at this point in the history
- 'add to widget' is probably less often used than 'show in chat'
- even if not, 'add to widget' is one of the the last items in comparable menus
  • Loading branch information
r10s committed Feb 12, 2025
1 parent b6d4508 commit 4faecf2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions deltachat-ios/Controller/WebxdcViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@ class WebxdcViewController: WebViewViewController {
private func moreButtonMenu() -> UIMenu {
func actions() -> [UIMenuElement] {
var actions = [UIMenuElement]()
actions.append(UIAction(title: String.localized("show_in_chat"), image: UIImage(systemName: "doc.text.magnifyingglass")) { [weak self] _ in
guard let self, let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
let message = dcContext.getMessage(id: self.messageId)
DispatchQueue.main.async {
appDelegate.appCoordinator.showChat(chatId: message.chatId, msgId: message.id, animated: true, clearViewControllerStack: true)
}
})

if #available(iOS 17.0, *), let userDefaults = UserDefaults.shared {
let appsInWidgetsMessageIds = userDefaults.getAppWidgetEntries().compactMap { entry in
switch entry.type {
Expand All @@ -444,13 +452,7 @@ class WebxdcViewController: WebViewViewController {
})
}
}
actions.append(UIAction(title: String.localized("show_in_chat"), image: UIImage(systemName: "doc.text.magnifyingglass")) { [weak self] _ in
guard let self, let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
let message = dcContext.getMessage(id: self.messageId)
DispatchQueue.main.async {
appDelegate.appCoordinator.showChat(chatId: message.chatId, msgId: message.id, animated: true, clearViewControllerStack: true)
}
})

if sourceCodeUrl != nil {
actions.append(UIMenu(options: [.displayInline],
children: [
Expand Down

0 comments on commit 4faecf2

Please sign in to comment.