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
+1 -1
View File
@@ -9831,7 +9831,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = 26.01.27;
version = 26.02.03;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
@@ -158,8 +158,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "f49e072a6629e69f374cff243319969f34f1f7f4",
"version" : "26.1.27"
"revision" : "a31fcfe93d38f37ce59695648d176c2f676edb62",
"version" : "26.2.3"
}
},
{
@@ -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? {
+11
View File
@@ -140,4 +140,15 @@ private final class ClientDelegateWrapper: ClientDelegate {
func didRefreshTokens() {
MXLog.info("Delegating session updates to the ClientSessionDelegate.")
}
func onBackgroundTaskErrorReport(taskName: String, error: MatrixRustSDK.BackgroundTaskFailureReason) {
switch error {
case .panic(let message, let backtrace):
MXLog.error("Received background task panic: \(message ?? "Missing message")\nBacktrace:\n\(backtrace ?? "Missing backtrace")")
case .error(let error):
MXLog.error("Received background task error: \(error)")
case .earlyTermination:
MXLog.error("Received background task early termination")
}
}
}
@@ -27862,24 +27862,6 @@ open class TimelineEventFilterSDKMock: MatrixRustSDK.TimelineEventFilter, @unche
{
}
}
open class TimelineEventTypeFilterSDKMock: MatrixRustSDK.TimelineEventTypeFilter, @unchecked Sendable {
public init() {
super.init(noHandle: .init())
}
public required init(unsafeFromHandle handle: UInt64) {
fatalError("init(unsafeFromHandle:) has not been implemented")
}
fileprivate var handle: UInt64 {
get { return underlyingHandle }
set(value) { underlyingHandle = value }
}
fileprivate var underlyingHandle: UInt64!
static func reset()
{
}
}
open class TimelineItemSDKMock: MatrixRustSDK.TimelineItem, @unchecked Sendable {
public init() {
super.init(noHandle: .init())
+1 -1
View File
@@ -73,7 +73,7 @@ packages:
# Element/Matrix dependencies
MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 26.01.27
exactVersion: 26.02.03
# path: ../matrix-rust-sdk
Compound:
path: compound-ios