mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 22:26:59 +02:00
Feature/3120 location sharing
This commit is contained in:
+3
-1
@@ -80,7 +80,9 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
||||
|
||||
let locationSharingService = LocationSharingService(userLocationService: parameters.roomDataSource.mxSession.userLocationService)
|
||||
|
||||
let viewModel = LocationSharingViewModel(mapStyleURL: BuildSettings.tileServerMapStyleURL,
|
||||
let tileServerMapStyleURL = parameters.roomDataSource.mxSession.vc_homeserverConfiguration().tileServer.mapStyleURL
|
||||
|
||||
let viewModel = LocationSharingViewModel(mapStyleURL: tileServerMapStyleURL,
|
||||
avatarData: parameters.avatarData,
|
||||
isLiveLocationSharingEnabled: RiotSettings.shared.enableLiveLocationSharing, service: locationSharingService)
|
||||
let view = LocationSharingView(context: viewModel.context)
|
||||
|
||||
@@ -24,7 +24,7 @@ struct LocationSharingMapView: UIViewRepresentable {
|
||||
// MARK: - Constants
|
||||
|
||||
private struct Constants {
|
||||
static let mapZoomLevel = 15.0
|
||||
static let mapZoomLevel = 13.0
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
@@ -86,6 +86,7 @@ struct LocationSharingMapView: UIViewRepresentable {
|
||||
if self.showsUserLocation {
|
||||
mapView.showsUserLocation = true
|
||||
mapView.userTrackingMode = .follow
|
||||
mapView.maximumZoomLevel = Constants.mapZoomLevel
|
||||
} else {
|
||||
mapView.showsUserLocation = false
|
||||
mapView.userTrackingMode = .none
|
||||
|
||||
+15
-4
@@ -24,6 +24,7 @@ struct StaticLocationViewingCoordinatorParameters {
|
||||
let avatarData: AvatarInputProtocol
|
||||
let location: CLLocationCoordinate2D
|
||||
let coordinateType: LocationSharingCoordinateType
|
||||
let mxSession: MXSession?
|
||||
}
|
||||
|
||||
final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
@@ -50,10 +51,20 @@ final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
init(parameters: StaticLocationViewingCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
let viewModel = StaticLocationViewingViewModel(mapStyleURL: BuildSettings.tileServerMapStyleURL,
|
||||
avatarData: parameters.avatarData,
|
||||
location: parameters.location,
|
||||
coordinateType: parameters.coordinateType)
|
||||
var viewModel: StaticLocationViewingViewModel
|
||||
if let mapStyleUrl = parameters.mxSession?.vc_homeserverConfiguration()?.tileServer.mapStyleURL {
|
||||
viewModel = StaticLocationViewingViewModel(mapStyleURL: mapStyleUrl,
|
||||
avatarData: parameters.avatarData,
|
||||
location: parameters.location,
|
||||
coordinateType: parameters.coordinateType)
|
||||
} else {
|
||||
viewModel = StaticLocationViewingViewModel(mapStyleURL: BuildSettings.tileServerMapStyleURL,
|
||||
avatarData: parameters.avatarData,
|
||||
location: parameters.location,
|
||||
coordinateType: parameters.coordinateType)
|
||||
}
|
||||
|
||||
|
||||
let view = StaticLocationView(viewModel: viewModel.context)
|
||||
.addDependency(AvatarService.instantiate(mediaManager: parameters.mediaManager))
|
||||
staticLocationViewingViewModel = viewModel
|
||||
|
||||
@@ -49,6 +49,10 @@ struct StaticLocationViewingViewState: BindableState {
|
||||
var shareButtonEnabled: Bool {
|
||||
!showLoadingIndicator
|
||||
}
|
||||
|
||||
var shareButtonVisible: Bool {
|
||||
BwiBuildSettings.bwiLocationShareButtonVisible
|
||||
}
|
||||
|
||||
let errorSubject = PassthroughSubject<LocationSharingViewError, Never>()
|
||||
|
||||
|
||||
@@ -62,8 +62,9 @@ struct StaticLocationView: View {
|
||||
} label: {
|
||||
Image(uiImage: Asset.Images.locationShareIcon.image)
|
||||
}
|
||||
.disabled(!viewModel.viewState.shareButtonEnabled)
|
||||
//.disabled(!viewModel.viewState.shareButtonEnabled)
|
||||
.accessibilityIdentifier("shareButton")
|
||||
.opacity(BwiBuildSettings.bwiLocationShareButtonVisible ? 1.0 : 0.0)
|
||||
}
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
||||
Reference in New Issue
Block a user