Fix loading images on statuses with blurhash.
This commit is contained in:
parent
4c8670dd77
commit
fc3f00ca86
|
@ -17,12 +17,16 @@ struct UserProfileView: View {
|
|||
@State private var relationship: Relationship? = nil
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
if let account = self.account, let relationship = self.relationship {
|
||||
UserProfileHeader(account: account, relationship: relationship)
|
||||
UserProfileStatuses(accountId: account.id)
|
||||
VStack {
|
||||
if let account = self.account {
|
||||
ScrollView {
|
||||
UserProfileHeader(account: account, relationship: relationship)
|
||||
UserProfileStatuses(accountId: account.id)
|
||||
}
|
||||
} else {
|
||||
Spacer()
|
||||
LoadingIndicator()
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.navigationBarTitle(self.accountDisplayName ?? self.accountUserName)
|
||||
|
|
|
@ -41,11 +41,9 @@ struct ImageRowAsync: View {
|
|||
let uiImage = UIImage(blurHash: blurhash, size: CGSize(width: 32, height: 32)) {
|
||||
Image(uiImage: uiImage)
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
} else {
|
||||
Rectangle()
|
||||
.fill(Color.placeholderText)
|
||||
.scaledToFill()
|
||||
}
|
||||
}
|
||||
.frame(width: self.imageWidth, height: self.imageHeight)
|
||||
|
@ -54,7 +52,6 @@ struct ImageRowAsync: View {
|
|||
.onSuccess { imageResponse in
|
||||
self.recalculateSizeOfDownloadedImage(imageResponse: imageResponse)
|
||||
}
|
||||
.frame(width: self.imageWidth, height: self.imageHeight)
|
||||
|
||||
if let count = attachments.count, count > 1 {
|
||||
BottomRight {
|
||||
|
@ -67,9 +64,12 @@ struct ImageRowAsync: View {
|
|||
}.padding()
|
||||
}
|
||||
}
|
||||
.frame(width: self.imageWidth, height: self.imageHeight)
|
||||
.onAppear {
|
||||
self.recalculateSizeFromMetadata()
|
||||
}
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import MastodonSwift
|
|||
struct UserProfileHeader: View {
|
||||
@EnvironmentObject private var applicationState: ApplicationState
|
||||
@State var account: Account
|
||||
@State var relationship: Relationship
|
||||
@State var relationship: Relationship? = nil
|
||||
|
||||
@State private var isDuringRelationshipAction = false
|
||||
|
||||
|
@ -104,15 +104,15 @@ struct UserProfileHeader: View {
|
|||
.transition(.opacity)
|
||||
} else {
|
||||
HStack {
|
||||
Image(systemName: relationship.following == true ? "person.badge.minus" : "person.badge.plus")
|
||||
Text(relationship.following == true ? "Unfollow" : (relationship.followedBy == true ? "Follow back" : "Follow"))
|
||||
Image(systemName: relationship?.following == true ? "person.badge.minus" : "person.badge.plus")
|
||||
Text(relationship?.following == true ? "Unfollow" : (relationship?.followedBy == true ? "Follow back" : "Follow"))
|
||||
}
|
||||
.transition(.opacity)
|
||||
}
|
||||
}
|
||||
.disabled(isDuringRelationshipAction)
|
||||
.buttonStyle(.borderedProminent)
|
||||
.tint(relationship.following == true ? .dangerColor : .accentColor)
|
||||
.tint(relationship?.following == true ? .dangerColor : .accentColor)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct UserProfileStatuses: View {
|
|||
@State private var statuses: [Status] = []
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack(alignment: .center) {
|
||||
if firstLoadFinished == true {
|
||||
ForEach(self.statuses, id: \.id) { item in
|
||||
NavigationLink(destination: StatusView(statusId: item.id)
|
||||
|
|
Loading…
Reference in New Issue