Skip to content
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
32 changes: 30 additions & 2 deletions bindings/matrix-sdk-ffi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,35 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - ReleaseDate

### Breaking changes:
### Breaking changes

- Add the `sqlite` feature, along with the `indexeddb` feature, to enable either
the SQLite or IndexedDB store. The `session_paths`, `session_passphrase`,
`session_pool_max_size`, `session_cache_size` and `session_journal_size_limit`
methods on `ClientBuilder` have been removed. New methods are added:
`ClientBuilder::in_memory_store` if one wants non-persistent stores,
`ClientBuilder::sqlite_store` to configure and to use SQLite stores (if
the `sqlite` feature is enabled), and `ClientBuilder::indexeddb_store` to
configure and to use IndexedDB stores (if the `indexeddb` feature is enabled).
([#5811](https://github.com/matrix-org/matrix-rust-sdk/pull/5811))

The code:

```rust
client_builder
.session_paths("data_path", "cache_path")
.passphrase("foobar")
```

now becomes:

```rust
client_builder
.sqlite_store(
SqliteSessionStoreBuilder::new("data_path", "cache_path")
.passphrase("foobar")
)
```

- The `waveform` parameter in `Timeline::send_voice_message` format changed to a list of `f32`
between 0 and 1.
Expand All @@ -32,7 +60,7 @@ All notable changes to this project will be documented in this file.
- Add `Client::subscribe_to_send_queue_updates` to observe global send queue updates.
([#5784](https://github.com/matrix-org/matrix-rust-sdk/pull/5784))

### Features:
### Features

- Add `Room::mark_as_fully_read_unchecked` so clients can mark a room as read without needing a `Timeline` instance. Note this method is not recommended as it can potentially cause incorrect read receipts, but it can needed in certain cases.
- Add `Timeline::latest_event_id` to be able to fetch the event id of the latest event of the timeline.
Expand Down
8 changes: 6 additions & 2 deletions bindings/matrix-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ crate-type = [

[features]
default = ["bundled-sqlite", "unstable-msc4274", "experimental-element-recent-emojis"]
bundled-sqlite = ["matrix-sdk/bundled-sqlite"]
# Use SQLite for the session storage.
sqlite = ["matrix-sdk/sqlite"]
# Use an embedded version of SQLite.
bundled-sqlite = ["sqlite", "matrix-sdk/bundled-sqlite"]
# Use IndexedDB for the session storage.
indexeddb = ["matrix-sdk/indexeddb"]
unstable-msc4274 = ["matrix-sdk-ui/unstable-msc4274"]
# Required when targeting a Javascript environment, like Wasm in a browser.
js = ["matrix-sdk-ui/js"]
Expand All @@ -51,7 +56,6 @@ matrix-sdk = { workspace = true, features = [
"experimental-widgets",
"markdown",
"socks",
"sqlite",
"uniffi",
] }
matrix-sdk-base.workspace = true
Expand Down
18 changes: 10 additions & 8 deletions bindings/matrix-sdk-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
This uses [`uniffi`](https://mozilla.github.io/uniffi-rs/Overview.html) to build the matrix bindings for native support and wasm-bindgen for web-browser assembly support. Please refer to the specific section to figure out how to build and use the bindings for your platform.

## Features

Given the number of platforms targeted, we have broken out a number of features

### Platform specific
### Platform specific

- `rustls-tls`: Use Rustls as the TLS implementation, necessary on Android platforms.
- `native-tls`: Use the TLS implementation provided by the host system, necessary on iOS and Wasm platforms.

### Functionality

- `sentry`: Enable error monitoring using Sentry, not supports on Wasm platforms.
- `bundled-sqlite`: Use an embedded version of sqlite instead of the system provided one.
- `sqlite`: Use SQLite for the session storage.
- `bundled-sqlite`: Use an embedded version of SQLite instead of the system provided one.
- `indexeddb`: Use IndexedDB for the session storage.

### Unstable specs

- `unstable-msc4274`: Adds support for gallery message types, which contain multiple media elements.

## Platforms

Each supported target should use features to select the relevant TLS system. Here are some suggested feature flags for the major platforms:
Each supported target should use features to select the relevant TLS system. Here are some suggested feature flags for the major platforms:

- Android: `"bundled-sqlite,unstable-msc4274,rustls-tls,sentry"`
- iOS: `"bundled-sqlite,unstable-msc4274,native-tls,sentry"`
- Javascript/Wasm: `"unstable-msc4274,native-tls"`
- JavaScript/Wasm: `"indexeddb,unstable-msc4274,native-tls"`

### Swift/iOS sync



### Swift/iOS async

TBD
13 changes: 10 additions & 3 deletions bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use anyhow::{anyhow, Context as _};
use futures_util::pin_mut;
#[cfg(not(target_family = "wasm"))]
use matrix_sdk::media::MediaFileHandle as SdkMediaFileHandle;
#[cfg(feature = "sqlite")]
use matrix_sdk::STATE_STORE_DATABASE_NAME;
use matrix_sdk::{
authentication::oauth::{
AccountManagementActionFull, ClientId, OAuthAuthorizationData, OAuthSession,
Expand Down Expand Up @@ -39,7 +41,6 @@ use matrix_sdk::{
sliding_sync::Version as SdkSlidingSyncVersion,
store::RoomLoadSettings as SdkRoomLoadSettings,
Account, AuthApi, AuthSession, Client as MatrixClient, Error, SessionChange, SessionTokens,
STATE_STORE_DATABASE_NAME,
};
use matrix_sdk_common::{stream::StreamExt, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_ui::{
Expand Down Expand Up @@ -242,13 +243,18 @@ impl From<matrix_sdk::TransmissionProgress> for TransmissionProgress {
#[derive(uniffi::Object)]
pub struct Client {
pub(crate) inner: AsyncRuntimeDropped<MatrixClient>,

delegate: OnceLock<Arc<dyn ClientDelegate>>,

pub(crate) utd_hook_manager: OnceLock<Arc<UtdHookManager>>,

session_verification_controller:
Arc<tokio::sync::RwLock<Option<SessionVerificationController>>>,

/// The path to the directory where the state store and the crypto store are
/// located, if the `Client` instance has been built with a SQLite store
/// backend.
/// located, if the `Client` instance has been built with a store (either
/// SQLite or IndexedDB).
#[cfg_attr(not(feature = "sqlite"), allow(unused))]
store_path: Option<PathBuf>,
}

Expand Down Expand Up @@ -1597,6 +1603,7 @@ impl Client {
self.inner.event_cache().clear_all_rooms().await?;

// Delete the state store file, if it exists.
#[cfg(feature = "sqlite")]
if let Some(store_path) = &self.store_path {
debug!("Removing the state store: {}", store_path.display());

Expand Down
Loading
Loading