summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-07-27 14:44:52 +0200
committerAndrej Mihajlov <and@mullvad.net>2022-07-27 14:44:52 +0200
commitf40a84d21a31d0edfb144bf7dc45de820d477712 (patch)
tree9c58032e1e70311f850078c3ab0d5b3929fdae13
parent1c773b7dc936d392ee528dd115c650bfe0cea93b (diff)
parent7ed3e3bc1a5c2fd8e19c21a9a751398623b29162 (diff)
downloadmullvadvpn-f40a84d21a31d0edfb144bf7dc45de820d477712.tar.xz
mullvadvpn-f40a84d21a31d0edfb144bf7dc45de820d477712.zip
Merge branch 'connect-force-unwrap'
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift26
1 files changed, 14 insertions, 12 deletions
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index 053dde26a7..d25d5dfd9b 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -25,6 +25,7 @@ protocol ConnectViewControllerDelegate: AnyObject {
class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainment, TunnelObserver {
private static let geoJSONSourceFileName = "countries.geo.json"
+ private static let locationMarkerReuseIdentifier = "location"
weak var delegate: ConnectViewControllerDelegate?
@@ -402,12 +403,11 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if let polygon = overlay as? MKPolygon {
let renderer = MKPolygonRenderer(polygon: polygon)
- renderer.fillColor = UIColor.primaryColor
- renderer.strokeColor = UIColor.secondaryColor
- renderer.lineWidth = 1.0
+ renderer.fillColor = .primaryColor
+ renderer.strokeColor = .secondaryColor
+ renderer.lineWidth = 1
renderer.lineCap = .round
renderer.lineJoin = .round
-
return renderer
}
@@ -415,15 +415,18 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
return CustomOverlayRenderer(overlay: tileOverlay)
}
- fatalError()
+ return MKOverlayRenderer()
}
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation === locationMarker {
- let view = mapView.dequeueReusableAnnotationView(withIdentifier: "location", for: annotation)
+ let view = mapView.dequeueReusableAnnotationView(
+ withIdentifier: Self.locationMarkerReuseIdentifier,
+ for: annotation
+ )
view.isDraggable = false
view.canShowCallout = false
- view.image = self.locationMarkerSecureImage
+ view.image = UIImage(named: "LocationMarkerSecure")
return view
}
return nil
@@ -437,14 +440,13 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
// MARK: - Private
- private var locationMarkerSecureImage: UIImage {
- return UIImage(named: "LocationMarkerSecure")!
- }
-
private func setupMapView() {
contentView.mapView.insetsLayoutMarginsFromSafeArea = false
contentView.mapView.delegate = self
- contentView.mapView.register(MKAnnotationView.self, forAnnotationViewWithReuseIdentifier: "location")
+ contentView.mapView.register(
+ MKAnnotationView.self,
+ forAnnotationViewWithReuseIdentifier: Self.locationMarkerReuseIdentifier
+ )
if #available(iOS 13.0, *) {
// Use dark style for the map to dim the map grid