Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS 18] Location marker disappears after app wakes up from background #452

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading