Update SDK to 26.04.23 (#5478)

updated sdk, and added error management on the send LLS API
This commit is contained in:
Mauro
2026-04-24 13:07:16 +02:00
committed by GitHub
parent 5fa8f24c04
commit 52d16618f6
9 changed files with 773 additions and 39 deletions

View File

@@ -197,7 +197,7 @@ extension SDKListener: KnockRequestsListener where T == [KnockRequest] {
}
}
extension SDKListener: LiveLocationShareListener where T == [LiveLocationShareUpdate] {
extension SDKListener: LiveLocationsListener where T == [LiveLocationShareUpdate] {
func onUpdate(updates: [LiveLocationShareUpdate]) {
onUpdateClosure(updates)
}

View File

@@ -278,7 +278,13 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
case .success:
MXLog.debug("Sent live location to room: \(roomID)")
case .failure(let error):
MXLog.error("Failed to send live location update to room \(roomID): \(error)")
switch error {
case .liveLocationSessionIsNotActive:
MXLog.error("Failed to send live locatio update to room \(roomID): session not active")
await stopLiveLocation(roomID: roomID)
default:
MXLog.error("Failed to send live location update to room \(roomID): \(error)")
}
}
}
}

View File

@@ -11,7 +11,7 @@ import MatrixRustSDK
final class RoomLiveLocationService: RoomLiveLocationServiceProtocol {
// periphery:ignore - required for instance retention in the rust codebase
private let liveLocationShares: LiveLocationShares
private let liveLocationsObserver: LiveLocationsObserver
// periphery:ignore - required for instance retention in the rust codebase
private var observationToken: TaskHandle?
@@ -20,9 +20,9 @@ final class RoomLiveLocationService: RoomLiveLocationServiceProtocol {
liveLocationsSubject.asCurrentValuePublisher()
}
init(liveLocationShares: LiveLocationShares) {
self.liveLocationShares = liveLocationShares
observationToken = liveLocationShares
init(liveLocationsObserver: LiveLocationsObserver) {
self.liveLocationsObserver = liveLocationsObserver
observationToken = liveLocationsObserver
.subscribe(listener: SDKListener { [weak self] updates in
guard let self else { return }

View File

@@ -755,7 +755,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
// MARK: - Live Location
func makeLiveLocationService() async -> RoomLiveLocationServiceProtocol {
await RoomLiveLocationService(liveLocationShares: room.liveLocationShares())
await RoomLiveLocationService(liveLocationsObserver: room.liveLocationsObserver())
}
func startLiveLocationShare(duration: Duration) async -> Result<Void, RoomProxyError> {
@@ -772,6 +772,16 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
do {
try await room.sendLiveLocation(geoUri: geoURI.string)
return .success(())
} catch let error as LiveLocationError {
switch error {
case .Network:
MXLog.error("Failed sending live location with error: \(error)")
return .failure(.sdkError(error))
// We can consider the session not active for any error other the Network one.
default:
MXLog.error("Failed sending live location, session is not active")
return .failure(.liveLocationSessionIsNotActive)
}
} catch {
MXLog.error("Failed sending live location with error: \(error)")
return .failure(.sdkError(error))

View File

@@ -20,6 +20,7 @@ enum RoomProxyError: Error {
case missingTransactionID
case failedCreatingPinnedTimeline
case timelineError(TimelineProxyError)
case liveLocationSessionIsNotActive
}
/// An enum that describes the relationship between the current user and the room, and contains a reference to the specific implementation of the `RoomProxy`.