Full SwiftUI app at clients/apple/iOS/VoiceCatiOS.xcodeproj:
- 24 Swift source files: AppState + SessionState (@Observable @MainActor),
AudioSessionManager (AVAudioSession owner + interruption/route handling),
ServerListStore/SavedServer (App Group container + Keychain sharing),
and 14 SwiftUI views covering the full feature set
- NavigationSplitView on iPad, TabView on iPhone (horizontalSizeClass)
- Channel tree via OutlineGroup, user list with context menu admin actions
- PTT via DragGesture(minimumDistance: 0) + @GestureState
- onEvent closures hop to MainActor via Task { @MainActor in ... }
- App Group: group.cat.voice.VoiceCat (shared with future ReplayKit extension)
C ABI: add vc_audio_suspend / vc_audio_resume (AudioEngine::suspend/resume)
called by AudioSessionManager on AVAudioSession interruption events.
XCFramework: add ios-arm64 and ios-arm64-simulator slices to build-xcframework.sh;
Package.swift gains .iOS(.v17) platform; CMakePresets.json adds apple-ios /
apple-ios-sim presets with arm64-ios / arm64-ios-simulator vcpkg triplets.
Verified: xcodebuild -target VoiceCatiOS -sdk iphonesimulator26.5 BUILD SUCCEEDED.
76 lines
3.4 KiB
Swift
76 lines
3.4 KiB
Swift
import SwiftUI
|
|
import VoiceCatCore
|
|
|
|
struct ServerIdentityView: View {
|
|
@Environment(AppState.self) private var appState
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
let identity: PendingIdentity
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: 16) {
|
|
if identity.tofuStatus == .mismatch {
|
|
Label("Server Identity Mismatch", systemImage: "exclamationmark.triangle.fill")
|
|
.font(.headline)
|
|
.foregroundStyle(.red)
|
|
.accessibilityLabel("Warning: server identity mismatch")
|
|
Text("The server's identity has changed since your last connection. This may indicate a man-in-the-middle attack, or that the server was reinstalled. Do NOT accept unless you know why the identity changed.")
|
|
.foregroundStyle(.primary)
|
|
} else {
|
|
Label("New Server Identity", systemImage: "lock.badge.questionmark")
|
|
.font(.headline)
|
|
.accessibilityLabel("New server identity")
|
|
Text("This is the first time you are connecting to this server. Verify the fingerprint below with the server administrator before accepting.")
|
|
.foregroundStyle(.primary)
|
|
}
|
|
|
|
Divider()
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text("Server fingerprint")
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
Text(identity.displayText.isEmpty ? "(not available)" : identity.displayText)
|
|
.font(.system(.caption, design: .monospaced))
|
|
.textSelection(.enabled)
|
|
.accessibilityLabel("Server fingerprint: \(identity.displayText)")
|
|
}
|
|
.padding()
|
|
.background(Color(.secondarySystemBackground), in: RoundedRectangle(cornerRadius: 8))
|
|
|
|
Spacer(minLength: 24)
|
|
|
|
VStack(spacing: 12) {
|
|
Button {
|
|
dismiss()
|
|
appState.confirmServerIdentity(accept: true)
|
|
} label: {
|
|
Text("Accept")
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
.buttonStyle(.borderedProminent)
|
|
.tint(identity.tofuStatus == .mismatch ? .orange : .blue)
|
|
.accessibilityLabel("Accept server identity and continue")
|
|
|
|
Button(role: .destructive) {
|
|
dismiss()
|
|
appState.confirmServerIdentity(accept: false)
|
|
} label: {
|
|
Text("Reject — Disconnect")
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
.buttonStyle(.bordered)
|
|
.accessibilityLabel("Reject server identity and disconnect")
|
|
}
|
|
}
|
|
.padding()
|
|
}
|
|
.navigationTitle("Server Identity")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
.interactiveDismissDisabled()
|
|
}
|
|
}
|