diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2022-12-20 15:20:36 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2022-12-20 16:59:43 +0100 |
| commit | b8927cb17328cb7479dcd0de25ea71f2d5f96092 (patch) | |
| tree | ff1e91d17a062e5f9953cc38658aa9de7491a58e /ios | |
| parent | d656052cf96755c726ef7ff2bdb3836c759c8b17 (diff) | |
| download | mullvadvpn-b8927cb17328cb7479dcd0de25ea71f2d5f96092.tar.xz mullvadvpn-b8927cb17328cb7479dcd0de25ea71f2d5f96092.zip | |
Connect: refactor
Diffstat (limited to 'ios')
| -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) { |
