Decode text posts, and don't load empty media urls
This commit is contained in:
parent
e217fc6215
commit
9e25686cd6
2 changed files with 13 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
import Foundation
|
||||
|
||||
enum PostType: String, Decodable {
|
||||
case picture
|
||||
case text, picture
|
||||
}
|
||||
|
||||
struct Media: Decodable, Identifiable {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue