- Show BOM button for unsaved loads (no longer requires save first) - Set US fallback affiliate tag for unknown countries - Localize Amazon search queries in all 5 languages (EN/DE/ES/FR/NL) - Add affiliate URL/country fields to SavedBattery model - Auto-detect unit system (imperial for US locale, metric otherwise) - Set charger input voltage based on locale (120V US, 230V EU) - Remove StoreKitManager and CableProPaywallView - Add CLAUDE.md project instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.8 KiB
Swift
77 lines
2.8 KiB
Swift
//
|
|
// SettingsView.swift
|
|
// Cable
|
|
//
|
|
// Created by Stefan Lange-Hegermann on 09.10.25.
|
|
//
|
|
|
|
|
|
import SwiftUI
|
|
|
|
struct SettingsView: View {
|
|
@EnvironmentObject var unitSettings: UnitSystemSettings
|
|
@Environment(\.dismiss) private var dismiss
|
|
@Environment(\.openURL) private var openURL
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
Form {
|
|
Section("Units") {
|
|
Picker("Unit System", selection: $unitSettings.unitSystem) {
|
|
ForEach(UnitSystem.allCases, id: \.self) { system in
|
|
Text(system.displayName).tag(system)
|
|
}
|
|
}
|
|
.pickerStyle(.segmented)
|
|
}
|
|
Section {
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
HStack(spacing: 8) {
|
|
Image(systemName: "exclamationmark.triangle.fill")
|
|
.foregroundColor(.orange)
|
|
.font(.system(size: 18))
|
|
Text("Safety Disclaimer")
|
|
.font(.headline)
|
|
.fontWeight(.semibold)
|
|
}
|
|
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
Text("This application provides electrical calculations for educational and estimation purposes only.")
|
|
.font(.body)
|
|
|
|
Text("Important:")
|
|
.font(.subheadline)
|
|
.fontWeight(.semibold)
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text("• Always consult qualified electricians for actual installations")
|
|
Text("• Follow all local electrical codes and regulations")
|
|
Text("• Electrical work should only be performed by licensed professionals")
|
|
Text("• These calculations may not account for all environmental factors")
|
|
Text("• The app developers assume no liability for electrical installations")
|
|
}
|
|
.font(.caption)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
.padding(.vertical, 8)
|
|
}
|
|
}
|
|
.navigationTitle("Settings")
|
|
.toolbar {
|
|
ToolbarItem(placement: .navigationBarLeading) {
|
|
Button("Close") {
|
|
dismiss()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview("Settings (Default)") {
|
|
let settings = UnitSystemSettings()
|
|
return SettingsView()
|
|
.environmentObject(settings)
|
|
}
|