diff --git a/Tusker/Views/StatusTableViewCell.swift b/Tusker/Views/StatusTableViewCell.swift index ea5e759a..3b737498 100644 --- a/Tusker/Views/StatusTableViewCell.swift +++ b/Tusker/Views/StatusTableViewCell.swift @@ -31,9 +31,11 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive { @IBOutlet weak var usernameLabel: UILabel! @IBOutlet weak var contentLabel: StatusContentLabel! @IBOutlet weak var avatarImageView: UIImageView! + @IBOutlet weak var reblogLabel: UILabel! var status: Status! var account: Account! + var reblogger: Account? var avatarURL: URL? @@ -42,6 +44,8 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive { displayNameLabel.isUserInteractionEnabled = true usernameLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(accountPressed))) usernameLabel.isUserInteractionEnabled = true + reblogLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(reblogLabelPressed))) + reblogLabel.isUserInteractionEnabled = true avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(accountPressed))) avatarImageView.isUserInteractionEnabled = true avatarImageView.layer.masksToBounds = true @@ -57,8 +61,13 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive { let account: Account if let reblog = status.reblog { account = reblog.account + reblogger = status.account + reblogLabel.isHidden = false + reblogLabel.text = "Reblogged by \(reblogger!.displayName)" } else { account = status.account + reblogLabel.isHidden = true + reblogger = nil } self.account = account @@ -92,6 +101,11 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive { delegate?.selected(account: account) } + @objc func reblogLabelPressed() { + guard let reblogger = reblogger else { return } + delegate?.selected(account: reblogger) + } + func didSelect() { delegate?.selected(status: status) } diff --git a/Tusker/Views/StatusTableViewCell.xib b/Tusker/Views/StatusTableViewCell.xib index 209874ad..ca995e79 100644 --- a/Tusker/Views/StatusTableViewCell.xib +++ b/Tusker/Views/StatusTableViewCell.xib @@ -12,51 +12,73 @@ - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + @@ -64,6 +86,7 @@ +