50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
import SwiftUI
|
|
|
|
struct PairingView: View {
|
|
var appState: AppState
|
|
@State private var pairingCode = ""
|
|
@State private var isWaiting = false
|
|
@State private var statusMessage: String?
|
|
|
|
var body: some View {
|
|
VStack(spacing: 24) {
|
|
Image(systemName: "iphone.and.arrow.forward")
|
|
.font(.system(size: 48))
|
|
.foregroundStyle(.blue)
|
|
|
|
Text("Device Pairing")
|
|
.font(.title2.bold())
|
|
|
|
Text("Enter the 8-digit pairing code shown on your other device.")
|
|
.font(.subheadline)
|
|
.foregroundStyle(.secondary)
|
|
.multilineTextAlignment(.center)
|
|
|
|
TextField("Pairing Code", text: $pairingCode)
|
|
.textFieldStyle(.roundedBorder)
|
|
.keyboardType(.numberPad)
|
|
.frame(maxWidth: 200)
|
|
|
|
if let status = statusMessage {
|
|
Text(status)
|
|
.font(.caption)
|
|
.foregroundStyle(status.contains("Error") ? .red : .secondary)
|
|
}
|
|
|
|
if isWaiting {
|
|
ProgressView("Waiting for authorization...")
|
|
}
|
|
|
|
Button("Start Pairing") {
|
|
Task {
|
|
// Pairing implementation would go here
|
|
statusMessage = "Pairing not yet implemented"
|
|
}
|
|
}
|
|
.buttonStyle(.borderedProminent)
|
|
.disabled(pairingCode.count != 8 || isWaiting)
|
|
}
|
|
.padding(32)
|
|
}
|
|
}
|