Linux + iPhone Continuity / iMessage / SMS
fix(a11y): basic iOS accessibility
Zack Bartel6a95b23814d1
diff --git a/apple/Tether/Views/ClipboardView.swift b/apple/Tether/Views/ClipboardView.swiftindex 8153f9b..31034ee 100644--- a/apple/Tether/Views/ClipboardView.swift+++ b/apple/Tether/Views/ClipboardView.swift@@ -33,6 +33,7 @@ struct ClipboardView: View {Image(systemName: "clipboard").font(.system(size: 48)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("Connect to a device to sync clipboard").font(.subheadline)@@ -83,10 +84,11 @@ struct ClipboardView: View {Image(systemName: "clock.arrow.circlepath").font(.system(size: 32)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("No clipboard activity yet").font(.subheadline)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}.frame(maxWidth: .infinity).padding(.vertical, 40)@@ -107,8 +109,8 @@ struct ClipboardView: View {// MARK: - Componentsprivate func clipboardActionButton(- title: String,- subtitle: String,+ title: LocalizedStringKey,+ subtitle: LocalizedStringKey,icon: String,color: Color,action: @escaping () -> Void@@ -118,6 +120,7 @@ struct ClipboardView: View {Image(systemName: icon).font(.title).foregroundStyle(color)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text(title)@@ -126,7 +129,7 @@ struct ClipboardView: View {Text(subtitle).font(.caption2)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}}.frame(maxWidth: .infinity, alignment: .leading)@@ -146,6 +149,7 @@ struct ClipboardView: View {.foregroundStyle(entry.source.isRemote ? .indigo : .teal).frame(width: 24).padding(.top, 2)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 4) {Text(entry.content)@@ -159,11 +163,12 @@ struct ClipboardView: View {.foregroundStyle(entry.source.isRemote ? .indigo : .teal)Text("·")- .foregroundStyle(.quaternary)+ .foregroundStyle(.secondary)+ .accessibilityHidden(true)Text(entry.timestamp, style: .relative).font(.caption2)- .foregroundStyle(.quaternary)+ .foregroundStyle(.secondary)}}@@ -172,11 +177,13 @@ struct ClipboardView: View {Image(systemName: "doc.on.doc").font(.caption).foregroundStyle(.tertiary)+ .accessibilityHidden(true)}.padding(14).background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 12))}.buttonStyle(.plain)+ .accessibilityHint("Copies to this iPhone's clipboard")}}diff --git a/apple/Tether/Views/Components/ConnectionStatusView.swift b/apple/Tether/Views/Components/ConnectionStatusView.swiftindex 6d8d084..4cf2cda 100644--- a/apple/Tether/Views/Components/ConnectionStatusView.swift+++ b/apple/Tether/Views/Components/ConnectionStatusView.swift@@ -12,12 +12,14 @@ struct ConnectionStatusView: View {let state: AppConnectionState@State private var isPulsing = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {HStack(spacing: 8) {Circle().fill(dotColor).frame(width: 10, height: 10)+ .accessibilityHidden(true).scaleEffect(isPulsing ? 1.3 : 1.0).opacity(isPulsing ? 0.6 : 1.0).animation(@@ -32,7 +34,10 @@ struct ConnectionStatusView: View {.foregroundStyle(.secondary)}.onChange(of: state, initial: true) {- isPulsing = isAnimating+ isPulsing = isAnimating && !reduceMotion+ }+ .onChange(of: reduceMotion) {+ isPulsing = isAnimating && !reduceMotion}}@@ -44,7 +49,7 @@ struct ConnectionStatusView: View {}}- private var statusText: String {+ private var statusText: LocalizedStringKey {switch state {case .connected: "Connected"case .connecting: "Connecting…"diff --git a/apple/Tether/Views/DashboardView.swift b/apple/Tether/Views/DashboardView.swiftindex d33bcaa..577f46b 100644--- a/apple/Tether/Views/DashboardView.swift+++ b/apple/Tether/Views/DashboardView.swift@@ -45,6 +45,7 @@ struct DashboardView: View {Image(systemName: "xmark.circle.fill").foregroundStyle(.secondary)}+ .accessibilityLabel("Disconnect")} else {Button {showManualConnect.toggle()@@ -52,6 +53,7 @@ struct DashboardView: View {Image(systemName: "network").foregroundStyle(.teal)}+ .accessibilityLabel("Connect Manually")}}}@@ -77,6 +79,7 @@ struct DashboardView: View {.foregroundStyle(.white)}.shadow(color: statusAccentColor.opacity(0.4), radius: 12, y: 4)+ .accessibilityHidden(true)VStack(spacing: 6) {if let deviceName = viewModel.connectedDeviceName,@@ -99,7 +102,7 @@ struct DashboardView: View {VStack(spacing: 4) {Text("Your Fingerprint").font(.caption2)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary).textCase(.uppercase)Text(formatFingerprint(viewModel.certificateManager.myFingerprint))@@ -170,7 +173,7 @@ struct DashboardView: View {}private func actionButton(- title: String,+ title: LocalizedStringKey,icon: String,color: Color,action: @escaping () -> Void@@ -180,6 +183,7 @@ struct DashboardView: View {Image(systemName: icon).font(.title2).foregroundStyle(color)+ .accessibilityHidden(true)Text(title).font(.caption.weight(.medium))@@ -214,15 +218,16 @@ struct DashboardView: View {Image(systemName: "radar").font(.system(size: 36)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("Searching for tetherd on your network…").font(.subheadline)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary).multilineTextAlignment(.center)Text("Make sure tetherd is running on your Linux machine.").font(.caption)- .foregroundStyle(.quaternary)+ .foregroundStyle(.secondary).multilineTextAlignment(.center)}.frame(maxWidth: .infinity)@@ -237,6 +242,7 @@ struct DashboardView: View {.font(.title3).foregroundStyle(.teal).frame(width: 36)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text(host.name)@@ -246,7 +252,7 @@ struct DashboardView: View {if !host.fingerprint.isEmpty {Text(formatFingerprint(String(host.fingerprint.prefix(16))) + "…").font(.system(.caption2, design: .monospaced))- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}}@@ -256,11 +262,13 @@ struct DashboardView: View {Image(systemName: "checkmark.shield.fill").foregroundStyle(.green).font(.subheadline)+ .accessibilityLabel("Paired")}Image(systemName: "chevron.right").font(.caption).foregroundStyle(.tertiary)+ .accessibilityHidden(true)}.padding(14).background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 14))diff --git a/apple/Tether/Views/FilesView.swift b/apple/Tether/Views/FilesView.swiftindex 9c22f9e..8e15beb 100644--- a/apple/Tether/Views/FilesView.swift+++ b/apple/Tether/Views/FilesView.swift@@ -36,18 +36,21 @@ struct FilesView: View {Image(systemName: "folder").foregroundStyle(.teal)}+ .accessibilityLabel("Open Received Files")if viewModel.appState == .connected {PhotosPicker(selection: $selectedPhotoItem, matching: .images) {Image(systemName: "photo.on.rectangle").foregroundStyle(.teal)}+ .accessibilityLabel("Send a Photo")Button {showDocumentPicker = true} label: {Image(systemName: "plus.circle.fill").foregroundStyle(.teal)}+ .accessibilityLabel("Send a File")}}}@@ -91,6 +94,7 @@ struct FilesView: View {Image(systemName: "arrow.up.arrow.down").font(.system(size: 48)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("Connect to a device to transfer files").font(.subheadline)@@ -128,6 +132,7 @@ struct FilesView: View {.font(.title3).foregroundStyle(.white)}+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text("Send a File")@@ -144,6 +149,7 @@ struct FilesView: View {Image(systemName: "chevron.right").font(.caption).foregroundStyle(.tertiary)+ .accessibilityHidden(true)}.padding(16).background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))@@ -168,6 +174,7 @@ struct FilesView: View {.font(.title3).foregroundStyle(.white)}+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text("Send a Photo")@@ -184,6 +191,7 @@ struct FilesView: View {Image(systemName: "chevron.right").font(.caption).foregroundStyle(.tertiary)+ .accessibilityHidden(true)}.padding(16).background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))@@ -223,10 +231,11 @@ struct FilesView: View {Image(systemName: "tray").font(.system(size: 32)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("No transfers yet").font(.subheadline)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}.frame(maxWidth: .infinity).padding(.vertical, 40)@@ -245,13 +254,14 @@ struct FilesView: View {.font(.title3).foregroundStyle(transfer.direction == .incoming ? .blue : (isActive ? .teal : .secondary)).frame(width: 32)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 6) {Text(transfer.filename).font(.subheadline.weight(.medium)).lineLimit(1)- Text(transfer.direction == .incoming ? "Incoming to iPhone" : "Outgoing to desktop")+ (transfer.direction == .incoming ? Text("Incoming to iPhone") : Text("Outgoing to desktop")).font(.caption2).foregroundStyle(.secondary)@@ -261,7 +271,7 @@ struct FilesView: View {Text(formatBytes(transfer.bytesTransferred) + " / " + formatBytes(transfer.totalSize)).font(.caption2)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)} else if transfer.failed {Text("Failed").font(.caption)@@ -269,12 +279,13 @@ struct FilesView: View {} else {Text(completedText(for: transfer)).font(.caption)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}}}.padding(14).background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 12))+ .accessibilityElement(children: .combine)if let savedURL = transfer.savedURL, transfer.direction == .incoming, !isActive, !transfer.failed {ShareLink(item: savedURL) {@@ -318,10 +329,10 @@ struct FilesView: View {private func completedText(for transfer: FileTransfer) -> String {if transfer.direction == .incoming {- return "Tap to open • " + formatBytes(transfer.totalSize)+ return String(localized: "Tap to open • \(formatBytes(transfer.totalSize))")}- return "Delivered • " + formatBytes(transfer.totalSize)+ return String(localized: "Delivered • \(formatBytes(transfer.totalSize))")}private func openFilesApp() {diff --git a/apple/Tether/Views/PairingView.swift b/apple/Tether/Views/PairingView.swiftindex 42c134f..5282d46 100644--- a/apple/Tether/Views/PairingView.swift+++ b/apple/Tether/Views/PairingView.swift@@ -12,6 +12,7 @@ struct PairingView: View {@Environment(TetherViewModel.self) private var viewModel@State private var rotationAngle: Double = 0+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {NavigationStack {@@ -37,7 +38,9 @@ struct PairingView: View {.font(.system(size: 36, weight: .medium)).foregroundStyle(.teal)}+ .accessibilityHidden(true).onAppear {+ guard !reduceMotion else { return }withAnimation(.linear(duration: 3).repeatForever(autoreverses: false)) {rotationAngle = 360}@@ -48,9 +51,9 @@ struct PairingView: View {Text("Device Pairing").font(.title2.weight(.bold))- Text(viewModel.pairingStatus.isEmpty- ? "Initiating secure pairing…"- : viewModel.pairingStatus)+ (viewModel.pairingStatus.isEmpty+ ? Text("Initiating secure pairing…")+ : Text(viewModel.pairingStatus)).font(.subheadline).foregroundStyle(.secondary).multilineTextAlignment(.center)@@ -62,7 +65,7 @@ struct PairingView: View {VStack(spacing: 8) {Text("Your Device Fingerprint").font(.caption)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary).textCase(.uppercase)Text(formatFingerprint(viewModel.certificateManager.myFingerprint))diff --git a/apple/Tether/Views/SettingsView.swift b/apple/Tether/Views/SettingsView.swiftindex 9327613..124c6cb 100644--- a/apple/Tether/Views/SettingsView.swift+++ b/apple/Tether/Views/SettingsView.swift@@ -35,6 +35,7 @@ struct SettingsView: View {.font(.body.weight(.medium)).foregroundStyle(.white)}+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {TextField("Device Name", text: Bindable(viewModel.certificateManager).localDeviceName)@@ -72,10 +73,11 @@ struct SettingsView: View {Image(systemName: "shield.slash").font(.title3).foregroundStyle(.tertiary)+ .accessibilityHidden(true)Text("No paired devices").font(.subheadline)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}.padding(.vertical, 20)Spacer()@@ -90,6 +92,7 @@ struct SettingsView: View {.font(.title3).foregroundStyle(.teal).frame(width: 32)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text(name)@@ -97,11 +100,12 @@ struct SettingsView: View {Text(formatFingerprint(String(fingerprint.prefix(16))) + "…").font(.system(.caption2, design: .monospaced))- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}Spacer()}+ .accessibilityElement(children: .combine).swipeActions(edge: .trailing, allowsFullSwipe: true) {Button(role: .destructive) {fingerprintToDelete = fingerprint@@ -128,6 +132,7 @@ struct SettingsView: View {.font(.title3).foregroundStyle(.teal).frame(width: 32)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text("Automatic Clipboard Sync")@@ -135,7 +140,7 @@ struct SettingsView: View {Text("Write remote updates to system pasteboard").font(.caption2)- .foregroundStyle(.tertiary)+ .foregroundStyle(.secondary)}}}diff --git a/apple/TetherShareExtension/ShareViewController.swift b/apple/TetherShareExtension/ShareViewController.swiftindex 651a4ca..af5d2f6 100644--- a/apple/TetherShareExtension/ShareViewController.swift+++ b/apple/TetherShareExtension/ShareViewController.swift@@ -244,6 +244,7 @@ private struct ShareSheetView: View {@State private var resultMessage: String?@State private var didFail = false@State private var progress: (completed: Int, total: Int)?+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {NavigationStack {@@ -277,6 +278,7 @@ private struct ShareSheetView: View {HStack(spacing: 6) {Image(systemName: "bolt.fill").foregroundStyle(.cyan)+ .accessibilityHidden(true)Text("Tether").font(.headline).foregroundStyle(.white)@@ -394,6 +396,7 @@ private struct ShareSheetView: View {Image(systemName: "square.stack.3d.up.fill").font(.largeTitle).foregroundStyle(.purple)+ .accessibilityHidden(true)Text("\(items.count) items").font(.subheadline).foregroundStyle(.white)@@ -435,6 +438,7 @@ private struct ShareSheetView: View {Image(systemName: "doc.fill").font(.largeTitle).foregroundStyle(.purple)+ .accessibilityHidden(true)Text(filename).font(.subheadline).foregroundStyle(.white)@@ -482,7 +486,8 @@ private struct ShareSheetView: View {Image(systemName: failed ? "xmark.circle.fill" : "checkmark.circle.fill").font(.system(size: 48)).foregroundStyle(failed ? .red : .green)- .symbolEffect(.bounce)+ .symbolEffect(.bounce, isActive: !reduceMotion)+ .accessibilityHidden(true)Text(message).multilineTextAlignment(.center).foregroundStyle(.white)@@ -494,8 +499,10 @@ private struct ShareSheetView: View {}}.onAppear {+ // The sheet can close before VoiceOver would reach the message.+ AccessibilityNotification.Announcement(message).post()if !failed {- DispatchQueue.main.asyncAfter(deadline: .now() + 1.4) {+ DispatchQueue.main.asyncAfter(deadline: .now() + (UIAccessibility.isVoiceOverRunning ? 3 : 1.4)) {onComplete()}}@@ -587,7 +594,7 @@ private struct ShareSheetView: View {private struct ActionButton: View {let icon: String- let label: String+ let label: LocalizedStringKeylet subtitle: Stringlet color: Colorlet action: () -> Void@@ -603,6 +610,7 @@ private struct ActionButton: View {.font(.system(size: 20, weight: .semibold)).foregroundStyle(color)}+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 2) {Text(label).font(.body.weight(.semibold))@@ -616,6 +624,7 @@ private struct ActionButton: View {Image(systemName: "chevron.right").font(.caption.weight(.semibold)).foregroundStyle(.tertiary)+ .accessibilityHidden(true)}.padding(.horizontal, 14).padding(.vertical, 12)diff --git a/apple/TetherUITests/TetherUITests.swift b/apple/TetherUITests/TetherUITests.swiftindex f634831..2df354a 100644--- a/apple/TetherUITests/TetherUITests.swift+++ b/apple/TetherUITests/TetherUITests.swift@@ -33,6 +33,18 @@ final class TetherUITests: XCTestCase {// https://developer.apple.com/documentation/xcuiautomation}+ // Icon-only toolbar buttons are findable by their VoiceOver labels.+ @MainActor+ func testIconButtonsHaveAccessibilityLabels() throws {+ let app = XCUIApplication()+ app.launch()++ XCTAssertTrue(app.buttons["Connect Manually"].waitForExistence(timeout: 5))++ app.tabBars.buttons["Files"].tap()+ XCTAssertTrue(app.buttons["Open Received Files"].waitForExistence(timeout: 5))+ }+@MainActorfunc testLaunchPerformance() throws {// This measures how long it takes to launch your application.