9e8135ccec
A 6-agent adversarial audit of the client (11 confirmed of 39 findings, the rest
filtered) drove these:
- fix: SessionAudio ring buffer — guard a write larger than the ring (would push
readIdx past writeIdx and corrupt the buffer; never happens, but guard not corrupt).
- fix: CADisplayLink retain cycle (stage-2 presenter) — a weak-target DisplayLinkProxy
so the view can deallocate (the link retains its target); stage-2 teardown added to
both StreamView/StreamViewController deinits as a safety net.
- fix: GamepadFeedback deinit { flag.stop() } — the drain thread holds the connection
strongly and self weakly, so an abrupt teardown without stop() would leak it.
- refactor: centralize the 12 UserDefaults/@AppStorage key literals (scattered across
8 files) into one DefaultsKey enum — a typo silently splits a setting's reader from
its writer.
- docs: RumbleRenderer @unchecked Sendable invariant; the HID digit-row table; the
stage-2 layer compositing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
1.2 KiB
Swift
24 lines
1.2 KiB
Swift
// One source of truth for the client's UserDefaults / @AppStorage keys. A magic-string key
|
|
// duplicated across a setting's writer (a Settings @AppStorage) and reader (e.g. a stream view
|
|
// reading UserDefaults) splits silently on a typo — the setting just stops taking effect. These
|
|
// live in PunktfunkKit because both the app and the kit's views read them.
|
|
|
|
import Foundation
|
|
|
|
/// Persisted-setting keys. The string VALUES are stable on disk — rename the symbol freely, but
|
|
/// never the string (it would orphan everyone's saved value).
|
|
public enum DefaultsKey {
|
|
public static let streamWidth = "punktfunk.width"
|
|
public static let streamHeight = "punktfunk.height"
|
|
public static let streamHz = "punktfunk.hz"
|
|
public static let compositor = "punktfunk.compositor"
|
|
public static let gamepadType = "punktfunk.gamepadType"
|
|
public static let gamepadID = "punktfunk.gamepadID"
|
|
public static let bitrateKbps = "punktfunk.bitrateKbps"
|
|
public static let micEnabled = "punktfunk.micEnabled"
|
|
public static let speakerUID = "punktfunk.speakerUID"
|
|
public static let micUID = "punktfunk.micUID"
|
|
public static let presenter = "punktfunk.presenter"
|
|
public static let hosts = "punktfunk.hosts"
|
|
}
|