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