Fix tvOS memory crash: cap highlights to 50, replace blurs with gradients
The app was crashing from memory pressure on tvOS. Three causes fixed: 1. Feed was rendering all 418 highlights at once — capped to 50 items. 2. FeaturedGameCard had 3 blur effects (radius 80-120) on large circles for team color glow — replaced with a single LinearGradient. Same visual effect, fraction of the GPU memory. 3. BroadcastBackground had 3 blurred circles (radius 120-140, 680-900px) rendering on every screen — replaced with RadialGradients which are composited by the GPU natively without offscreen render passes. Also fixed iOS build: replaced tvOS-only font refs (tvSectionTitle, tvBody) with cross-platform equivalents in DashboardView fallback state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,9 @@ struct FeedView: View {
|
||||
.font(DS.Fonts.sectionTitle)
|
||||
#endif
|
||||
.foregroundStyle(DS.Colors.textPrimary)
|
||||
Text("Condensed games, key plays, and fresh clips from the active slate.")
|
||||
.font(DS.Fonts.body)
|
||||
.foregroundStyle(DS.Colors.textSecondary)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
@@ -32,11 +35,13 @@ struct FeedView: View {
|
||||
}
|
||||
}
|
||||
|
||||
overviewChips
|
||||
|
||||
if viewModel.highlights.isEmpty && !viewModel.isLoading {
|
||||
emptyState
|
||||
} else {
|
||||
LazyVStack(spacing: DS.Spacing.cardGap) {
|
||||
ForEach(viewModel.highlights) { item in
|
||||
ForEach(viewModel.highlights.prefix(50)) { item in
|
||||
highlightCard(item)
|
||||
}
|
||||
}
|
||||
@@ -67,6 +72,52 @@ struct FeedView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var overviewChips: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 12) {
|
||||
feedChip(
|
||||
title: "\(viewModel.highlights.count)",
|
||||
label: "Clips",
|
||||
tint: DS.Colors.media
|
||||
)
|
||||
feedChip(
|
||||
title: "\(viewModel.highlights.filter(\.isCondensedGame).count)",
|
||||
label: "Condensed",
|
||||
tint: DS.Colors.interactive
|
||||
)
|
||||
feedChip(
|
||||
title: "\(gamesViewModel.liveGames.count)",
|
||||
label: "Live Games",
|
||||
tint: DS.Colors.live
|
||||
)
|
||||
}
|
||||
}
|
||||
.scrollClipDisabled()
|
||||
}
|
||||
|
||||
private func feedChip(title: String, label: String, tint: Color) -> some View {
|
||||
HStack(spacing: 10) {
|
||||
Text(title)
|
||||
.font(chipValueFont)
|
||||
.foregroundStyle(DS.Colors.textPrimary)
|
||||
.monospacedDigit()
|
||||
|
||||
Text(label)
|
||||
.font(chipLabelFont)
|
||||
.foregroundStyle(tint)
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 12)
|
||||
.background(
|
||||
Capsule()
|
||||
.fill(DS.Colors.panelFillMuted)
|
||||
.overlay {
|
||||
Capsule()
|
||||
.strokeBorder(DS.Colors.panelStroke, lineWidth: 1)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func highlightCard(_ item: HighlightItem) -> some View {
|
||||
Button {
|
||||
@@ -191,6 +242,8 @@ struct FeedView: View {
|
||||
private var headlineFont: Font { .system(size: 24, weight: .semibold) }
|
||||
private var gameTagFont: Font { .system(size: 22, weight: .bold, design: .rounded) }
|
||||
private var badgeFont: Font { .system(size: 18, weight: .bold, design: .rounded) }
|
||||
private var chipValueFont: Font { .system(size: 20, weight: .black, design: .rounded) }
|
||||
private var chipLabelFont: Font { .system(size: 14, weight: .bold, design: .rounded) }
|
||||
#else
|
||||
private var edgeInset: CGFloat { 20 }
|
||||
private var thumbnailWidth: CGFloat { 180 }
|
||||
@@ -202,5 +255,7 @@ struct FeedView: View {
|
||||
private var headlineFont: Font { .system(size: 15, weight: .semibold) }
|
||||
private var gameTagFont: Font { .system(size: 12, weight: .bold, design: .rounded) }
|
||||
private var badgeFont: Font { .system(size: 11, weight: .bold, design: .rounded) }
|
||||
private var chipValueFont: Font { .system(size: 14, weight: .black, design: .rounded) }
|
||||
private var chipLabelFont: Font { .system(size: 10, weight: .bold, design: .rounded) }
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user