summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-12-20 15:20:36 +0100
committerAndrej Mihajlov <and@mullvad.net>2022-12-20 16:59:43 +0100
commitb8927cb17328cb7479dcd0de25ea71f2d5f96092 (patch)
treeff1e91d17a062e5f9953cc38658aa9de7491a58e /ios
parentd656052cf96755c726ef7ff2bdb3836c759c8b17 (diff)
downloadmullvadvpn-b8927cb17328cb7479dcd0de25ea71f2d5f96092.tar.xz
mullvadvpn-b8927cb17328cb7479dcd0de25ea71f2d5f96092.zip
Connect: refactor
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift15
1 files changed, 7 insertions, 8 deletions
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index 1e4bb4e99a..b4fcafc644 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -368,17 +368,16 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
let markerOffset = locationMarkerOffset()
let region = computeCoordinateRegion(center: coordinate, offset: markerOffset)
- if targetRegion?.isApproximatelyEqualTo(region) ?? false {
+ if let targetRegion = targetRegion, targetRegion.isApproximatelyEqualTo(region) {
if isAnimatingMap {
mapRegionAnimationDidEnd = animationDidEnd
} else {
animationDidEnd?()
}
- return
+ } else {
+ mapRegionAnimationDidEnd = animationDidEnd
+ setMapRegion(region, animated: animated)
}
-
- mapRegionAnimationDidEnd = animationDidEnd
- setMapRegion(region, animated: animated)
}
private func unsetLocation(animated: Bool) {
@@ -390,11 +389,11 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
mapRegionAnimationDidEnd = nil
- if targetRegion?.isApproximatelyEqualTo(region) ?? false {
+ if let targetRegion = targetRegion, targetRegion.isApproximatelyEqualTo(region) {
return
+ } else {
+ setMapRegion(region, animated: animated)
}
-
- setMapRegion(region, animated: animated)
}
private func setMapRegion(_ region: MKCoordinateRegion, animated: Bool) {