From c9f50cdc72cc6a4d294c5b6af28921aebf0562b5 Mon Sep 17 00:00:00 2001 From: Yannik Bloscheck Date: Tue, 14 Oct 2025 10:54:37 +0200 Subject: [PATCH] [ios] Enabled traffic button Signed-off-by: Yannik Bloscheck --- .../en-GB.lproj/Localizable.strings | 1 + .../en.lproj/Localizable.strings | 1 + .../Menu/Cells/BottomMenuLayersCell.swift | 20 +++++++++++++++++++ .../Menu/Cells/BottomMenuLayersCell.xib | 20 ++++++++++++++----- .../traffxml.xcodeproj/project.pbxproj | 2 +- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings index 9d6942b46..b5d5cfd58 100644 --- a/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings +++ b/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings @@ -811,6 +811,7 @@ "privacy_policy" = "Privacy policy"; "terms_of_use" = "Terms of use"; "button_layer_subway" = "Metro"; +"button_layer_traffic" = "Traffic"; "layers_title" = "Map Styles and Layers"; "subway_data_unavailable" = "Metro map is unavailable"; "title_error_downloading_bookmarks" = "An error occurred"; diff --git a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings index 5a5f26267..840e642c6 100644 --- a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings +++ b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings @@ -833,6 +833,7 @@ "privacy_policy" = "Privacy policy"; "terms_of_use" = "Terms of use"; "button_layer_subway" = "Subway"; +"button_layer_traffic" = "Traffic"; "layers_title" = "Map Styles and Layers"; "subway_data_unavailable" = "Subway map is unavailable"; "title_error_downloading_bookmarks" = "An error occurred"; diff --git a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.swift b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.swift index 704445eda..460b228a6 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.swift @@ -18,6 +18,11 @@ class BottomMenuLayersCell: UITableViewCell { updateOutdoorButton() } } + @IBOutlet private var trafficButton: BottomMenuLayerButton! { + didSet { + updateTrafficButton() + } + } var onClose: (()->())? @@ -32,6 +37,7 @@ class BottomMenuLayersCell: UITableViewCell { outdoorButton.setupWith(image: UIImage(resource: .btnMenuOutdoors), text: L("button_layer_outdoor")) isoLinesButton.setupWith(image: UIImage(resource: .btnMenuIsomaps), text: L("button_layer_isolines")) subwayButton.setupWith(image: UIImage(resource: .btnMenuSubway), text: L("button_layer_subway")) + trafficButton.setupWith(image: UIImage(resource: .btnMenuTraffic), text: L("button_layer_traffic")) } deinit { @@ -56,6 +62,11 @@ class BottomMenuLayersCell: UITableViewCell { let enabled = MapOverlayManager.outdoorEnabled() outdoorButton.setStyleAndApply(styleFor(enabled)) } + + private func updateTrafficButton() { + let enabled = MapOverlayManager.trafficEnabled() + trafficButton.setStyleAndApply(styleFor(enabled)) + } @IBAction func onCloseButtonPressed(_ sender: Any) { onClose?() @@ -75,6 +86,11 @@ class BottomMenuLayersCell: UITableViewCell { let enable = !MapOverlayManager.outdoorEnabled() MapOverlayManager.setOutdoorEnabled(enable) } + + @IBAction func onTrafficButton(_ sender: Any) { + let enable = !MapOverlayManager.trafficEnabled() + MapOverlayManager.setTrafficEnabled(enable) + } } extension BottomMenuLayersCell: MapOverlayManagerObserver { @@ -89,6 +105,10 @@ extension BottomMenuLayersCell: MapOverlayManagerObserver { func onOutdoorStateUpdated() { updateOutdoorButton() } + + func onTrafficStateUpdated() { + updateTrafficButton() + } } private extension BottomMenuLayersCell { diff --git a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.xib b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.xib index 2261721f3..cc71a35e5 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.xib +++ b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuLayersCell.xib @@ -1,9 +1,9 @@ - + - + @@ -81,26 +81,35 @@ - + - + - + + + + + + + + + + @@ -144,6 +153,7 @@ + diff --git a/xcode/traffxml/traffxml.xcodeproj/project.pbxproj b/xcode/traffxml/traffxml.xcodeproj/project.pbxproj index 3e0c759bb..6f731cdd9 100644 --- a/xcode/traffxml/traffxml.xcodeproj/project.pbxproj +++ b/xcode/traffxml/traffxml.xcodeproj/project.pbxproj @@ -93,7 +93,7 @@ 274720472E439DDE00C516DF /* traff_storage.cpp */, ); name = traffxml; - path = ../../traffxml; + path = ../../libs/traffxml; sourceTree = ""; }; 67BECB831DDA474400FC4E99 /* Frameworks */ = {