[ios] Display navigation voice and change instructions in settings

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-10-04 17:04:38 +02:00
committed by Yannik Bloscheck
parent 96d51dfcf9
commit 053f35b519
6 changed files with 62 additions and 2 deletions

View File

@@ -4,6 +4,10 @@ import SwiftUI
struct SettingsNavigationView: View {
// MARK: Properties
/// The scene phase of the environment
@Environment(\.scenePhase) private var scenePhase
/// If the perspective view should be used during routing
@State var hasPerspectiveViewWhileRouting: Bool = true
@@ -48,6 +52,10 @@ struct SettingsNavigationView: View {
@State var shouldAvoidStepsWhileRouting: Bool = false
/// A date for forcing a refresh of the view
@State var forceRefreshDate: Date = Date.now
/// The actual view
var body: some View {
List {
@@ -73,6 +81,28 @@ struct SettingsNavigationView: View {
Text("pref_tts_language_title")
}
HStack {
VStack(alignment: .leading) {
Text("voice")
if #available(iOS 26, *) {
Text("voice_explanation")
.font(.footnote)
.foregroundStyle(.secondary)
} else {
Text("voice_explanation_before_version26")
.font(.footnote)
.foregroundStyle(.secondary)
}
}
Spacer()
Text(Settings.voiceForVoiceRouting ?? "unknown")
.foregroundStyle(.secondary)
.id(UUID())
}
Toggle(isOn: $shouldAnnounceStreetnamesWhileVoiceRouting) {
VStack(alignment: .leading) {
Text("pref_tts_street_names_title")
@@ -111,6 +141,7 @@ struct SettingsNavigationView: View {
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
}
}
.id(forceRefreshDate)
Section {
Toggle("avoid_tolls", isOn: $shouldAvoidTollRoadsWhileRouting)
@@ -147,6 +178,9 @@ struct SettingsNavigationView: View {
shouldAvoidMotorwaysWhileRouting = Settings.shouldAvoidMotorwaysWhileRouting
shouldAvoidStepsWhileRouting = Settings.shouldAvoidStepsWhileRouting
}
.onChange(of: scenePhase) { _ in
forceRefreshDate = Date.now
}
.onChange(of: hasPerspectiveViewWhileRouting) { changedHasPerspectiveViewWhileRouting in
Settings.hasPerspectiveViewWhileRouting = changedHasPerspectiveViewWhileRouting
}