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 {
image
.resizingMode(.aspectFit)
} else if state.isLoading {
placeholderView
.shimmering()
} else {
placeholderView
}

View file

@ -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()
}
}
}

View file

@ -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)
}
}