damus

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

commit 95555a801154347178cca35e38d6a65badcb99d0
parent 86be185d2f05a559cada68a096f3f9ea47ad1be1
Author: Nitesh Balusu <niteshbalusu@icloud.com>
Date:   Mon, 26 Dec 2022 11:43:49 -0500

Added ability to zoom profile pic

Closes: #149
Changelog-Added: Added the ability to zoom profile pic on profile page

Diffstat:
Mdamus/Views/ProfilePicView.swift | 9++++-----
Mdamus/Views/ProfileView.swift | 8++++++++
2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/damus/Views/ProfilePicView.swift b/damus/Views/ProfilePicView.swift @@ -34,16 +34,16 @@ func pfp_line_width(_ h: Highlight) -> CGFloat { struct InnerProfilePicView: View { @Environment(\.redactionReasons) private var reasons - + let url: URL? let pubkey: String let size: CGFloat let highlight: Highlight - + var PlaceholderColor: Color { return id_to_color(pubkey) } - + var Placeholder: some View { PlaceholderColor .frame(width: size, height: size) @@ -51,7 +51,7 @@ struct InnerProfilePicView: View { .overlay(Circle().stroke(highlight_color(highlight), lineWidth: pfp_line_width(highlight))) .padding(2) } - + var body: some View { Group { if reasons.isEmpty { @@ -74,7 +74,6 @@ struct InnerProfilePicView: View { .clipShape(Circle()) .overlay(Circle().stroke(highlight_color(highlight), lineWidth: pfp_line_width(highlight))) } - } struct ProfilePicView: View { diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift @@ -113,11 +113,13 @@ struct EditButton: View { struct ProfileView: View { let damus_state: DamusState + let zoom_size: CGFloat = 350 @State private var selected_tab: ProfileTab = .posts @StateObject var profile: ProfileModel @StateObject var followers: FollowersModel @State private var showingEditProfile = false + @State var is_zoomed: Bool = false @Environment(\.dismiss) var dismiss @Environment(\.colorScheme) var colorScheme @@ -160,6 +162,12 @@ struct ProfileView: View { HStack(alignment: .center) { ProfilePicView(pubkey: profile.pubkey, size: PFP_SIZE, highlight: .custom(Color.black, 2), profiles: damus_state.profiles) + .onTapGesture { + is_zoomed.toggle() + } + .sheet(isPresented: $is_zoomed) { + ProfilePicView(pubkey: profile.pubkey, size: zoom_size, highlight: .custom(Color.black, 2), profiles: damus_state.profiles) + } Spacer()