Resolved issue where RoboHash image does not appear so the profile button is inaccessible

This commit is contained in:
Sam DuBois
2022-12-17 10:12:32 -07:00
committed by William Casarin
parent 2c44366ca5
commit d1323ea15c

View File

@@ -197,7 +197,13 @@ struct ContentView: View {
let prof_dest = ProfileView(damus_state: damus_state!, profile: profile_model, followers: followers_model)
NavigationLink(destination: prof_dest) {
ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles)
/// Verify that the user has a profile picture, if not display a generic SF Symbol
/// (Resolves an in-app error where ``Robohash`` pictures are not generated so the button dissapears
if let picture = damus_state?.profiles.lookup(id: pubkey)?.picture {
ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles, picture: picture)
} else {
Image(systemName: "person.fill")
}
}
.buttonStyle(PlainButtonStyle())
}