diff options
| -rw-r--r-- | ios/MullvadVPN/ConnectViewController.swift | 15 |
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) { |
