Connect macOS app to backend device bootstrap

This commit is contained in:
diyaa
2026-05-25 16:07:04 +02:00
parent 6d426f2a54
commit 1674174a4e
7 changed files with 724 additions and 44 deletions
@@ -36,28 +36,13 @@ public actor PlaceholderSyncCoordinator: SyncCoordinator {
}
public func performInitialSync() async throws -> SyncResult {
let health = try await apiClient.fetchHealthStatus()
let existingTracks = await store.loadTracks()
let tracks: [LibraryTrack]
if existingTracks.isEmpty {
tracks = [
LibraryTrack(
title: "Velody Placeholder",
artist: "Private Library",
album: "Phase 1",
localFilePath: ""
),
]
await store.replaceTracks(tracks)
} else {
tracks = existingTracks
}
let bootstrap = try await apiClient.fetchSyncBootstrap()
await store.replaceTracks(bootstrap.tracks)
return SyncResult(
statusMessage: "Sync placeholder ready (\(health.databaseStatus)/\(health.storageStatus))",
tracks: tracks,
cursor: SyncCursor(value: "0")
statusMessage: "Sync bootstrap completed. Tracks: \(bootstrap.tracks.count). Next cursor: \(bootstrap.nextCursor.value).",
tracks: bootstrap.tracks,
cursor: bootstrap.nextCursor
)
}
}