mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 12:46:58 +02:00
Location centring user's sharing location (#7398)
* fix issue on timeline bubbles not showing proper content after decrypt * fix location sharing centring to other users * Update RiotSwiftUI/Modules/LocationSharing/LiveLocationSharingViewer/LiveLocationSharingViewerViewModel.swift Co-authored-by: Alfonso Grillo <alfogrillo@element.io> --------- Co-authored-by: Alfonso Grillo <alfogrillo@element.io>
This commit is contained in:
+2
-1
@@ -43,7 +43,8 @@ struct StaticLocationViewingViewState: BindableState {
|
||||
/// Shared annotation to display existing location
|
||||
let sharedAnnotation: LocationAnnotation
|
||||
|
||||
var showsUserLocation = false
|
||||
/// Behavior mode of the current user's location, can be hidden, only shown and shown following the user
|
||||
var showsUserLocationMode: ShowUserLocationMode = .hide
|
||||
|
||||
var showLoadingIndicator = false
|
||||
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ class StaticLocationViewingViewModel: StaticLocationViewingViewModelType, Static
|
||||
|
||||
private func showsCurrentUserLocation() {
|
||||
if staticLocationSharingViewerService.requestAuthorizationIfNeeded() {
|
||||
state.showsUserLocation = true
|
||||
state.showsUserLocationMode = .follow
|
||||
} else {
|
||||
state.errorSubject.send(.invalidLocationAuthorization)
|
||||
}
|
||||
|
||||
+2
-2
@@ -81,9 +81,9 @@ class StaticLocationViewingViewModelTests: XCTestCase {
|
||||
|
||||
func testToggleShowUserLocation() {
|
||||
let viewModel = buildViewModel()
|
||||
XCTAssertFalse(viewModel.context.viewState.showsUserLocation)
|
||||
XCTAssertEqual(viewModel.context.viewState.showsUserLocationMode, .hide)
|
||||
viewModel.context.send(viewAction: .showUserLocation)
|
||||
XCTAssertTrue(viewModel.context.viewState.showsUserLocation)
|
||||
XCTAssertEqual(viewModel.context.viewState.showsUserLocationMode, .follow)
|
||||
}
|
||||
|
||||
private func buildViewModel() -> StaticLocationViewingViewModel {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ struct StaticLocationView: View {
|
||||
annotations: [viewModel.viewState.sharedAnnotation],
|
||||
highlightedAnnotation: viewModel.viewState.sharedAnnotation,
|
||||
userAvatarData: nil,
|
||||
showsUserLocation: viewModel.viewState.showsUserLocation,
|
||||
showsUserLocationMode: viewModel.viewState.showsUserLocationMode,
|
||||
userLocation: Binding.constant(nil),
|
||||
mapCenterCoordinate: Binding.constant(nil),
|
||||
errorSubject: viewModel.viewState.errorSubject)
|
||||
|
||||
Reference in New Issue
Block a user