feat(apple/widgets): Dynamic Island rebuild + brand purple everywhere

The widgets rendered system BLUE because Color.brand lived in PunktfunkKit,
which the extension deliberately never links (Rust staticlib) — .tint had
nothing to resolve against. Color.brand moved to PunktfunkShared (Kit
re-exports Shared, every existing use unaffected); the Live Activity and the
Hosts widget now carry the actual brand purple, plus .keylineTint on the
island.

Island layout rebuilt around purpose per surface:
- Expanded: identity leading (brand glyph + host, semibold), elapsed clock
  trailing, game title center; the bottom is ONE row — status dot + stage
  (backgrounded shows the disconnect countdown inline) over a quiet stats
  line (live latency + bitrate, previously collected but never rendered,
  ahead of the mode) with the End button at the trailing edge.
- Compact trailing is the one glanceable number: live latency (green) while
  streaming, the disconnect countdown (orange) while backgrounded, a state
  glyph when reconnecting/ended. Leading/minimal: brand glyph.
- Lock Screen banner adopts the same shared StatusLine/StatsLine pieces so
  both surfaces agree.

PunktfunkWidgetsExtension + iOS + tvOS device builds, swift build/test
(20/20) all green; canvas previews cover every state.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 16:34:33 +02:00
parent 70fd8ac0d3
commit 17302ee811
@@ -0,0 +1,30 @@
// The brand color, in the dependency-free foundation so EVERY process can use it the widget
// extension links PunktfunkShared alone (never PunktfunkKit's Rust staticlib), and before this
// moved here the Live Activity / widgets fell back to `.tint` = system blue.
import SwiftUI
public extension Color {
/// The punktfunk brand purple (the app-icon lens / website `--brand`). Defined explicitly,
/// independent of the asset-catalog accent `Color.accentColor` resolution is environment- and
/// timing-sensitive (it can fall back to system blue), and the brand mark must never drift.
/// Light: #6656F2, Dark: #8678F5 (the lighter violet reads better on dark surfaces).
static let brand: Color = {
#if canImport(UIKit)
return Color(UIColor { traits in
traits.userInterfaceStyle == .dark
? UIColor(red: 0x86 / 255, green: 0x78 / 255, blue: 0xF5 / 255, alpha: 1)
: UIColor(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255, alpha: 1)
})
#elseif canImport(AppKit)
return Color(NSColor(name: nil) { appearance in
appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua
? NSColor(red: 0x86 / 255, green: 0x78 / 255, blue: 0xF5 / 255, alpha: 1)
: NSColor(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255, alpha: 1)
})
#else
// Non-Apple fallback: the light brand value, so all branches agree on a canonical color.
return Color(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255)
#endif
}()
}