[ios] Enabled traffic button

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-10-14 10:54:37 +02:00
parent 2ed9bc1880
commit c9f50cdc72
5 changed files with 38 additions and 6 deletions

View File

@@ -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";

View File

@@ -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";

View File

@@ -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 {

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24128" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="ipad9_7" orientation="landscape" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24063"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -81,26 +81,35 @@
<rect key="frame" x="16" y="58" width="308" height="64"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="g13-pK-Eig" userLabel="Outdoor Button" customClass="BottomMenuLayerButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="102.5" height="64"/>
<rect key="frame" x="0.0" y="0.0" width="1024" height="64"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="onOutdoorButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="UQ2-jj-fPc"/>
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="edA-Mo-3Vx" customClass="BottomMenuLayerButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="102.5" y="0.0" width="103" height="64"/>
<rect key="frame" x="1024" y="0.0" width="1024" height="64"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="onIsoLinesButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="3LS-C2-2Mc"/>
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4US-fZ-cyg" customClass="BottomMenuLayerButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="205.5" y="0.0" width="102.5" height="64"/>
<rect key="frame" x="2048" y="0.0" width="1024" height="64"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="onSubwayButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="xxM-kP-gT1"/>
</connections>
</view>
<view contentMode="scaleToFill" id="95L-lU-yCQ" customClass="BottomMenuLayerButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="-358" y="-352" width="1024" height="768"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<viewLayoutGuide key="safeArea" id="ZQs-ua-gDZ"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="onTrafficButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="tie-i7-JaB"/>
</connections>
</view>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="70" id="d0H-kE-IWx"/>
@@ -144,6 +153,7 @@
<outlet property="isoLinesButton" destination="edA-Mo-3Vx" id="qoC-8w-EqY"/>
<outlet property="outdoorButton" destination="g13-pK-Eig" id="ib1-aw-Qv9"/>
<outlet property="subwayButton" destination="4US-fZ-cyg" id="eQB-HR-Wgl"/>
<outlet property="trafficButton" destination="95L-lU-yCQ" id="O9W-En-8Rc"/>
</connections>
<point key="canvasLocation" x="137.6953125" y="201.953125"/>
</tableViewCell>

View File

@@ -93,7 +93,7 @@
274720472E439DDE00C516DF /* traff_storage.cpp */,
);
name = traffxml;
path = ../../traffxml;
path = ../../libs/traffxml;
sourceTree = "<group>";
};
67BECB831DDA474400FC4E99 /* Frameworks */ = {