pr suggestions

This commit is contained in:
Mauro Romito
2026-04-03 10:43:10 +02:00
committed by Mauro
parent df5570281b
commit d9a480b1c6
6 changed files with 57 additions and 57 deletions
@@ -59,20 +59,20 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
return true
}
func startLiveLocation(roomID: String, durationMillis: UInt64) async -> Result<Void, LiveLocationManagerError> {
func startLiveLocation(roomID: String, duration: Duration) async -> Result<Void, LiveLocationManagerError> {
guard case .joined(let roomProxy) = await clientProxy.roomForIdentifier(roomID) else {
MXLog.error("Failed to resolve joined room for identifier: \(roomID)")
return .failure(.roomNotJoined)
}
let result = await roomProxy.startLiveLocationShare(durationMillis: durationMillis)
let result = await roomProxy.startLiveLocationShare(duration: duration)
guard case .success = result else {
MXLog.error("Failed to start live location share in room: \(roomID)")
return .failure(.startFailed)
}
let timeoutDate = Date().addingTimeInterval(TimeInterval(durationMillis) / 1000.0)
let timeoutDate = Date().addingTimeInterval(TimeInterval(duration.seconds))
appSettings.liveLocationSharingTimeoutDatesByRoomID[roomID] = timeoutDate
return .success(())
@@ -30,8 +30,8 @@ protocol LiveLocationManagerProtocol: AnyObject {
///
/// - Parameters:
/// - roomID: The identifier of the room to share live location in.
/// - durationMillis: The duration in milliseconds for how long the live location should be shared.
func startLiveLocation(roomID: String, durationMillis: UInt64) async -> Result<Void, LiveLocationManagerError>
/// - duration: How long the live location should be shared.
func startLiveLocation(roomID: String, duration: Duration) async -> Result<Void, LiveLocationManagerError>
/// Stops sharing live location in a room.
///
@@ -754,9 +754,9 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
// MARK: - Live Location
func startLiveLocationShare(durationMillis: UInt64) async -> Result<Void, RoomProxyError> {
func startLiveLocationShare(duration: Duration) async -> Result<Void, RoomProxyError> {
do {
try await room.startLiveLocationShare(durationMillis: durationMillis)
try await room.startLiveLocationShare(durationMillis: UInt64(duration.seconds * 1000))
return .success(())
} catch {
MXLog.error("Failed starting live location share with error: \(error)")
@@ -197,7 +197,7 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol {
// MARK: - Live Location
func startLiveLocationShare(durationMillis: UInt64) async -> Result<Void, RoomProxyError>
func startLiveLocationShare(duration: Duration) async -> Result<Void, RoomProxyError>
func sendLiveLocation(geoURI: GeoURI) async -> Result<Void, RoomProxyError>
func stopLiveLocationShare() async -> Result<Void, RoomProxyError>
}