Handle interrupted pairing, artwork retries and revoked access reliably

This commit is contained in:
2026-09-12 21:41:37 +03:00
parent afa771198d
commit c461c26f7f
9 changed files with 411 additions and 46 deletions
+6 -1
View File
@@ -16,7 +16,7 @@ struct ContentView: View {
PlayerView(store: store)
Text(store.connection?.endpoint.host ?? "")
.font(.caption).foregroundStyle(.secondary)
if !store.connected {
if !store.connected && !store.needsPairing {
Button("Подключиться снова") { store.resume() }
}
Button("Забыть компьютер", role: .destructive) { showForget = true }
@@ -24,6 +24,7 @@ struct ContentView: View {
}
if let error = store.error {
Text(error).font(.callout).foregroundStyle(.red).textSelection(.enabled)
Button("Скрыть сообщение") { store.error = nil }.font(.footnote)
}
}.padding(24)
}
@@ -152,6 +153,10 @@ private struct PlayerView: View {
}
}.frame(height: 270).clipShape(RoundedRectangle(cornerRadius: 24))
.accessibilityLabel("Обложка трека")
if let error = store.artworkError {
Text(error).font(.footnote).foregroundStyle(.secondary)
Button("Повторить загрузку обложки") { store.retryArtwork() }.disabled(!store.connected)
}
if let state = store.state {
Text(state.hasSession ? (state.title.isEmpty ? "Без названия" : state.title) : "Откройте плеер на ПК")
.font(.title2.bold()).multilineTextAlignment(.center)