sdk: update to 25.04.14

This commit is contained in:
Mauro Romito
2025-04-14 11:13:49 +02:00
committed by Mauro
parent 4f4729b8df
commit 9d53b29902
12 changed files with 119 additions and 21 deletions
@@ -128,7 +128,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
}
return await userSession(for: client)
} catch let ClientError.MatrixApi(errorKind, _, _) {
} catch let ClientError.MatrixApi(errorKind, _, _, _) {
MXLog.error("Failed logging in with error kind: \(errorKind)")
switch errorKind {
case .forbidden:
@@ -437,7 +437,7 @@ class ClientProxy: ClientProxyProtocol {
await waitForRoomToSync(roomID: roomID, timeout: .seconds(30))
return .success(())
} catch ClientError.MatrixApi(.forbidden, _, _) {
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
MXLog.error("Failed joining roomAlias: \(roomID) forbidden")
return .failure(.forbiddenAccess)
} catch {
@@ -453,7 +453,7 @@ class ClientProxy: ClientProxyProtocol {
await waitForRoomToSync(roomID: room.id(), timeout: .seconds(30))
return .success(())
} catch ClientError.MatrixApi(.forbidden, _, _) {
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
MXLog.error("Failed joining roomAlias: \(roomAlias) forbidden")
return .failure(.forbiddenAccess)
} catch {
@@ -494,7 +494,7 @@ class ClientProxy: ClientProxyProtocol {
let data = try Data(contentsOf: media.url)
let matrixUrl = try await client.uploadMedia(mimeType: mimeType, data: data, progressWatcher: nil)
return .success(matrixUrl)
} catch let ClientError.MatrixApi(errorKind, _, _) {
} catch let ClientError.MatrixApi(errorKind, _, _, _) {
MXLog.error("Failed uploading media with error kind: \(errorKind)")
return .failure(ClientProxyError.failedUploadingMedia(errorKind))
} catch {
@@ -526,7 +526,7 @@ class ClientProxy: ClientProxyProtocol {
do {
let roomPreview = try await client.getRoomPreviewFromRoomId(roomId: identifier, viaServers: via)
return try .success(RoomPreviewProxy(roomPreview: roomPreview))
} catch ClientError.MatrixApi(.forbidden, _, _) {
} catch ClientError.MatrixApi(.forbidden, _, _, _) {
MXLog.error("Failed retrieving preview for room: \(identifier) is private")
return .failure(.roomPreviewIsPrivate)
} catch {
@@ -97,7 +97,7 @@ class KeychainController: KeychainControllerProtocol {
func retrieveSessionFromKeychain(userId: String) throws -> Session {
MXLog.info("Retrieving an updated Session from the keychain.")
guard let session = restorationTokenForUsername(userId)?.session else {
throw ClientError.Generic(msg: "Failed to find RestorationToken in the Keychain.")
throw ClientError.Generic(msg: "Failed to find RestorationToken in the Keychain.", details: nil)
}
return session
}
@@ -39,6 +39,15 @@ struct NotificationItemProxy: NotificationItemProxyProtocol {
var isRoomDirect: Bool {
notificationItem.roomInfo.isDirect
}
var isRoomPrivate: Bool {
switch notificationItem.roomInfo.joinRule {
case .invite, .knock, .restricted, .knockRestricted:
true
default:
false
}
}
var roomJoinedMembers: Int {
Int(notificationItem.roomInfo.joinedMembersCount)
@@ -89,6 +98,8 @@ struct EmptyNotificationItemProxy: NotificationItemProxyProtocol {
var isNoisy: Bool { false }
var isRoomDirect: Bool { false }
var isRoomPrivate: Bool { false }
var senderAvatarMediaSource: MediaSourceProxy? { nil }
@@ -29,6 +29,8 @@ protocol NotificationItemProxyProtocol {
var roomJoinedMembers: Int { get }
var isRoomDirect: Bool { get }
var isRoomPrivate: Bool { get }
var isNoisy: Bool { get }
@@ -24,11 +24,11 @@ final class RoomPreviewProxy: RoomPreviewProxyProtocol {
}
var senderRoomMember: RoomMemberProxy?
if let member = details.senderRoomMember {
if let member = details.senderInfo {
senderRoomMember = .init(member: member)
}
return RoomMembershipDetailsProxy(ownRoomMember: RoomMemberProxy(member: details.ownRoomMember),
return RoomMembershipDetailsProxy(ownRoomMember: RoomMemberProxy(member: details.roomMember),
senderRoomMember: senderRoomMember)
}
}