Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the SDK to 25.02.04 #3737

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 18 additions & 30 deletions ElementX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "13f08bafc7a48e5a30c1e1df624229f58643bedc",
"version" : "25.1.31"
"revision" : "ebb2456c0c91fdca9747621c13af52ca330b91e9",
"version" : "25.2.4"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ class CreateRoomViewModel: CreateRoomViewModelType, CreateRoomViewModelProtocol
avatarURL = URL(string: url)
case .failure(let error):
switch error {
case .failedUploadingMedia(_, let errorCode):
switch errorCode {
case .fileTooLarge:
case .failedUploadingMedia(let errorKind):
switch errorKind {
case .tooLarge:
state.bindings.alertInfo = AlertInfo(id: .fileTooLarge)
default:
state.bindings.alertInfo = AlertInfo(id: .failedUploadingMedia)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ class AuthenticationService: AuthenticationServiceProtocol {
}

return await userSession(for: client)
} catch {
MXLog.error("Failed logging in with error: \(error)")
// FIXME: How about we make a proper type in the FFI? 😅
guard let error = error as? ClientError else { return .failure(.failedLoggingIn) }

switch error.code {
} catch let ClientError.MatrixApi(errorKind, _, _) {
MXLog.error("Failed logging in with error kind: \(errorKind)")
switch errorKind {
case .forbidden:
return .failure(.invalidCredentials)
case .userDeactivated:
return .failure(.accountDeactivated)
default:
return .failure(.failedLoggingIn)
}
} catch {
MXLog.error("Failed logging in with error: \(error)")
return .failure(.failedLoggingIn)
}
}

Expand Down
28 changes: 0 additions & 28 deletions ElementX/Sources/Services/Client/ClientError.swift

This file was deleted.

9 changes: 5 additions & 4 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@ 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 error as ClientError {
MXLog.error("Failed uploading media with error: \(error)")
return .failure(ClientProxyError.failedUploadingMedia(error, error.code))
} catch let ClientError.MatrixApi(errorKind, _, _) {
MXLog.error("Failed uploading media with error kind: \(errorKind)")
return .failure(ClientProxyError.failedUploadingMedia(errorKind))
} catch {
MXLog.error("Failed uploading media with error: \(error)")
return .failure(ClientProxyError.sdkError(error))
Expand Down Expand Up @@ -503,7 +503,8 @@ class ClientProxy: ClientProxyProtocol {
do {
let roomPreview = try await client.getRoomPreviewFromRoomId(roomId: identifier, viaServers: via)
return try .success(RoomPreviewProxy(roomPreview: roomPreview))
} catch let error as ClientError where error.code == .forbidden {
} catch ClientError.MatrixApi(.forbidden, _, _) {
MXLog.error("Failed retrieving preview for room: \(identifier) is private")
return .failure(.roomPreviewIsPrivate)
} catch {
MXLog.error("Failed retrieving preview for room: \(identifier) with error: \(error)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum ClientProxyError: Error {

case invalidMedia
case invalidServerName
case failedUploadingMedia(Error, MatrixErrorCode)
case failedUploadingMedia(ErrorKind)
case roomPreviewIsPrivate
case failedRetrievingUserIdentity
case failedResolvingRoomAlias
Expand Down
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ packages:
# Element/Matrix dependencies
MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 25.01.31
exactVersion: 25.02.04
# path: ../matrix-rust-sdk
Compound:
url: https://github.com/element-hq/compound-ios
Expand Down
Loading