[ios] Adjusted code for consistency

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-07-16 10:47:11 +02:00
committed by Yannik Bloscheck
parent 4fd617684b
commit 93415fe952
8 changed files with 109 additions and 109 deletions

View File

@@ -19,15 +19,15 @@ extension Settings {
var description: String { var description: String {
switch self { switch self {
case .hidden: case .hidden:
return L("disabled") return String(localized: "disabled")
case .help: case .help:
return L("help") return String(localized: "help")
case .addPlace: case .addPlace:
return L("placepage_add_place_button") return String(localized: "placepage_add_place_button")
case .settings: case .settings:
return L("settings") return String(localized: "settings")
case .recordTrack: case .recordTrack:
return L("start_track_recording") return String(localized: "start_track_recording")
} }
} }

View File

@@ -25,7 +25,7 @@ class DownloadMapsViewController: MWMViewController {
@IBOutlet var noMapsContainer: UIView! @IBOutlet var noMapsContainer: UIView!
@IBOutlet var downloadAllViewContainer: UIView! @IBOutlet var downloadAllViewContainer: UIView!
// MARK: - Properties // MARK: Properties
private var searchController = UISearchController(searchResultsController: nil) private var searchController = UISearchController(searchResultsController: nil)
var dataSource: IDownloaderDataSource! var dataSource: IDownloaderDataSource!

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the routing options /// View for the routing options
struct RoutingOptionsView: View { struct RoutingOptionsView: View {
// MARK: - Properties // MARK: Properties
/// The dismiss action of the environment /// The dismiss action of the environment
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the OpenStreetMapp profile /// View for the OpenStreetMapp profile
struct ExistingProfileView: View { struct ExistingProfileView: View {
// MARK: - Properties // MARK: Properties
/// The open url action of the environment /// The open url action of the environment
@Environment(\.openURL) private var openUrl @Environment(\.openURL) private var openUrl

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the OpenStreetMapp profile /// View for the OpenStreetMapp profile
struct NoExistingProfileView: View { struct NoExistingProfileView: View {
// MARK: - Properties // MARK: Properties
/// The open url action of the environment /// The open url action of the environment
@Environment(\.openURL) private var openUrl @Environment(\.openURL) private var openUrl

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the OpenStreetMap profile /// View for the OpenStreetMap profile
struct ProfileView: View { struct ProfileView: View {
// MARK: - Properties // MARK: Properties
/// The dismiss action of the environment /// The dismiss action of the environment
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@@ -26,32 +26,30 @@ struct ProfileView: View {
/// The actual view /// The actual view
var body: some View { var body: some View {
NavigationView { VStack(spacing: 0) {
VStack(spacing: 0) { if isPresentedAsAlert {
if isPresentedAsAlert { Button {
Button { dismiss()
dismiss() } label: {
} label: { Label {
Label { Text("close")
Text("close") } icon: {
} icon: { Image(systemName: "xmark.circle.fill")
Image(systemName: "xmark.circle.fill") .font(.title)
.font(.title)
}
} }
.labelStyle(.iconOnly)
.buttonStyle(PlainButtonStyle())
.foregroundStyle(.primary)
.padding([.top, .leading, .trailing])
.frame(maxWidth: .infinity, alignment: .trailing)
.background(Color(uiColor: .systemGroupedBackground))
} }
.labelStyle(.iconOnly)
.buttonStyle(PlainButtonStyle())
.foregroundStyle(.primary)
.padding([.top, .leading, .trailing])
.frame(maxWidth: .infinity, alignment: .trailing)
.background(Color(uiColor: .systemGroupedBackground))
}
if Profile.isExisting { if Profile.isExisting {
ExistingProfileView(lastUpdated: $lastUpdated, isPresentedAsAlert: isPresentedAsAlert) ExistingProfileView(lastUpdated: $lastUpdated, isPresentedAsAlert: isPresentedAsAlert)
} else { } else {
NoExistingProfileView() NoExistingProfileView()
}
} }
} }
.accentColor(.accent) .accentColor(.accent)
@@ -64,7 +62,11 @@ struct ProfileView: View {
Profile.logout() Profile.logout()
lastUpdated = Date.now lastUpdated = Date.now
} label: { } label: {
Label("osm_profile_logout", systemImage: "rectangle.portrait.and.arrow.forward") if #available(iOS 16, *) {
Label("osm_profile_logout", systemImage: "rectangle.portrait.and.arrow.forward")
} else {
Label("osm_profile_logout", systemImage: "power")
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the navigation settings /// View for the navigation settings
struct SettingsNavigationView: View { struct SettingsNavigationView: View {
// MARK: - Properties // MARK: Properties
/// If the perspective view should be used during routing /// If the perspective view should be used during routing
@State var hasPerspectiveViewWhileRouting: Bool = true @State var hasPerspectiveViewWhileRouting: Bool = true
@@ -46,89 +46,87 @@ struct SettingsNavigationView: View {
/// The actual view /// The actual view
var body: some View { var body: some View {
NavigationView { List {
List { Section {
Section { Toggle("pref_map_3d_title", isOn: $hasPerspectiveViewWhileRouting)
Toggle("pref_map_3d_title", isOn: $hasPerspectiveViewWhileRouting) .tint(.accent)
.tint(.accent)
Toggle("pref_map_auto_zoom", isOn: $hasAutoZoomWhileRouting) Toggle("pref_map_auto_zoom", isOn: $hasAutoZoomWhileRouting)
.tint(.accent) .tint(.accent)
} }
Section { Section {
Toggle("pref_tts_enable_title", isOn: $shouldProvideVoiceRouting) Toggle("pref_tts_enable_title", isOn: $shouldProvideVoiceRouting)
.tint(.accent) .tint(.accent)
if shouldProvideVoiceRouting { if shouldProvideVoiceRouting {
Picker(selection: $selectedLanguageForVoiceRouting) { Picker(selection: $selectedLanguageForVoiceRouting) {
ForEach(Settings.availableLanguagesForVoiceRouting) { languageForVoiceRouting in ForEach(Settings.availableLanguagesForVoiceRouting) { languageForVoiceRouting in
Text(languageForVoiceRouting.localizedName) Text(languageForVoiceRouting.localizedName)
.tag(languageForVoiceRouting.id) .tag(languageForVoiceRouting.id)
}
} label: {
Text("pref_tts_language_title")
} }
} label: {
Text("pref_tts_language_title")
}
Toggle(isOn: $shouldAnnounceStreetnamesWhileVoiceRouting) { Toggle(isOn: $shouldAnnounceStreetnamesWhileVoiceRouting) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("pref_tts_street_names_title") Text("pref_tts_street_names_title")
Text("pref_tts_street_names_description") Text("pref_tts_street_names_description")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
}
}
.tint(.accent)
Picker(selection: $selectedAnnouncingSpeedTrapsWhileVoiceRouting) {
ForEach(Settings.AnnouncingSpeedTrapsWhileVoiceRouting.allCases) { announcingSpeedTrapsWhileVoiceRouting in
Text(announcingSpeedTrapsWhileVoiceRouting.description)
}
} label: {
Text("speedcams_alert_title")
} }
} }
} header: { .tint(.accent)
Text("pref_tts_title")
} footer: { Picker(selection: $selectedAnnouncingSpeedTrapsWhileVoiceRouting) {
if shouldProvideVoiceRouting { ForEach(Settings.AnnouncingSpeedTrapsWhileVoiceRouting.allCases) { announcingSpeedTrapsWhileVoiceRouting in
Button { Text(announcingSpeedTrapsWhileVoiceRouting.description)
Settings.playVoiceRoutingTest()
} label: {
Text("pref_tts_test_voice_title")
.bold()
.lineLimit(1)
.padding(4)
.frame(maxWidth: .infinity)
} }
.buttonStyle(BorderedButtonStyle()) } label: {
.foregroundStyle(.alternativeAccent) Text("speedcams_alert_title")
.padding([.top, .bottom])
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
} }
} }
} header: {
Section { Text("pref_tts_title")
Toggle("avoid_tolls", isOn: $shouldAvoidTollRoadsWhileRouting) } footer: {
.tint(.accent) if shouldProvideVoiceRouting {
Button {
Toggle("avoid_unpaved", isOn: $shouldAvoidUnpavedRoadsWhileRouting) Settings.playVoiceRoutingTest()
.tint(.accent) } label: {
Text("pref_tts_test_voice_title")
Toggle("avoid_ferry", isOn: $shouldAvoidFerriesWhileRouting) .bold()
.tint(.accent) .lineLimit(1)
.padding(4)
Toggle("avoid_motorways", isOn: $shouldAvoidMotorwaysWhileRouting) .frame(maxWidth: .infinity)
.tint(.accent) }
} header: { .buttonStyle(BorderedButtonStyle())
Text("driving_options_title") .foregroundStyle(.alternativeAccent)
.padding([.top, .bottom])
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
} }
} }
Section {
Toggle("avoid_tolls", isOn: $shouldAvoidTollRoadsWhileRouting)
.tint(.accent)
Toggle("avoid_unpaved", isOn: $shouldAvoidUnpavedRoadsWhileRouting)
.tint(.accent)
Toggle("avoid_ferry", isOn: $shouldAvoidFerriesWhileRouting)
.tint(.accent)
Toggle("avoid_motorways", isOn: $shouldAvoidMotorwaysWhileRouting)
.tint(.accent)
} header: {
Text("driving_options_title")
}
} }
.accentColor(.accent) .accentColor(.accent)
.navigationViewStyle(StackNavigationViewStyle()) .navigationViewStyle(StackNavigationViewStyle())
.navigationTitle(String(localized: "prefs_group_route")) .navigationTitle("prefs_group_route")
.onAppear { .onAppear {
hasPerspectiveViewWhileRouting = Settings.hasPerspectiveViewWhileRouting hasPerspectiveViewWhileRouting = Settings.hasPerspectiveViewWhileRouting
hasAutoZoomWhileRouting = Settings.hasAutoZoomWhileRouting hasAutoZoomWhileRouting = Settings.hasAutoZoomWhileRouting

View File

@@ -2,7 +2,7 @@ import SwiftUI
/// View for the settings /// View for the settings
struct SettingsView: View { struct SettingsView: View {
// MARK: - Properties // MARK: Properties
/// The dismiss action of the environment /// The dismiss action of the environment
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@@ -235,7 +235,7 @@ struct SettingsView: View {
Text("enable_logging_warning_message") Text("enable_logging_warning_message")
} }
} }
.navigationTitle(String(localized: "settings")) .navigationTitle("settings")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {
ToolbarItem(placement: .confirmationAction) { ToolbarItem(placement: .confirmationAction) {