From 42160b08c033e72213a0053ee26ec031c8210804 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 27 Jan 2023 16:51:45 +0100 Subject: [PATCH] Remove some shimmering to make the scrolling performances better --- .../DesignSystem/Views/AvatarView.swift | 3 --- .../Status/Row/StatusMediaPreviewView.swift | 3 --- .../Sources/Status/Row/StatusRowView.swift | 18 +++++++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift index a521863c..6c7e7200 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift @@ -56,9 +56,6 @@ public struct AvatarView: View { if let image = state.image { image .resizingMode(.aspectFit) - } else if state.isLoading { - placeholderView - .shimmering() } else { placeholderView } diff --git a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift index 0e19ca98..5fc06382 100644 --- a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift +++ b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift @@ -3,7 +3,6 @@ import Env import Models import Nuke import NukeUI -import Shimmer import SwiftUI public struct StatusMediaPreviewView: View { @@ -162,7 +161,6 @@ public struct StatusMediaPreviewView: View { RoundedRectangle(cornerRadius: 4) .fill(Color.gray) .frame(width: newSize.width, height: newSize.height) - .shimmering() } } } else { @@ -176,7 +174,6 @@ public struct StatusMediaPreviewView: View { RoundedRectangle(cornerRadius: 4) .fill(Color.gray) .frame(maxHeight: imageMaxHeight) - .shimmering() } } } diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index 7d1ebb65..9d12403b 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -19,6 +19,10 @@ public struct StatusRowView: View { _viewModel = StateObject(wrappedValue: viewModel) } + var contextMenu: some View { + StatusRowContextMenu(viewModel: viewModel) + } + public var body: some View { if viewModel.isFiltered, let filter = viewModel.filter { switch filter.filter.filterAction { @@ -70,13 +74,13 @@ public struct StatusRowView: View { await viewModel.loadEmbeddedStatus() } } - if preferences.autoExpandSpoilers == true { + if preferences.autoExpandSpoilers == true && viewModel.displaySpoiler { viewModel.displaySpoiler = false } } } .contextMenu { - StatusRowContextMenu(viewModel: viewModel) + contextMenu } .accessibilityElement(children: viewModel.isFocused ? .contain : .combine) .accessibilityActions { @@ -97,7 +101,7 @@ public struct StatusRowView: View { routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id)) } - StatusRowContextMenu(viewModel: viewModel) + contextMenu } .background { Color.clear @@ -368,11 +372,11 @@ public struct StatusRowView: View { @ViewBuilder private func makeCardView(status: AnyStatus) -> some View { if let card = status.card, - status.content.statusesURLs.isEmpty, - status.mediaAttachments.isEmpty, !viewModel.isEmbedLoading, - theme.statusDisplayStyle == .large - { + !viewModel.isCompact, + theme.statusDisplayStyle == .large, + status.content.statusesURLs.isEmpty, + status.mediaAttachments.isEmpty { StatusCardView(card: card) } }