handle reduced accuracy authorization case
This commit is contained in:
@@ -42,6 +42,8 @@ final class LiveLocationManagerTests {
|
||||
#expect(roomProxy.startLiveLocationShareDurationCalled)
|
||||
#expect(!roomProxy.stopLiveLocationShareCalled)
|
||||
#expect(appSettings.liveLocationSharingTimeoutDatesByRoomID["!room:matrix.org"] != nil)
|
||||
#expect(locationManagerMock.startUpdatingLocationCalled)
|
||||
#expect(!locationManagerMock.startMonitoringSignificantLocationChangesCalled)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -131,6 +133,10 @@ final class LiveLocationManagerTests {
|
||||
|
||||
#expect(roomProxy.stopLiveLocationShareCalled)
|
||||
#expect(appSettings.liveLocationSharingTimeoutDatesByRoomID["!room:matrix.org"] == nil)
|
||||
// Setting the timeout date above starts tracking; removing it stops tracking.
|
||||
#expect(locationManagerMock.startUpdatingLocationCalled)
|
||||
#expect(locationManagerMock.stopUpdatingLocationCalled)
|
||||
#expect(!locationManagerMock.stopMonitoringSignificantLocationChangesCalled)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -156,6 +162,26 @@ final class LiveLocationManagerTests {
|
||||
#expect(appSettings.liveLocationSharingTimeoutDatesByRoomID["!room2:matrix.org"] != nil)
|
||||
}
|
||||
|
||||
// MARK: - Reduced accuracy
|
||||
|
||||
@Test
|
||||
func startLiveLocationInReducedAccuracyMode() async throws {
|
||||
locationManagerMock.underlyingAccuracyAuthorization = .reducedAccuracy
|
||||
let roomProxy = makeRoomProxy(roomID: "!room:matrix.org")
|
||||
clientProxy.roomForIdentifierClosure = { _ in .joined(roomProxy) }
|
||||
|
||||
let result = await manager.startLiveLocation(roomID: "!room:matrix.org", duration: .seconds(300))
|
||||
try result.get()
|
||||
|
||||
#expect(locationManagerMock.startMonitoringSignificantLocationChangesCalled)
|
||||
#expect(!locationManagerMock.startUpdatingLocationCalled)
|
||||
|
||||
await manager.stopLiveLocation(roomID: "!room:matrix.org")
|
||||
|
||||
#expect(locationManagerMock.stopMonitoringSignificantLocationChangesCalled)
|
||||
#expect(!locationManagerMock.stopUpdatingLocationCalled)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func makeRoomProxy(roomID: String) -> JoinedRoomProxyMock {
|
||||
|
||||
Reference in New Issue
Block a user