Files
gart/code/Hex-main/Hex/Features/Settings/SettingsView.swift
T

58 lines
1.5 KiB
Swift
Executable File

import ComposableArchitecture
import HexCore
import Inject
import SwiftUI
struct SettingsView: View {
@ObserveInjection var inject
@Bindable var store: StoreOf<SettingsFeature>
let microphonePermission: PermissionStatus
let accessibilityPermission: PermissionStatus
let inputMonitoringPermission: PermissionStatus
var body: some View {
Form {
if microphonePermission != .granted
|| accessibilityPermission != .granted
|| inputMonitoringPermission != .granted {
PermissionsSectionView(
store: store,
microphonePermission: microphonePermission,
accessibilityPermission: accessibilityPermission,
inputMonitoringPermission: inputMonitoringPermission
)
}
ModelSectionView(store: store, shouldFlash: store.shouldFlashModelSection)
// Only show language picker for WhisperKit models (not Parakeet)
if ParakeetModel(rawValue: store.hexSettings.selectedModel) == nil {
LanguageSectionView(store: store)
}
HotKeySectionView(store: store)
if microphonePermission == .granted {
MicrophoneSelectionSectionView(store: store)
}
SoundSectionView(store: store)
GeneralSectionView(store: store)
HistorySectionView(store: store)
}
.formStyle(.grouped)
.task {
await store.send(.task).finish()
}
.enableInjection()
}
}
// MARK: - Shared Styles
extension Text {
/// Applies caption font with secondary color, commonly used for helper/description text in settings.
func settingsCaption() -> some View {
self.font(.caption).foregroundStyle(.secondary)
}
}