Files
damus/damus/Features/Profile/Views/MaybeAnonPfpView.swift
T
Daniel D’Aquino a09e22df24 Improve streaming interfaces and profile loading logic
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2025-09-24 14:06:11 -07:00

49 lines
1.5 KiB
Swift

//
// MaybeAnonPfpView.swift
// damus
//
// Created by William Casarin on 2023-02-26.
//
import SwiftUI
struct MaybeAnonPfpView: View {
let state: DamusState
let is_anon: Bool
let pubkey: Pubkey
let size: CGFloat
init(state: DamusState, is_anon: Bool, pubkey: Pubkey, size: CGFloat) {
self.state = state
self.is_anon = is_anon
self.pubkey = pubkey
self.size = size
}
var body: some View {
ZStack {
if is_anon {
Image("question")
.resizable()
.font(.largeTitle)
.frame(width: size, height: size)
} else {
ProfilePicView(pubkey: pubkey, size: size, highlight: .none, profiles: state.profiles, disable_animation: state.settings.disable_animation, show_zappability: true, damusState: state)
.onTapGesture {
show_profile_action_sheet_if_enabled(damus_state: state, pubkey: pubkey)
}
.onLongPressGesture(minimumDuration: 0.1) {
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
state.nav.push(route: Route.ProfileByKey(pubkey: pubkey))
}
}
}
}
}
struct MaybeAnonPfpView_Previews: PreviewProvider {
static var previews: some View {
MaybeAnonPfpView(state: test_damus_state, is_anon: true, pubkey: ANON_PUBKEY, size: PFP_SIZE)
}
}