From 220a06211454e7af658eb60fb3d2c7f0cee92f98 Mon Sep 17 00:00:00 2001 From: Jacob Powers Date: Thu, 17 Jul 2025 21:37:49 +0000 Subject: [PATCH] fix labels, toggles, and localize --- Localizable.xcstrings | 105 ++++++++++++++++-- .../Map/MapContent/MeshMapContent.swift | 31 +++--- .../Nodes/Helpers/Map/MapSettingsForm.swift | 38 +------ 3 files changed, 117 insertions(+), 57 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index efff5b5d..61679bf7 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -5814,8 +5814,103 @@ } } }, - "Burning Man Overlays" : { - + "Burning Man" : { + "localizations" : { + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "ברנינג מן" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "バーニングマン" + } + }, + "sr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Бернинг Мен" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "火人节" + } + }, + "zh-Hant-TW" : { + "stringUnit" : { + "state" : "translated", + "value" : "火人節" + } + } + } + }, + "Map Overlays" : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Karten-Overlays" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Superpositions de cartes" + } + }, + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "שכבות מפה" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sovrapposizioni mappa" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "マップオーバーレイ" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nakładki map" + } + }, + "se" : { + "stringUnit" : { + "state" : "translated", + "value" : "Kartöverlägg" + } + }, + "sr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Преклапања мапе" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "地图覆盖层" + } + }, + "zh-Hant-TW" : { + "stringUnit" : { + "state" : "translated", + "value" : "地圖覆蓋層" + } + } + } }, "Button GPIO" : { "localizations" : { @@ -35140,9 +35235,6 @@ } } } - }, - "Street Outlines" : { - }, "Subscribed" : { "localizations" : { @@ -38365,9 +38457,6 @@ } } } - }, - "Trash Fence" : { - }, "Treat double tap on supported accelerometers as a user button press." : { "localizations" : { diff --git a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift index be33b54a..a319085e 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift @@ -30,9 +30,7 @@ struct MeshMapContent: MapContent { @Binding var selectedWaypoint: WaypointEntity? // Burning Man GeoJSON overlays - @AppStorage("burningManShowStreets") private var showStreets = false - @AppStorage("burningManShowToilets") private var showToilets = false - @AppStorage("burningManShowTrashFence") private var showTrashFence = false + @AppStorage("burningManShowAll") private var showBurningMan = false @FetchRequest(fetchRequest: PositionEntity.allPositionsFetchRequest(), animation: .easeIn) var positions: FetchedResults @@ -234,10 +232,11 @@ struct MeshMapContent: MapContent { } /// Burning Man GeoJSON Overlays - if showStreets { - let overlays = GeoJSONOverlayManager.shared.loadOverlays(for: StaticGeoJSONOverlay.streetOutlines) - let identifiableOverlays = overlays.map { IdentifiableOverlay(overlay: $0) } - ForEach(identifiableOverlays) { identifiable in + if showBurningMan { + // Load and display street outlines + let streetOverlays = GeoJSONOverlayManager.shared.loadOverlays(for: .streetOutlines) + let streetIdentifiableOverlays = streetOverlays.map { IdentifiableOverlay(overlay: $0) } + ForEach(streetIdentifiableOverlays) { identifiable in let overlay = identifiable.overlay if let polygon = overlay as? MKPolygon { MapPolygon(polygon) @@ -248,12 +247,11 @@ struct MeshMapContent: MapContent { .stroke(.green.opacity(0.9), lineWidth: 0.8) } } - } - if showToilets { - let overlays = GeoJSONOverlayManager.shared.loadOverlays(for: StaticGeoJSONOverlay.toilets) - let identifiableOverlays = overlays.map { IdentifiableOverlay(overlay: $0) } - ForEach(identifiableOverlays) { identifiable in + // Load and display toilets + let toiletOverlays = GeoJSONOverlayManager.shared.loadOverlays(for: .toilets) + let toiletIdentifiableOverlays = toiletOverlays.map { IdentifiableOverlay(overlay: $0) } + ForEach(toiletIdentifiableOverlays) { identifiable in let overlay = identifiable.overlay if let polygon = overlay as? MKPolygon { MapPolygon(polygon) @@ -261,12 +259,11 @@ struct MeshMapContent: MapContent { .foregroundStyle(.blue.opacity(1.0)) } } - } - if showTrashFence { - let overlays = GeoJSONOverlayManager.shared.loadOverlays(for: StaticGeoJSONOverlay.trashFence) - let identifiableOverlays = overlays.map { IdentifiableOverlay(overlay: $0) } - ForEach(identifiableOverlays) { identifiable in + // Load and display trash fence + let trashFenceOverlays = GeoJSONOverlayManager.shared.loadOverlays(for: .trashFence) + let trashFenceIdentifiableOverlays = trashFenceOverlays.map { IdentifiableOverlay(overlay: $0) } + ForEach(trashFenceIdentifiableOverlays) { identifiable in let overlay = identifiable.overlay if let polyline = overlay as? MKPolyline { MapPolyline(polyline) diff --git a/Meshtastic/Views/Nodes/Helpers/Map/MapSettingsForm.swift b/Meshtastic/Views/Nodes/Helpers/Map/MapSettingsForm.swift index b24c4927..3079a9d9 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/MapSettingsForm.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/MapSettingsForm.swift @@ -116,42 +116,16 @@ struct MapSettingsForm: View { } } - Section(header: Text("Burning Man Overlays")) { + Section(header: Text("Map Overlays")) { Toggle(isOn: Binding( - get: { UserDefaults.standard.bool(forKey: "burningManShowStreets") }, - set: { UserDefaults.standard.set($0, forKey: "burningManShowStreets") } + get: { UserDefaults.standard.bool(forKey: "burningManShowAll") }, + set: { UserDefaults.standard.set($0, forKey: "burningManShowAll") } )) { Label { - Text("Street Outlines") + Text("Burning Man") } icon: { - Image(systemName: "road.lanes") - .foregroundColor(.yellow) - } - } - .tint(.accentColor) - - Toggle(isOn: Binding( - get: { UserDefaults.standard.bool(forKey: "burningManShowToilets") }, - set: { UserDefaults.standard.set($0, forKey: "burningManShowToilets") } - )) { - Label { - Text("Toilets") - } icon: { - Image(systemName: "toilet") - .foregroundColor(.brown) - } - } - .tint(.accentColor) - - Toggle(isOn: Binding( - get: { UserDefaults.standard.bool(forKey: "burningManShowTrashFence") }, - set: { UserDefaults.standard.set($0, forKey: "burningManShowTrashFence") } - )) { - Label { - Text("Trash Fence") - } icon: { - Image(systemName: "fence") - .foregroundColor(.red) + Image(systemName: "flame.fill") + .foregroundColor(.orange) } } .tint(.accentColor)