Files
voice-cat/clients/apple/iOS/VoiceCatiOS/Views/PerUserTuningView.swift
Talon bba605401d
Some checks failed
Build Linux Binaries / linux/amd64 (push) Has been cancelled
Build Linux Binaries / linux/arm64 (push) Has been cancelled
chore: comment cleanup pass ahead of open-sourcing
Removes leftover debug scaffolding (stray Console.WriteLine/NSLog traces,
dead nick_buf_ptr, a no-op --print-config flag now implemented for real),
fixes stale/misleading comments (channel passwords are no longer a "future
M5+" feature, a wrong cross-reference, a stale TlsContext::close() mention,
an incomplete BanRecord::subject_type doc, and a smoke test pointing at a
build/m1-dev preset that no longer exists), strips internal M1-M5 milestone
jargon from comments now that the roadmap is done, trims comments that just
restated the following line, and consolidates a few "why" explanations that
were duplicated 2-3 times in the same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-03 10:20:18 +01:00

71 lines
2.4 KiB
Swift

import SwiftUI
import VoiceCatCore
struct PerUserTuningView: View {
let user: User
@Bindable var session: SessionState
@Environment(\.dismiss) private var dismiss
@State private var gain: Float = 1.0
@State private var muted = false
@State private var noiseReduction = false
private var streamsForUser: [StreamSummary] {
session.client.listUserStreams(user.id)
}
var body: some View {
NavigationStack {
Form {
Section("Volume") {
HStack {
Text("Gain")
Slider(value: $gain, in: 0...4, step: 0.05) { _ in
applyToAllStreams()
}
.accessibilityLabel("Volume gain for \(user.nickname)")
Text(String(format: "%.0f%%", gain * 100))
.monospacedDigit()
.frame(width: 44, alignment: .trailing)
}
Toggle("Mute", isOn: $muted)
.onChange(of: muted) { _, _ in applyToAllStreams() }
.accessibilityLabel("Mute \(user.nickname)")
}
Section("Audio Processing") {
Toggle("Noise Reduction", isOn: $noiseReduction)
.onChange(of: noiseReduction) { _, _ in applyToAllStreams() }
.accessibilityLabel("Noise reduction for \(user.nickname)")
}
}
.navigationTitle(user.nickname)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { dismiss() }
}
}
}
.onAppear {
let streams = streamsForUser
if let first = streams.first {
let (_, state) = session.client.getRemoteStream(userId: user.id, streamId: first.id)
if let s = state {
gain = s.gain
muted = s.muted
noiseReduction = s.noiseReduction
}
}
}
}
private func applyToAllStreams() {
for stream in streamsForUser {
session.client.setRemoteStream(
userId: user.id, streamId: stream.id,
gain: gain, muted: muted, noiseReduction: noiseReduction)
}
}
}