Fix video autoplay reliability, add shuffle playback, refresh data on appear

- Remove cache expiry on video feed (fetch once, keep for session)
- Add retry logic (3 attempts with backoff) for autoplay resolution
- Replace random video selection with shuffle-bag (no repeats until all played)
- Reload games every time DashboardView appears
- Cache standings per day to avoid redundant fetches

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-30 21:49:54 -05:00
parent fda809fd2f
commit 58e4c36963
3 changed files with 64 additions and 30 deletions

View File

@@ -150,6 +150,7 @@ struct DashboardView: View {
.onAppear {
logDashboard("DashboardView appeared")
viewModel.startAutoRefresh()
Task { await viewModel.loadGames() }
}
.onDisappear {
logDashboard("DashboardView disappeared")
@@ -265,11 +266,20 @@ struct DashboardView: View {
guard selection.broadcast.id == SpecialPlaybackChannelConfig.werkoutNSFWStreamID else {
return nil
}
guard let nextURL = await viewModel.resolveAuthenticatedVideoFeedURL(
feedURL: SpecialPlaybackChannelConfig.werkoutNSFWFeedURL,
headers: SpecialPlaybackChannelConfig.werkoutNSFWHeaders,
excluding: currentURL
) else {
var nextURL: URL?
for attempt in 1...3 {
nextURL = await viewModel.resolveAuthenticatedVideoFeedURL(
feedURL: SpecialPlaybackChannelConfig.werkoutNSFWFeedURL,
headers: SpecialPlaybackChannelConfig.werkoutNSFWHeaders,
excluding: currentURL
)
if nextURL != nil { break }
logDashboard("resolveNextFullScreenSource retry attempt=\(attempt)/3")
if attempt < 3 {
try? await Task.sleep(nanoseconds: UInt64(attempt) * 500_000_000)
}
}
guard let nextURL else {
return nil
}
return SingleStreamPlaybackSource(