Remove some shimmering to make the scrolling performances better

This commit is contained in:
Thomas Ricouard 2023-01-27 16:51:45 +01:00
parent 418e9545ba
commit 42160b08c0
3 changed files with 11 additions and 13 deletions

View file

@ -56,9 +56,6 @@ public struct AvatarView: View {
if let image = state.image { if let image = state.image {
image image
.resizingMode(.aspectFit) .resizingMode(.aspectFit)
} else if state.isLoading {
placeholderView
.shimmering()
} else { } else {
placeholderView placeholderView
} }

View file

@ -3,7 +3,6 @@ import Env
import Models import Models
import Nuke import Nuke
import NukeUI import NukeUI
import Shimmer
import SwiftUI import SwiftUI
public struct StatusMediaPreviewView: View { public struct StatusMediaPreviewView: View {
@ -162,7 +161,6 @@ public struct StatusMediaPreviewView: View {
RoundedRectangle(cornerRadius: 4) RoundedRectangle(cornerRadius: 4)
.fill(Color.gray) .fill(Color.gray)
.frame(width: newSize.width, height: newSize.height) .frame(width: newSize.width, height: newSize.height)
.shimmering()
} }
} }
} else { } else {
@ -176,7 +174,6 @@ public struct StatusMediaPreviewView: View {
RoundedRectangle(cornerRadius: 4) RoundedRectangle(cornerRadius: 4)
.fill(Color.gray) .fill(Color.gray)
.frame(maxHeight: imageMaxHeight) .frame(maxHeight: imageMaxHeight)
.shimmering()
} }
} }
} }

View file

@ -19,6 +19,10 @@ public struct StatusRowView: View {
_viewModel = StateObject(wrappedValue: viewModel) _viewModel = StateObject(wrappedValue: viewModel)
} }
var contextMenu: some View {
StatusRowContextMenu(viewModel: viewModel)
}
public var body: some View { public var body: some View {
if viewModel.isFiltered, let filter = viewModel.filter { if viewModel.isFiltered, let filter = viewModel.filter {
switch filter.filter.filterAction { switch filter.filter.filterAction {
@ -70,13 +74,13 @@ public struct StatusRowView: View {
await viewModel.loadEmbeddedStatus() await viewModel.loadEmbeddedStatus()
} }
} }
if preferences.autoExpandSpoilers == true { if preferences.autoExpandSpoilers == true && viewModel.displaySpoiler {
viewModel.displaySpoiler = false viewModel.displaySpoiler = false
} }
} }
} }
.contextMenu { .contextMenu {
StatusRowContextMenu(viewModel: viewModel) contextMenu
} }
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine) .accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
.accessibilityActions { .accessibilityActions {
@ -97,7 +101,7 @@ public struct StatusRowView: View {
routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id)) routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id))
} }
StatusRowContextMenu(viewModel: viewModel) contextMenu
} }
.background { .background {
Color.clear Color.clear
@ -368,11 +372,11 @@ public struct StatusRowView: View {
@ViewBuilder @ViewBuilder
private func makeCardView(status: AnyStatus) -> some View { private func makeCardView(status: AnyStatus) -> some View {
if let card = status.card, if let card = status.card,
status.content.statusesURLs.isEmpty,
status.mediaAttachments.isEmpty,
!viewModel.isEmbedLoading, !viewModel.isEmbedLoading,
theme.statusDisplayStyle == .large !viewModel.isCompact,
{ theme.statusDisplayStyle == .large,
status.content.statusesURLs.isEmpty,
status.mediaAttachments.isEmpty {
StatusCardView(card: card) StatusCardView(card: card)
} }
} }