Skip to content

Commit

Permalink
order webxdc-menu by usage (#2604)
Browse files Browse the repository at this point in the history
* 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

* update CHANGELOG
  • Loading branch information
r10s authored Feb 12, 2025
1 parent b6d4508 commit 5b36141
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Delta Chat iOS Changelog

## Unreleased
2025-02

- Tweak menu order (#2604)


## v1.54.0
2025-02

Expand Down
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 5b36141

Please sign in to comment.