Bump the RustSDK to v26.02.03 (#5051)

Bump the RustSDK to v26.02.03
Fix breaking changes and add support for the new background task error reporting delegate and the new room invite latest event.
This commit is contained in:
Stefan Ceriu
2026-02-06 12:08:44 +02:00
committed by GitHub
parent 26060dde3a
commit 61763d9893
9 changed files with 56 additions and 29 deletions
@@ -224,6 +224,19 @@ class ClientProxy: ClientProxyProtocol {
delegateHandle = try client.setDelegate(delegate: ClientDelegateWrapper { [weak self] isSoftLogout in
self?.hasEncounteredAuthError = true
self?.actionsSubject.send(.receivedAuthError(isSoftLogout: isSoftLogout))
} backgroundTaskErrorCallback: { error in
switch error {
case .panic(let message, let backtrace):
MXLog.error("Received background task panic: \(message ?? "Missing message")\nBacktrace:\n\(backtrace ?? "Missing backtrace")")
if AppSettings.appBuildType == .debug || AppSettings.appBuildType == .nightly {
fatalError(message ?? "")
}
case .error(let error):
MXLog.error("Received background task error: \(error)")
case .earlyTermination:
MXLog.error("Received background task early termination")
}
})
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
@@ -1262,9 +1275,12 @@ class ClientProxy: ClientProxyProtocol {
private final class ClientDelegateWrapper: ClientDelegate {
private let authErrorCallback: @Sendable (Bool) -> Void
private let backgroundTaskErrorCallback: @Sendable (MatrixRustSDK.BackgroundTaskFailureReason) -> Void
init(authErrorCallback: @escaping @Sendable (Bool) -> Void) {
init(authErrorCallback: @escaping @Sendable (Bool) -> Void,
backgroundTaskErrorCallback: @escaping @Sendable (MatrixRustSDK.BackgroundTaskFailureReason) -> Void) {
self.authErrorCallback = authErrorCallback
self.backgroundTaskErrorCallback = backgroundTaskErrorCallback
}
// MARK: - ClientDelegate
@@ -1277,6 +1293,10 @@ private final class ClientDelegateWrapper: ClientDelegate {
func didRefreshTokens() {
MXLog.info("Delegating session updates to the ClientSessionDelegate.")
}
func onBackgroundTaskErrorReport(taskName: String, error: MatrixRustSDK.BackgroundTaskFailureReason) {
backgroundTaskErrorCallback(error)
}
}
private final class ClientDecryptionErrorDelegate: UnableToDecryptDelegate {
@@ -88,7 +88,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .openRoom)
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: appSettings.threadsEnabled),
filter: .eventTypeFilter(filter: excludedEventsFilter),
filter: .eventFilter(filter: excludedEventsFilter),
internalIdPrefix: nil,
dateDividerMode: .daily,
trackReadReceipts: .messageLikeEvents,
@@ -154,7 +154,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .notificationToMessage)
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .event(eventId: eventID,
numContextEvents: numberOfEvents,
hideThreadedEvents: appSettings.threadsEnabled),
threadMode: .automatic(hideThreadedEvents: appSettings.threadsEnabled)),
filter: .all,
internalIdPrefix: UUID().uuidString,
dateDividerMode: .daily,
@@ -216,7 +216,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
do {
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
case .live: .live(hideThreadedEvents: false)
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100, hideThreadedEvents: false)
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100, threadMode: .automatic(hideThreadedEvents: false))
case .thread(let eventID): .thread(rootEventId: eventID)
case .pinned: .pinnedEvents(maxEventsToLoad: 100, maxConcurrentRequests: 10)
}
@@ -792,7 +792,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
}
}
private let excludedEventsFilter: TimelineEventTypeFilter = {
private let excludedEventsFilter: TimelineEventFilter = {
var stateEventFilters: [StateEventType] = [.roomAliases,
.roomCanonicalAlias,
.roomGuestAccess,
@@ -807,6 +807,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
.policyRuleRoom,
.policyRuleServer,
.policyRuleUser]
return .exclude(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
return .excludeEventTypes(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
}()
}
@@ -289,6 +289,15 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
let sender = TimelineItemSender(senderID: senderID, senderProfile: profile)
attributedLastMessage = eventStringBuilder.buildAttributedString(for: content, sender: sender, isOutgoing: isOwn)
lastMessageDate = Date(timeIntervalSince1970: TimeInterval(timestamp / 1000))
case .remoteInvite(let timestamp, let senderID, let profile):
lastMessageDate = Date(timeIntervalSince1970: TimeInterval(timestamp / 1000))
if let senderID {
let sender = TimelineItemSender(senderID: senderID, senderProfile: profile)
let senderDisplayName = sender.displayName ?? sender.id
let invitedYouString = eventStringBuilder.stateEventStringBuilder.buildInvitedYouString(senderDisplayName)
attributedLastMessage = AttributedString(invitedYouString)
}
case .none:
break
}
@@ -58,7 +58,7 @@ struct RoomStateEventStringBuilder {
if senderIsYou {
return L10n.stateEventRoomInviteByYou(member)
} else if memberIsYou {
return L10n.stateEventRoomInviteYou(senderDisplayName)
return buildInvitedYouString(senderDisplayName)
} else {
return L10n.stateEventRoomInvite(senderDisplayName, member)
}
@@ -88,6 +88,10 @@ struct RoomStateEventStringBuilder {
}
}
func buildInvitedYouString(_ senderDisplayName: String) -> String {
L10n.stateEventRoomInviteYou(senderDisplayName)
}
func buildProfileChangeString(displayName: String?, previousDisplayName: String?,
avatarURLString: String?, previousAvatarURLString: String?,
member: String, memberIsYou: Bool) -> String? {