mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
fixed a bug that made the map still follow your location, even whan trying to center the map on an annotation.
This commit is contained in:
@@ -179,6 +179,7 @@ enum LocationSharingScreenViewAction {
|
|||||||
case centerToUser
|
case centerToUser
|
||||||
case userDidPan
|
case userDidPan
|
||||||
case stopLiveLocation
|
case stopLiveLocation
|
||||||
|
case setMapCenter(CLLocationCoordinate2D)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AlertInfo where T == LocationSharingViewAlert {
|
extension AlertInfo where T == LocationSharingViewAlert {
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati
|
|||||||
}
|
}
|
||||||
case .stopLiveLocation:
|
case .stopLiveLocation:
|
||||||
stopLiveLocation()
|
stopLiveLocation()
|
||||||
|
case .setMapCenter(let coordinate):
|
||||||
|
state.bindings.showsUserLocationMode = .show
|
||||||
|
state.bindings.mapCenterLocation = coordinate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,13 +67,15 @@ struct LiveLocationSheet: View {
|
|||||||
if let profile = context.viewState.userProfiles[liveLocationShare.userID] {
|
if let profile = context.viewState.userProfiles[liveLocationShare.userID] {
|
||||||
Button {
|
Button {
|
||||||
guard let geoURI = liveLocationShare.geoURI else { return }
|
guard let geoURI = liveLocationShare.geoURI else { return }
|
||||||
context.mapCenterLocation = .init(latitude: geoURI.latitude, longitude: geoURI.longitude)
|
context.send(viewAction: .setMapCenter(.init(latitude: geoURI.latitude, longitude: geoURI.longitude)))
|
||||||
} label: {
|
} label: {
|
||||||
UserLocationCell(profile: profile,
|
UserLocationCell(profile: profile,
|
||||||
isOwnUser: context.viewState.isOwnUser(liveLocationShare.userID),
|
isOwnUser: context.viewState.isOwnUser(liveLocationShare.userID),
|
||||||
kind: .live,
|
kind: .live,
|
||||||
mediaProvider: context.mediaProvider,
|
mediaProvider: context.mediaProvider,
|
||||||
onShare: { context.sharedAnnotation = context.viewState.annotations.first { $0.id == liveLocationShare.id }},
|
onShare: {
|
||||||
|
context.sharedAnnotation = context.viewState.annotations.first { $0.id == liveLocationShare.id }
|
||||||
|
},
|
||||||
onStop: { context.send(viewAction: .stopLiveLocation) })
|
onStop: { context.send(viewAction: .stopLiveLocation) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ struct StaticLocationSheet: View {
|
|||||||
if case let .viewStatic(location) = context.viewState.interactionMode,
|
if case let .viewStatic(location) = context.viewState.interactionMode,
|
||||||
let profile = context.viewState.userProfiles.values.first {
|
let profile = context.viewState.userProfiles.values.first {
|
||||||
Button {
|
Button {
|
||||||
context.mapCenterLocation = .init(latitude: location.geoURI.latitude,
|
context.send(viewAction: .setMapCenter(.init(latitude: location.geoURI.latitude,
|
||||||
longitude: location.geoURI.longitude)
|
longitude: location.geoURI.longitude)))
|
||||||
} label: {
|
} label: {
|
||||||
UserLocationCell(profile: profile,
|
UserLocationCell(profile: profile,
|
||||||
isOwnUser: context.viewState.isOwnUser(profile.userID),
|
isOwnUser: context.viewState.isOwnUser(profile.userID),
|
||||||
@@ -47,13 +47,14 @@ struct StaticLocationSheet: View {
|
|||||||
mediaProvider: context.mediaProvider,
|
mediaProvider: context.mediaProvider,
|
||||||
onShare: {
|
onShare: {
|
||||||
context.sharedAnnotation = context.viewState.annotations.first
|
context.sharedAnnotation = context.viewState.annotations.first
|
||||||
})
|
},
|
||||||
}
|
onStop: nil)
|
||||||
.popover(item: $context.sharedAnnotation) { annotation in
|
|
||||||
LocationShareSheet(annotation: annotation)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.popover(item: $context.sharedAnnotation) { annotation in
|
||||||
|
LocationShareSheet(annotation: annotation)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user