Files
DigiRadio/Software/APP/igiRadio/igiRadio/Views/RootView.swift
T
micheleandCursor 9ad2e42fe2 Add audio profile presets tab with user-saved profiles and EQ editor.
Replace separate Audio/EQ tabs with a unified profile picker (built-in + local presets), keeping mixer access and applying full profiles to the device.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 17:06:59 +02:00

105 lines
3.2 KiB
Swift

import SwiftUI
struct RootView: View {
@Environment(AppEnvironment.self) private var environment
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
var body: some View {
Group {
if horizontalSizeClass == .regular {
IPadRootView()
} else {
IPhoneRootView()
}
}
.tint(IGITheme.accent)
}
}
private struct IPhoneRootView: View {
@Environment(AppEnvironment.self) private var environment
var body: some View {
TabView {
NavigationStack { HomeView() }
.tabItem { Label("Home", systemImage: "house.fill") }
NavigationStack { FMRadioView() }
.tabItem { Label("FM", systemImage: "dot.radiowaves.left.and.right") }
NavigationStack { DABRadioView() }
.tabItem { Label("DAB", systemImage: "antenna.radiowaves.left.and.right") }
NavigationStack { StreamingView() }
.tabItem { Label("Stream", systemImage: "dot.radiowaves.forward") }
NavigationStack { PresetsView() }
.tabItem { Label("Preset", systemImage: "star.fill") }
NavigationStack { AudioProfilesView() }
.tabItem { Label("Profilo", systemImage: "waveform.path.ecg") }
NavigationStack { SettingsRootView() }
.tabItem { Label("Impostazioni", systemImage: "gearshape.fill") }
}
}
}
private struct IPadRootView: View {
@State private var selection: SidebarItem? = .home
var body: some View {
NavigationSplitView {
List(SidebarItem.allCases, selection: $selection) { item in
NavigationLink(value: item) {
Label(item.title, systemImage: item.systemImage)
}
}
.navigationTitle("igiRadio")
} detail: {
switch selection ?? .home {
case .home: HomeView()
case .fm: FMRadioView()
case .dab: DABRadioView()
case .stream: StreamingView()
case .bluetooth: BluetoothView()
case .audioProfiles: AudioProfilesView()
case .presets: PresetsView()
case .settings: SettingsRootView()
}
}
}
}
enum SidebarItem: String, CaseIterable, Identifiable {
case home, fm, dab, stream, bluetooth, audioProfiles, presets, settings
var id: String { rawValue }
var title: String {
switch self {
case .home: "Home"
case .fm: "FM"
case .dab: "DAB"
case .stream: "Stream"
case .bluetooth: "Bluetooth"
case .audioProfiles: "Profilo audio"
case .presets: "Preset"
case .settings: "Impostazioni"
}
}
var systemImage: String {
switch self {
case .home: "house.fill"
case .fm: "dot.radiowaves.left.and.right"
case .dab: "antenna.radiowaves.left.and.right"
case .stream: "dot.radiowaves.forward"
case .bluetooth: "dot.radiowaves.left.and.right"
case .audioProfiles: "waveform.path.ecg"
case .presets: "star.fill"
case .settings: "gearshape.fill"
}
}
}