From e4214f78a5fcc250ed25e0509d095ba97760025b Mon Sep 17 00:00:00 2001 From: Gokul <164316875+gokulvenkat243@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:23:07 +0530 Subject: [PATCH] Show profile view when tapped author name in home feed (#1380) Show profile when tap AuthorName --- .../MastodonUI/View/Content/StatusAuthorView.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift index a3e806166a..e460116d02 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift @@ -128,7 +128,7 @@ extension StatusAuthorView { // avatar button avatarButton.addTarget(self, action: #selector(StatusAuthorView.authorAvatarButtonDidPressed(_:)), for: .touchUpInside) - authorNameLabel.isUserInteractionEnabled = false + authorNameLabel.isUserInteractionEnabled = true authorUsernameLabel.isUserInteractionEnabled = false // contentSensitiveeToggleButton @@ -136,6 +136,7 @@ extension StatusAuthorView { // dateLabel dateLabel.isUserInteractionEnabled = false + self.addTapGestureToAuthorName() } } @@ -215,6 +216,10 @@ extension StatusAuthorView { return (menu, accessibilityActions) } + private func addTapGestureToAuthorName() { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(StatusAuthorView.authorNameDidPressed(_:))) + authorNameLabel.addGestureRecognizer(tapGesture) + } } extension StatusAuthorView { @@ -224,6 +229,12 @@ extension StatusAuthorView { statusView.delegate?.statusView(statusView, authorAvatarButtonDidPressed: avatarButton) } + @objc private func authorNameDidPressed(_ sender: UIButton) { + guard let statusView = statusView else { return } + + statusView.delegate?.statusView(statusView, authorAvatarButtonDidPressed: avatarButton) + } + @objc private func contentSensitiveeToggleButtonDidPressed(_ sender: UIButton) { guard let statusView = statusView else { return }