summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-07-08 19:12:41 +0200
committerAndrej Mihajlov <and@mullvad.net>2022-07-12 14:27:57 +0200
commita127de75e33af3bfc42e9e8bf049cb4447430223 (patch)
tree7324ccd52262cd5b4777563cd560e55d757f4517 /ios
parentde8123b6e9c9b436f1d70e83271e4e322ff8238d (diff)
downloadmullvadvpn-a127de75e33af3bfc42e9e8bf049cb4447430223.tar.xz
mullvadvpn-a127de75e33af3bfc42e9e8bf049cb4447430223.zip
Use our own parser for geojson
MKGeoJSONDecoder extracts interior polygons from geojson which does not seem to work properly with map view.
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift12
-rw-r--r--ios/MullvadVPN/GeoJSON.swift22
2 files changed, 3 insertions, 31 deletions
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index b83ae621e2..8673f8a23b 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -383,18 +383,6 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
return renderer
}
- if #available(iOS 13, *) {
- if let multiPolygon = overlay as? MKMultiPolygon {
- let renderer = MKMultiPolygonRenderer(multiPolygon: multiPolygon)
- renderer.fillColor = UIColor.primaryColor
- renderer.strokeColor = UIColor.secondaryColor
- renderer.lineWidth = 1.0
- renderer.lineCap = .round
- renderer.lineJoin = .round
- return renderer
- }
- }
-
if let tileOverlay = overlay as? MKTileOverlay {
return CustomOverlayRenderer(overlay: tileOverlay)
}
diff --git a/ios/MullvadVPN/GeoJSON.swift b/ios/MullvadVPN/GeoJSON.swift
index 4b3f8c7c28..cbc9c9f3b9 100644
--- a/ios/MullvadVPN/GeoJSON.swift
+++ b/ios/MullvadVPN/GeoJSON.swift
@@ -142,24 +142,8 @@ extension GeoJSON {
}
static func decodeGeoJSON(_ data: Data) throws -> [MKOverlay] {
- if #available(iOS 13, *) {
- let decoder = MKGeoJSONDecoder()
- let geoJSONObjects = try decoder.decode(data)
-
- return geoJSONObjects.flatMap { (object) -> [MKOverlay] in
- if let feat = object as? MKGeoJSONFeature {
- return feat.geometry.compactMap { (geometry) -> MKOverlay? in
- return geometry as? MKOverlay
- }
- } else {
- return []
- }
- }
- } else {
- let jsonDecoder = JSONDecoder()
- let featureCollection = try jsonDecoder.decode(GeoJSON.FeatureCollection.self, from: data)
-
- return featureCollection.mkOverlays
- }
+ return try JSONDecoder()
+ .decode(GeoJSON.FeatureCollection.self, from: data)
+ .mkOverlays
}
}