Files
wristivo/Apps/iPhone/RemoteDemoView.swift
T

68 lines
3.1 KiB
Swift

import SwiftUI
import RemoteCore
/// Foundation UI: intentionally never opens a TV connection.
struct RemoteDemoView: View {
@State private var lastCommand = "Try a button below"
var body: some View {
NavigationStack {
ScrollView {
VStack(spacing: 24) {
VStack(alignment: .leading, spacing: 8) {
Label("Demo mode", systemImage: "play.rectangle")
.font(.headline)
Text("Explore your remote. No television is connected.")
Text("Pairing and wrist movement recognition are still in development.")
.font(.footnote).foregroundStyle(.secondary)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding().background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20))
VStack(spacing: 12) {
commandButton(.up)
HStack(spacing: 16) {
commandButton(.left)
commandButton(.select)
commandButton(.right)
}
commandButton(.down)
}
Text(lastCommand).font(.callout).accessibilityIdentifier("demo.lastCommand")
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())], spacing: 12) {
ForEach([RemoteCommand.back, .home, .volumeDown, .volumeUp, .mute, .playPause], id: \.rawValue) { command in
Button { record(command) } label: {
Label(command.title, systemImage: command.symbol)
.frame(maxWidth: .infinity, minHeight: 44)
}.buttonStyle(.bordered)
}
}
VStack(alignment: .leading, spacing: 8) {
Text("Made for a lighter touch").font(.headline)
Text("The planned watch remote translates deliberate wrist movements into directional presses. Your iPhone will relay commands to a paired TV on your home network.")
Text("Gesture control will require an active watch session and a reachable iPhone.")
.foregroundStyle(.secondary)
}.frame(maxWidth: .infinity, alignment: .leading)
}
.padding().frame(maxWidth: 560)
.frame(maxWidth: .infinity)
}
.navigationTitle("Wristivo")
.tint(.teal)
}
}
private func commandButton(_ command: RemoteCommand) -> some View {
Button { record(command) } label: {
Image(systemName: command.symbol)
.font(.title2).frame(width: 64, height: 56)
}
.buttonStyle(.borderedProminent)
.accessibilityLabel(command.title)
}
private func record(_ command: RemoteCommand) {
lastCommand = "Demo: \(command.title)"
}
}