More optimizations to StatusRowView

This commit is contained in:
Thomas Ricouard 2023-02-09 12:24:18 +01:00
parent 013410a80e
commit 5b7bfba444
2 changed files with 3 additions and 10 deletions

View file

@ -6,7 +6,6 @@ import SwiftUI
public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher { public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
@EnvironmentObject private var theme: Theme @EnvironmentObject private var theme: Theme
@EnvironmentObject private var routerPath: RouterPath
@ObservedObject private var fetcher: Fetcher @ObservedObject private var fetcher: Fetcher
private let isRemote: Bool private let isRemote: Bool
@ -25,7 +24,6 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
StatusRowView(viewModel: .init(status: status, isCompact: false)) StatusRowView(viewModel: .init(status: status, isCompact: false))
.padding(.horizontal, isEmbdedInList ? 0 : .layoutPadding) .padding(.horizontal, isEmbdedInList ? 0 : .layoutPadding)
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
.id(UUID())
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
.listRowInsets(.init(top: 12, .listRowInsets(.init(top: 12,
leading: .layoutPadding, leading: .layoutPadding,

View file

@ -9,7 +9,6 @@ import SwiftUI
public struct StatusRowView: View { public struct StatusRowView: View {
@Environment(\.redactionReasons) private var reasons @Environment(\.redactionReasons) private var reasons
@EnvironmentObject private var preferences: UserPreferences @EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var account: CurrentAccount
@EnvironmentObject private var theme: Theme @EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client @EnvironmentObject private var client: Client
@EnvironmentObject private var routerPath: RouterPath @EnvironmentObject private var routerPath: RouterPath
@ -169,18 +168,14 @@ public struct StatusRowView: View {
HStack(spacing: 2) { HStack(spacing: 2) {
Image(systemName: "arrow.left.arrow.right.circle.fill") Image(systemName: "arrow.left.arrow.right.circle.fill")
AvatarView(url: viewModel.status.account.avatar, size: .boost) AvatarView(url: viewModel.status.account.avatar, size: .boost)
if viewModel.status.account.url != account.account?.url {
EmojiTextApp(.init(stringValue: viewModel.status.account.safeDisplayName), emojis: viewModel.status.account.emojis) EmojiTextApp(.init(stringValue: viewModel.status.account.safeDisplayName), emojis: viewModel.status.account.emojis)
Text("status.row.was-boosted") Text("status.row.was-boosted")
} else {
Text("status.row.you-boosted")
}
} }
.accessibilityElement() .accessibilityElement()
.accessibilityLabel( .accessibilityLabel(
Text("\(viewModel.status.account.safeDisplayName)") Text("\(viewModel.status.account.safeDisplayName)")
+ Text(" ") + Text(" ")
+ Text(viewModel.status.account.url != account.account?.url ? "status.row.was-boosted" : "status.row.you-boosted") + Text("status.row.was-boosted")
) )
.font(.scaledFootnote) .font(.scaledFootnote)
.foregroundColor(.gray) .foregroundColor(.gray)