133e25849d
Sources reorganized (client: Home/Session/Settings/Stores/Support/Trust; kit: Audio/Connection/Gamepad/Input/Support/Video/Views) with the big files split along the same seams. The gamepad mode is couch-complete, and now on macOS too (the living-room Mac case), not just iOS/iPadOS: - GamepadSettingsView: a console-style, fully controller-navigable settings screen (X from the launcher) — up/down moves focus, left/right steps values (clamped, boundary thud), A cycles/toggles, B closes; the focused row shows a one-line description. Backed by GamepadMenuList, the vertical sibling of GamepadCarousel, and SettingsOptions — the option lists hoisted out of SettingsView statics and shared by the touch, tvOS and gamepad settings. - GamepadAddHostView + GamepadKeyboard: register a host end to end with a pad — field rows open an on-screen controller keyboard (dpad grid, A types, X backspaces, B done); the launcher carousel ends in an Add Host tile, so the dead-end "add one with touch first" empty state is gone. - Launcher polish: contextual hint bar with the pad's real button glyphs, controller name + battery chip, one shared console chrome. - GamepadScreenBackground: an animated aurora (TimelineView-driven drifting blobs in the brand's violet family, breathing radii, slow hue shift, legibility scrim; freezes under Reduce Motion). Pure SwiftUI on purpose — a .metal library only bundles reliably in one of the two build systems (SPM vs the xcodeproj's synced folders) these sources compile under. - macOS port: settings/add-host/library present as sized sheets (a macOS sheet takes its content's IDEAL size, and the GeometryReader-driven screens collapsed to nothing), NSScreen-based mode lists, scroll indicators .never (the "always show scroll bars" setting overrides .hidden), tray scrims so scrolled rows dim under the pinned title/hints, extra title clearance, and a PUNKTFUNK_FORCE_GAMEPAD_UI=1 dev hook — launcher/settings/add-host/keyboard/ library render-verified live on a real Mac + LAN hosts. - GamepadMenuInput: X button support, and (re)start now snapshots held buttons so a controller handoff press never fires twice (the B that closed the keyboard no longer also cancels the screen underneath). - Cleanups: one "Connection failed" alert in ContentView instead of one per home screen; HostDiscovery.advertises/unsaved shared by both home screens. - host: can_encode_444 stub for the non-Linux/Windows host build (the macOS synthetic-source loopback used by the Swift tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
62 lines
3.1 KiB
Swift
62 lines
3.1 KiB
Swift
import Foundation
|
|
|
|
/// Open-source license / attribution text bundled with PunktfunkKit (see `Resources/`).
|
|
///
|
|
/// Exposed from the kit so the app shell can show an Acknowledgements screen. The text files are
|
|
/// bundled as SwiftPM resources and read via `Bundle.module`, which works both for `swift build`
|
|
/// and for the Xcode app (it links the PunktfunkKit product, so the resource bundle rides along).
|
|
public enum Licenses {
|
|
private static func resource(_ name: String) -> String {
|
|
guard let url = Bundle.module.url(forResource: name, withExtension: "txt"),
|
|
let text = try? String(contentsOf: url, encoding: .utf8)
|
|
else { return "" }
|
|
return text
|
|
}
|
|
|
|
/// punktfunk's own license — MIT OR Apache-2.0, at your option.
|
|
public static var appLicense: String {
|
|
let mit = resource("LICENSE-MIT")
|
|
let apache = resource("LICENSE-APACHE")
|
|
if mit.isEmpty && apache.isEmpty {
|
|
return "punktfunk is licensed under MIT OR Apache-2.0, at your option."
|
|
}
|
|
return "punktfunk is licensed under MIT OR Apache-2.0, at your option.\n\n"
|
|
+ "================================ MIT ================================\n\n"
|
|
+ mit
|
|
+ "\n\n============================== Apache-2.0 ==============================\n\n"
|
|
+ apache
|
|
}
|
|
|
|
/// The bundled brand typeface (Geist Sans + Geist Mono) — SIL Open Font License 1.1. The
|
|
/// license file ships alongside the OTFs in `Resources/Fonts/`, satisfying the OFL's
|
|
/// distribution requirement; this surfaces it in the Acknowledgements screen too.
|
|
public static var fontLicense: String {
|
|
guard let url = Bundle.module.url(
|
|
forResource: "Geist-OFL", withExtension: "txt", subdirectory: "Fonts"),
|
|
let text = try? String(contentsOf: url, encoding: .utf8)
|
|
else { return "" }
|
|
return text
|
|
}
|
|
|
|
/// Third-party software notices for the linked Rust crates (generated by
|
|
/// `scripts/gen-third-party-notices.sh`).
|
|
public static var thirdPartyNotices: String {
|
|
let text = resource("THIRD-PARTY-NOTICES")
|
|
return text.isEmpty ? "Third-party notices unavailable." : text
|
|
}
|
|
|
|
/// `thirdPartyNotices` pre-split into render-sized line chunks. The full notices are ~885 KB /
|
|
/// 16k lines; a single SwiftUI `Text` that large overshoots CoreText/CoreAnimation's max
|
|
/// renderable height — it lays out for ages and draws blank past the limit — so the
|
|
/// Acknowledgements screen renders these chunks in a `LazyVStack` (only on-screen chunks lay
|
|
/// out, and no chunk is tall enough to clip). Split at line boundaries and joined with "\n";
|
|
/// the inter-chunk break is the `LazyVStack` row boundary, so no text is lost. Computed once.
|
|
public static let thirdPartyNoticesChunks: [String] = {
|
|
let lines = thirdPartyNotices.split(separator: "\n", omittingEmptySubsequences: false)
|
|
let chunkSize = 200
|
|
return stride(from: 0, to: lines.count, by: chunkSize).map { start in
|
|
lines[start..<min(start + chunkSize, lines.count)].joined(separator: "\n")
|
|
}
|
|
}()
|
|
}
|