From 61fa5c73c56b7b76112c6ee9fcb131be46798f3b Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 12 Feb 2025 10:36:50 +0100 Subject: [PATCH] order webxdc-menu by usage - '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 --- .../Controller/WebxdcViewController.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deltachat-ios/Controller/WebxdcViewController.swift b/deltachat-ios/Controller/WebxdcViewController.swift index 283659b8c..558bf6f2e 100644 --- a/deltachat-ios/Controller/WebxdcViewController.swift +++ b/deltachat-ios/Controller/WebxdcViewController.swift @@ -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 { @@ -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: [