mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 19:34:25 +02:00
Show own location in map views (#7375)
* show own location on static sharing * show own location on live sharing * add tests and changelog * check location authorisation, fix center to current user location button * it moves request to LocationManager in proper service * add static location viewer service
This commit is contained in:
+2
@@ -33,4 +33,6 @@ protocol LiveLocationSharingViewerServiceProtocol {
|
||||
|
||||
/// Stop current user location sharing
|
||||
func stopUserLiveLocationSharing(completion: @escaping (Result<Void, Error>) -> Void)
|
||||
|
||||
func requestAuthorizationIfNeeded() -> Bool
|
||||
}
|
||||
|
||||
+6
@@ -19,11 +19,13 @@ import Foundation
|
||||
import MatrixSDK
|
||||
|
||||
class LiveLocationSharingViewerService: LiveLocationSharingViewerServiceProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
private(set) var usersLiveLocation: [UserLiveLocation] = []
|
||||
private let roomId: String
|
||||
private var beaconInfoSummaryListener: Any?
|
||||
private let locationManager = CLLocationManager()
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -74,6 +76,10 @@ class LiveLocationSharingViewerService: LiveLocationSharingViewerServiceProtocol
|
||||
}
|
||||
}
|
||||
|
||||
func requestAuthorizationIfNeeded() -> Bool {
|
||||
locationManager.requestAuthorizationIfNeeded()
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func updateUsersLiveLocation(notifyUpdate: Bool) {
|
||||
|
||||
+12
-3
@@ -27,12 +27,17 @@ class MockLiveLocationSharingViewerService: LiveLocationSharingViewerServiceProt
|
||||
|
||||
// MARK: Setup
|
||||
|
||||
init(generateRandomUsers: Bool = false) {
|
||||
let firstUserLiveLocation = createFirstUserLiveLocation()
|
||||
init(generateRandomUsers: Bool = false, currentUserSharingLocation: Bool = true) {
|
||||
let firstUserLiveLocation: UserLiveLocation?
|
||||
if currentUserSharingLocation {
|
||||
firstUserLiveLocation = createFirstUserLiveLocation()
|
||||
} else {
|
||||
firstUserLiveLocation = nil
|
||||
}
|
||||
|
||||
let secondUserLiveLocation = createSecondUserLiveLocation()
|
||||
|
||||
var usersLiveLocation: [UserLiveLocation] = [firstUserLiveLocation, secondUserLiveLocation]
|
||||
var usersLiveLocation: [UserLiveLocation] = [firstUserLiveLocation, secondUserLiveLocation].compactMap { $0 }
|
||||
|
||||
if generateRandomUsers {
|
||||
for _ in 1...20 {
|
||||
@@ -56,6 +61,10 @@ class MockLiveLocationSharingViewerService: LiveLocationSharingViewerServiceProt
|
||||
|
||||
func stopUserLiveLocationSharing(completion: @escaping (Result<Void, Error>) -> Void) { }
|
||||
|
||||
func requestAuthorizationIfNeeded() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private func createFirstUserLiveLocation() -> UserLiveLocation {
|
||||
|
||||
Reference in New Issue
Block a user