Skip to content

Commit

Permalink
Merge pull request #452 from ivpn/bugfix/map-marker-disappears
Browse files Browse the repository at this point in the history
[iOS 18] Location marker disappears after app wakes up from background
  • Loading branch information
jurajhilje authored Sep 17, 2024
2 parents 0fafc06 + 885fd1b commit 65dabaf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions IVPNClient/Scenes/MainScreen/Map/MapScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ class MapScrollView: UIScrollView {
func updateMapMarkers() {
markerLocalView.updateView()
markerGatewayView.updateView()
if let viewModel = viewModel {
updateMapPosition(viewModel: viewModel, animated: true)
}
}

func updateMapPosition(latitude: Double, longitude: Double, animated: Bool = false, isLocalPosition: Bool, updateMarkers: Bool = true) {
Expand All @@ -136,7 +139,7 @@ class MapScrollView: UIScrollView {
}

if updateMarkers {
updateMarkerPosition(x: point.0 - 49, y: point.1 - 49, isLocalPosition: isLocalPosition)
updateMarkerPosition(x: point.0, y: point.1, isLocalPosition: isLocalPosition)
}

currentCoordinates = (latitude, longitude)
Expand Down Expand Up @@ -249,7 +252,7 @@ class MapScrollView: UIScrollView {

private func updateMarkerPosition(x: Double, y: Double, isLocalPosition: Bool) {
if isLocalPosition {
markerLocalView.snp.updateConstraints { make in
markerLocalView.snp.remakeConstraints { make in
make.left.equalTo(x)
make.top.equalTo(y)
}
Expand All @@ -258,7 +261,7 @@ class MapScrollView: UIScrollView {
self.layoutIfNeeded()
}
} else {
markerGatewayView.snp.updateConstraints { make in
markerGatewayView.snp.remakeConstraints { make in
make.left.equalTo(x)
make.top.equalTo(y)
}
Expand Down

0 comments on commit 65dabaf

Please sign in to comment.