1
Fork 0

Decode text posts, and don't load empty media urls

This commit is contained in:
redstrate 2020-06-04 06:03:09 -04:00
parent e217fc6215
commit 9e25686cd6
2 changed files with 13 additions and 11 deletions

View file

@ -1,7 +1,7 @@
import Foundation
enum PostType: String, Decodable {
case picture
case text, picture
}
struct Media: Decodable, Identifiable {

View file

@ -38,6 +38,7 @@ struct PostView: View {
VStack {
ForEach(post.media) { media in
if !media.url.isEmpty {
VStack {
RemoteImage(type: .url(URL(string: media.url.encodeUrl()!)!), errorView: { error in
Text(error.localizedDescription)
@ -51,6 +52,7 @@ struct PostView: View {
}
}
}
}
}.frame(maxWidth: .infinity)
}
}