Skip to content

Commit

Permalink
Upgrade UniFFI
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Oct 11, 2023
1 parent b8185c0 commit 570e6b9
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 28 deletions.
80 changes: 56 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ thiserror = "1.0.38"
tokio = { version = "1.30.0", default-features = false, features = ["sync"] }
tracing = { version = "0.1.36", default-features = false, features = ["std"] }
tracing-core = "0.1.30"
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "48b1f51f6e5406cab20f502f535b30a589a5b140" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "48b1f51f6e5406cab20f502f535b30a589a5b140" }
vodozemac = "0.5.0"
zeroize = "1.6.0"

Expand Down
7 changes: 6 additions & 1 deletion bindings/matrix-sdk-crypto-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@ pub enum CryptoStoreError {
Identifier(#[from] IdParseError),
}

#[derive(Debug, uniffi::Error)]
#[derive(Debug, thiserror::Error, uniffi::Error)]
pub enum DecryptionError {
#[error("serialization error: {error}")]
Serialization { error: String },
#[error("identifier parsing error: {error}")]
Identifier { error: String },
#[error("megolm error: {error}")]
Megolm { error: String },
#[error("missing room key: {error}")]
MissingRoomKey { error: String, withheld_code: Option<String> },
#[error("store error: {error}")]
Store { error: String },
}

Expand Down
7 changes: 7 additions & 0 deletions bindings/matrix-sdk-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use matrix_sdk::{
NotificationSettingsError as SdkNotificationSettingsError, StoreError,
};
use matrix_sdk_ui::{encryption_sync_service, notification_client, sync_service, timeline};
use uniffi::UnexpectedUniFFICallbackError;

#[derive(Debug, thiserror::Error)]
pub enum ClientError {
Expand All @@ -24,6 +25,12 @@ impl From<anyhow::Error> for ClientError {
}
}

impl From<UnexpectedUniFFICallbackError> for ClientError {
fn from(e: UnexpectedUniFFICallbackError) -> Self {
Self::new(e)
}
}

impl From<matrix_sdk::Error> for ClientError {
fn from(e: matrix_sdk::Error) -> Self {
Self::new(e)
Expand Down
7 changes: 6 additions & 1 deletion bindings/matrix-sdk-ffi/src/room_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ use crate::{
RUNTIME,
};

#[derive(uniffi::Error)]
#[derive(Debug, thiserror::Error, uniffi::Error)]
pub enum RoomListError {
#[error("sliding sync error: {error}")]
SlidingSync { error: String },
#[error("unknown list `{list_name}`")]
UnknownList { list_name: String },
#[error("input cannot be applied")]
InputCannotBeApplied,
#[error("room `{room_name}` not found")]
RoomNotFound { room_name: String },
#[error("invalid room ID: {error}")]
InvalidRoomId { error: String },
}

Expand Down
1 change: 1 addition & 0 deletions xtask/src/kotlin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ fn generate_uniffi_bindings(
vec![TargetLanguage::Kotlin],
Some(ffi_generated_dir),
Some(library_path),
None,
false,
)?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions xtask/src/swift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn generate_uniffi(library_file: &Utf8Path, ffi_directory: &Utf8Path) -> Result<
vec![TargetLanguage::Swift],
Some(ffi_directory),
Some(library_file),
None,
false,
)?;
Ok(())
Expand Down

0 comments on commit 570e6b9

Please sign in to comment.