fix: NAS gallery shows backed-up files even when caches are cold

GalleryViewModel.load() now has a three-tier resolution for manifest entries:
  1. statusService.lastManifest — in-memory, freshest
  2. NASManifestCache disk cache — survives restarts
  3. Direct NAS download — fallback when both caches are cold (first launch after install,
     or before BackupStatusService reconcile has completed)

The direct download also populates NASManifestCache so subsequent opens are instant.

Also adds GalleryViewModel.bind(to:connection:) which subscribes to
statusService.$lastManifest and automatically reloads gallery items when
BackupStatusService finishes reconciling — gallery updates without manual pull-to-refresh.

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-17 23:40:18 +03:00
parent 1afcbaff96
commit a98822d7b2
2 changed files with 58 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ struct GalleryView: View {
)
}
.task {
viewModel.bind(to: statusService, connection: store.savedConnection)
await viewModel.load(connection: store.savedConnection, statusService: statusService)
}
.refreshable {