damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 8a785559c68673f4b122da83806c15661ed703cc
parent d4c8c15cc3b889baab0efec8848a2f73804a6c11
Author: OlegAba <mail@olegaba.com>
Date:   Sat,  8 Apr 2023 20:12:26 -0400

Fix tap area when mentioning users

Changelog-Fixed: Fix tap area when mentioning users
Closes: #895

Diffstat:
Mdamus/Components/UserView.swift | 24+++++++++++++++++++++++-
Mdamus/Views/FollowingView.swift | 7++-----
Mdamus/Views/Muting/MutelistView.swift | 2+-
Mdamus/Views/Relays/RelayDetailView.swift | 2+-
4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/damus/Components/UserView.swift b/damus/Components/UserView.swift @@ -7,11 +7,34 @@ import SwiftUI +struct UserViewRow: View { + let damus_state: DamusState + let pubkey: String + + @State var navigating: Bool = false + + var body: some View { + let dest = ProfileView(damus_state: damus_state, pubkey: pubkey) + + UserView(damus_state: damus_state, pubkey: pubkey) + .contentShape(Rectangle()) + .background( + NavigationLink(destination: dest, isActive: $navigating) { + EmptyView() + } + ) + .onTapGesture { + navigating = true + } + } +} + struct UserView: View { let damus_state: DamusState let pubkey: String var body: some View { + VStack { HStack { ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles) @@ -28,7 +51,6 @@ struct UserView: View { Spacer() } - Spacer() } } } diff --git a/damus/Views/FollowingView.swift b/damus/Views/FollowingView.swift @@ -21,14 +21,11 @@ struct FollowUserView: View { } HStack { - UserView(damus_state: damus_state, pubkey: target.pubkey) - .contentShape(Rectangle()) - .onTapGesture { - navigating = true - } + UserViewRow(damus_state: damus_state, pubkey: target.pubkey) FollowButtonView(target: target, follows_you: false, follow_state: damus_state.contacts.follow_state(target.pubkey)) } + Spacer() } } diff --git a/damus/Views/Muting/MutelistView.swift b/damus/Views/Muting/MutelistView.swift @@ -37,7 +37,7 @@ struct MutelistView: View { var body: some View { List(users, id: \.self) { pubkey in - UserView(damus_state: damus_state, pubkey: pubkey) + UserViewRow(damus_state: damus_state, pubkey: pubkey) .id(pubkey) .swipeActions { RemoveAction(pubkey: pubkey) diff --git a/damus/Views/Relays/RelayDetailView.swift b/damus/Views/Relays/RelayDetailView.swift @@ -70,7 +70,7 @@ struct RelayDetailView: View { if let pubkey = nip11.pubkey { Section(NSLocalizedString("Admin", comment: "Label to display relay contact user.")) { - UserView(damus_state: state, pubkey: pubkey) + UserViewRow(damus_state: state, pubkey: pubkey) } } Section(NSLocalizedString("Relay", comment: "Label to display relay address.")) {