Various fixes

This commit is contained in:
Thomas Ricouard 2023-01-19 08:41:45 +01:00
parent 987a655227
commit 7506c33482
2 changed files with 35 additions and 35 deletions

View file

@ -30,42 +30,40 @@ struct AccountDetailHeaderView: View {
} }
private var headerImageView: some View { private var headerImageView: some View {
GeometryReader { _ in ZStack(alignment: .bottomTrailing) {
ZStack(alignment: .bottomTrailing) { if reasons.contains(.placeholder) {
if reasons.contains(.placeholder) { Rectangle()
Rectangle() .foregroundColor(.gray)
.foregroundColor(.gray)
.frame(height: bannerHeight)
} else {
LazyImage(url: account.header) { state in
if let image = state.image {
image
.resizingMode(.aspectFill)
.overlay(.black.opacity(0.50))
} else if state.isLoading {
Color.gray
.frame(height: bannerHeight)
.shimmering()
} else {
Color.gray
.frame(height: bannerHeight)
}
}
.frame(height: bannerHeight) .frame(height: bannerHeight)
} else {
LazyImage(url: account.header) { state in
if let image = state.image {
image
.resizingMode(.aspectFill)
.overlay(.black.opacity(0.50))
} else if state.isLoading {
Color.gray
.frame(height: bannerHeight)
.shimmering()
} else {
Color.gray
.frame(height: bannerHeight)
}
} }
.frame(height: bannerHeight)
if viewModel.relationship?.followedBy == true { }
Text("Follows You")
.font(.scaledFootnote) if viewModel.relationship?.followedBy == true {
.fontWeight(.semibold) Text("Follows You")
.padding(4) .font(.scaledFootnote)
.background(.ultraThinMaterial) .fontWeight(.semibold)
.cornerRadius(4) .padding(4)
.padding(8) .background(.ultraThinMaterial)
} .cornerRadius(4)
.padding(8)
} }
.background(Color.gray)
} }
.background(Color.gray)
.frame(height: bannerHeight) .frame(height: bannerHeight)
.offset(y: scrollOffset > 0 ? -scrollOffset : 0) .offset(y: scrollOffset > 0 ? -scrollOffset : 0)
.contentShape(Rectangle()) .contentShape(Rectangle())

View file

@ -31,9 +31,11 @@ class NotificationsViewModel: ObservableObject {
@Published var state: State = .loading @Published var state: State = .loading
@Published var selectedType: Models.Notification.NotificationType? { @Published var selectedType: Models.Notification.NotificationType? {
didSet { didSet {
notifications = [] if oldValue != selectedType {
Task { notifications = []
await fetchNotifications() Task {
await fetchNotifications()
}
} }
} }
} }