Skip to content

Commit

Permalink
Show contact when tapping on ... contact (#2259)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Aug 11, 2024
1 parent 174f4fb commit 54ca8b8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
14 changes: 14 additions & 0 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@ extension ChatViewController: BaseMessageCellDelegate {
guard let reactions = dcContext.getMessageReactions(messageId: messageIds[indexPath.row]) else { return }

let reactionsOverview = ReactionsOverviewViewController(reactions: reactions, context: dcContext)
reactionsOverview.delegate = self
let navigationController = UINavigationController(rootViewController: reactionsOverview)
if #available(iOS 15.0, *) {
if let sheet = navigationController.sheetPresentationController {
Expand Down Expand Up @@ -2836,3 +2837,16 @@ extension ChatViewController: SendContactViewControllerDelegate {
stageVCard(url: vcardURL)
}
}

// MARK: - ReactionsOverviewViewControllerDelegate

extension ChatViewController: ReactionsOverviewViewControllerDelegate {
func showContact(_ viewController: UIViewController, with contactId: Int) {
// dismiss, but push contact-screen

viewController.dismiss(animated: true)

let contactDetailController = ContactDetailViewController(dcContext: dcContext, contactId: contactId)
navigationController?.pushViewController(contactDetailController, animated: true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class ReactionsOverviewTableViewCell: UITableViewCell {

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

selectionStyle = .none
}

required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
Expand Down
20 changes: 20 additions & 0 deletions deltachat-ios/Chat/Reactions/ReactionsOverviewViewController.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import UIKit
import DcCore

protocol ReactionsOverviewViewControllerDelegate: AnyObject {
func showContact(_ viewController: UIViewController, with contactId: Int)
}

class ReactionsOverviewViewController: UIViewController {

private let tableView: UITableView
private let reactions: DcReactions
private let contactIds: [Int]
private let context: DcContext

weak var delegate: ReactionsOverviewViewControllerDelegate?

init(reactions: DcReactions, context: DcContext) {

self.reactions = reactions
Expand All @@ -24,6 +30,7 @@ class ReactionsOverviewViewController: UIViewController {
setupConstraints()

tableView.dataSource = self
tableView.delegate = self

title = String.localized("reactions")

Expand Down Expand Up @@ -71,3 +78,16 @@ extension ReactionsOverviewViewController: UITableViewDataSource {
return cell
}
}

// MARK: - UITableViewDelegate

extension ReactionsOverviewViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let contactId = contactIds[indexPath.row]

//TODO: Handle me

Check warning on line 89 in deltachat-ios/Chat/Reactions/ReactionsOverviewViewController.swift

View workflow job for this annotation

GitHub Actions / build

Comment Spacing Violation: Prefer at least one space after slashes for comments (comment_spacing)

delegate?.showContact(self, with: contactId)
}
}

0 comments on commit 54ca8b8

Please sign in to comment.