Skip to content

Commit

Permalink
add button to search 'saved messages' directly
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Feb 8, 2025
1 parent 0620f4b commit babb6bb
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
} else if dcChat.isDeviceTalk {
subtitle = String.localized("device_talk_subtitle")
} else if dcChat.isSelfTalk {
subtitle = String.localized("chat_self_talk_subtitle")
subtitle = nil
} else if chatContactIds.count >= 1 {
let dcContact = dcContext.getContact(id: chatContactIds[0])
if dcContact.isBot {
Expand All @@ -900,17 +900,22 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
navigationItem.titleView = titleView
self.navigationItem.setLeftBarButton(nil, animated: true)

if let image = dcChat.profileImage {
initialsBadge.setImage(image)
var rightBarButtonItems = [UIBarButtonItem]()
if !dcChat.isSelfTalk {
if let image = dcChat.profileImage {
initialsBadge.setImage(image)
} else {
initialsBadge.setName(dcChat.name)
initialsBadge.setColor(dcChat.color)
}
let recentlySeen = DcUtils.showRecentlySeen(context: dcContext, chat: dcChat)
initialsBadge.setRecentlySeen(recentlySeen)
rightBarButtonItems.append(badgeItem)
} else {
initialsBadge.setName(dcChat.name)
initialsBadge.setColor(dcChat.color)
let button = UIBarButtonItem(image: UIImage(systemName: "magnifyingglass"), style: .plain, target: self, action: #selector(searchPressed))
rightBarButtonItems.append(button)
}

let recentlySeen = DcUtils.showRecentlySeen(context: dcContext, chat: dcChat)
initialsBadge.setRecentlySeen(recentlySeen)

var rightBarButtonItems = [badgeItem]

if dcChat.isSendingLocations {
rightBarButtonItems.append(locationStreamingItem)
}
Expand Down Expand Up @@ -1201,6 +1206,13 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
}
}

@objc private func searchPressed() {
navigationItem.searchController = self.searchController
DispatchQueue.main.async { [weak self] in
self?.searchController.isActive = true
}
}

private func clipperButtonMenu() -> UIMenu {
return UIMenu(children: [
UIDeferredMenuElement({ [weak self] completion in
Expand Down

0 comments on commit babb6bb

Please sign in to comment.