Commit Graph

12239 Commits

Author SHA1 Message Date
Jonas Platte
2a140770a0 fix: Move runtime module from matrix-sdk-common to matrix-sdk-ffi (#5184)
This module only builds on non-wasm with the patched async-compat from
the workspace Cargo.toml's patch section, and it is only used by the ffi
crate. It is currently breaking the use of the SDK as a git dependency,
and would prevent the publishing of matrix-sdk-common (unless using
--no-verify, but then that would just break all users of the newly
published crates.io version).

This bug was introduced in
https://github.com/matrix-org/matrix-rust-sdk/pull/5089.

Signed-off-by: Jonas Platte <jplatte+matrix@posteo.de>
2025-06-05 19:30:15 +00:00
Jorge Martín
becbb63ad7 feat(ffi): Subscribe to a room's RoomInfo through Client
This helps in the case we want to observe the membership state changes - or some other info - for a room that's still not known so we can't just use `Client::get_room` to fetch it.
2025-06-05 16:49:39 +02:00
Damir Jelić
34d3cd496b feat(multiverse): Show thread roots even if we can't find the latest message 2025-06-05 16:29:54 +02:00
Damir Jelić
1f9c3394c5 refactor(multiverse): Split out the timeline item formatting logic 2025-06-05 16:29:54 +02:00
Damir Jelić
005f002747 feat(multiverse): Start to render threads 2025-06-05 16:29:54 +02:00
Damir Jelić
80b8a6d8cc feat(multiverse): Allow timeline items to be selected 2025-06-05 16:29:54 +02:00
Valere
f7265c39e0 cleanup: Reuse existing server.mock_sync instead of custom function 2025-06-05 14:29:50 +02:00
Valere
4468c36b14 review: extend existing MatrixMockServer instead of creating another 2025-06-05 14:29:50 +02:00
Valere
25841c787e refactor(test): Extract common crypto mock server helper 2025-06-05 14:29:50 +02:00
Damir Jelić
9461ef3a5a chore: Fix a typo in the cargo-deny file 2025-06-05 11:11:40 +02:00
Johannes Marbach
b8ae210e4a feat(ffi): Add reply_params to GalleryUploadParameters (#5173)
Looks like I forgot adding this in
https://github.com/matrix-org/matrix-rust-sdk/pull/5163, sorry.
Everything below the FFI layer was already prepared for replies.

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-06-05 10:07:32 +01:00
Daniel Salinas
a3225e5cd7 feat(wasm): Wasm equivalent of get_runtime_handle and corresponding tokio types (#5089)
Adds a Wasm equivalent of the get_runtime_handle method provided by
tokio, as well as Handle/Runtime types that can be used on either Wasm
or non-Wasm platforms interchangeably.

Dependent on https://github.com/matrix-org/matrix-rust-sdk/pull/5088
<!-- description of the changes in this PR -->

- [ ] Public API changes documented in changelogs (optional)

<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by: Daniel Salinas

---------

Signed-off-by: Daniel Salinas <zzorba@users.noreply.github.com>
Co-authored-by: Daniel Salinas <danielsalinas@Daniels-MacBook-Pro-2.local>
Co-authored-by: Daniel Salinas <danielsalinas@daniels-mbp-2.myfiosgateway.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2025-06-05 08:07:01 +02:00
Daniel Salinas
0777e6e08a feat(wasm): Enable subscribe_to_send_progress on wasm platforms (#5170) 2025-06-04 18:13:47 +02:00
Daniel Salinas
8b2088fd61 feat(wasm): Eliminate some unecessary wasm removals from matrix-sdk crate (#5169) 2025-06-04 18:13:27 +02:00
Johannes Marbach
d38f409351 feat(ffi): Expose method for sending galleries (#5163)
Addendum to https://github.com/matrix-org/matrix-rust-sdk/pull/5125 to
allow sending galleries from the FFI crate. This is the final PR for
galleries (apart from possible enhancements to report the upload status
in https://github.com/matrix-org/matrix-rust-sdk/pull/5008).

This is somewhat lengthy again, apologies. Most of the changes are just
wrappers and type mapping, however. So I was hoping that it's relatively
straightforward to review in bulk. Happy to try and elaborate on the
changes or break them up into smaller commits if that helps, however.

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-06-04 16:41:03 +02:00
Daniel Salinas
58b8a2560c feat(wasm): Comprehensive Send+Sync bound improvements for Wasm compatibility (#5082)
This commit systematically replaces Send+Sync trait bounds throughout
the matrix-rust-sdk codebase to enable Wasm compatibility while
maintaining thread safety on native targets.

Key changes:
- Use SendOutsideWasm/SyncOutsideWasm traits instead of Send/Sync for
trait bounds
- Apply conditional compilation for error types and trait objects
- Update FFI trait definitions to use Wasm-compatible bounds
- Fix event handler and type alias definitions for cross-platform
compatibility
- Maintain existing functionality while enabling WebAssembly target
support

The SendOutsideWasm/SyncOutsideWasm traits are empty on Wasm (allowing
all types) and alias to Send/Sync on native targets, ensuring zero-cost
abstraction.

Files updated:
- All FFI bindings (30+ trait definitions)
- Core SDK error types and type aliases
- Event handler infrastructure
- Store and crypto abstractions
- UI service filters and sorters
- Timeline and authentication modules

<!-- description of the changes in this PR -->

- [ ] Public API changes documented in changelogs (optional)

<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by: Daniel Salinas

---------

Signed-off-by: Daniel Salinas <zzorba@users.noreply.github.com>
Co-authored-by: Daniel Salinas <danielsalinas@Daniels-MacBook-Pro-2.local>
Co-authored-by: Daniel Salinas <danielsalinas@daniels-mbp-2.myfiosgateway.com>
2025-06-04 15:59:37 +02:00
Daniel Salinas
edb7a0f433 Add Wasm platform aware test to export proc-macro 2025-06-04 12:32:33 +02:00
Valere Fedronic
0f73ffde68 feat(crypto): Add the EncryptionInfo to the Decrypted ProcessedToDeviceEvent variant
The `ProcessedToDeviceEvent::Decrypted` variant now also have an
`EncryptionInfo` field.

The enum variant  changed from `Decrypted(Raw<AnyToDeviceEvent>)` to `Decrypted {
raw: Raw<AnyToDeviceEvent>, encryption_info: EncryptionInfo) }`
2025-06-04 11:54:38 +02:00
Daniel Salinas
d3be744244 feat(wasm): Remove direct use of tokio::spawn in favor of matrix-sdk-common (#5159)
Mechanical move from tokio::spawn to matrix_sdk_common::executor::spawn
that has support for Wasm platforms. On non-Wasm, this shim defaults to
tokio::spawn.
2025-06-03 12:22:53 -04:00
Andy Balaam
ca63d60068 doc(crypto): Add missing word 'verify' in 'verify_device' docs 2025-06-03 17:04:48 +02:00
Damir Jelić
8cc3b0fa33 refactor(multiverse): Add a common method to execute commands on rooms 2025-06-03 16:46:17 +02:00
Damir Jelić
bf201e317e feat(multiverse): Add a /leave command 2025-06-03 16:46:17 +02:00
Benjamin Bouvier
fe11fda832 refactor(timeline): extract the method to fetch a latest thread reply as an item
Do the ~~~loco~~ code motion 🎶
2025-06-03 16:28:25 +02:00
Benjamin Bouvier
281faa7a0b refactor(ffi): simplify From<TimelineDetails<Profile>> for ProfileDetails 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
7962253ebd refactor(timeline): only use the publicly exposed content/sender/sender_profile on EmbeddedEvent 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
dd14df086e refactor(ffi): simplify FFI layer and use only EmbeddedEventDetails there for both thread latest event + replied-to event item 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
c426138971 refactor(timeline): rename RepliedToEvent to EmbeddedEvent and reuse it for the thread summary 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
ff4b7a8acc feat(event cache): add basic support for the latest event in the thread summary 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
a152f9c074 refactor(event cache): remove one caller of with_events_mut
The actual code useful in `with_events_mut` and used in that function
was to propagate the changes to the store and propagating diffs to
observers. It often striked me as hacky to use this method to do that,
so instead I'm proposing here to inline the useful bits. That way,
`with_events_mut` is now clearly called only in two cases: after a sync,
or after a successful network back-pagination.
2025-06-03 16:28:25 +02:00
Benjamin Bouvier
50be8a158c refactor(event cache): only send a thread summary update when a thread has changed 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
aa291079d0 feat(event cache): include the reply count in the ThreadSummary 2025-06-03 16:28:25 +02:00
Benjamin Bouvier
672bb9f460 feat: add the busy timeout pragma to the event cache store acquire() method too
It will tell us if this is sufficient to avoid locking the event cache
store database, now that we have some proof that this is happening in
the wild.
2025-06-03 16:17:36 +02:00
Kévin Commaille
9a75007535 Upgrade Ruma
Use the newly released version.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-06-03 15:52:15 +02:00
Johannes Marbach
ee06965d2e feat(timeline): Expose method to send galleries in matrix-sdk-ui (#5125)
This was broken out of
https://github.com/matrix-org/matrix-rust-sdk/pull/4838 and is a step
towards implementing
https://github.com/matrix-org/matrix-spec-proposals/pull/4274. Building
upon https://github.com/matrix-org/matrix-rust-sdk/pull/4977, a new
method `Timeline::send_gallery` in matrix-sdk-ui for sending galleries.

- [x] Public API changes documented in changelogs (optional)

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-06-03 15:24:02 +02:00
Ivan Enderlin
8e3ad22d92 doc(base): Improve documentation.
This patch improves an inline documentation.

Co-authored-by: Stefan Ceriu <stefan.ceriu@gmail.com>
Signed-off-by: Ivan Enderlin <ivan@mnt.io>
2025-06-03 15:04:26 +02:00
Ivan Enderlin
c7f6190cff feat(base): Detecting invalid states in room upgrades.
This patch adds the `check_tombstone` response processor to
detect invalid state with room upgrades. One can check the new
`InconsistentTombstonedRooms` error to learn more about the detected
patterns.
2025-06-03 15:04:26 +02:00
Ivan Enderlin
5ccb1c6fa8 fix(base): Fix the Debug implementation of RoomUpdates.
The field of `RoomUpdates` has been renamed, but the `Debug`
implementation does not reflect that change. This patch fixes that.
2025-06-03 15:04:26 +02:00
Ivan Enderlin
b77a02662d feat(base): Add RoomUpdates::iter_all_room_ids.
This patch adds the `RoomUpdates::iter_all_room_ids` method, to iterate
over all IDs of rooms that have received an update.
2025-06-03 15:04:26 +02:00
Damir Jelić
13306be4ed fix(multiverse): Wait for the join task to finish before switching the view 2025-06-03 14:07:37 +02:00
Yousef Moazzam
491f81c376 test: remove unnecessary image info field values 2025-06-03 13:19:34 +02:00
Yousef Moazzam
703c01004c test: remove unnecessary server timestamp field on sticker event 2025-06-03 13:19:34 +02:00
Yousef Moazzam
b1d34763d4 test: create timeline event with EventBuilder method 2025-06-03 13:19:34 +02:00
Yousef Moazzam
c4aa200f19 test: create sticker event with EventFactory 2025-06-03 13:19:34 +02:00
Yousef Moazzam
a099879563 test: add reply thread relation method to sticker event builder 2025-06-03 13:19:34 +02:00
Yousef Moazzam
b6569762db test: add sticker event method to EventFactory 2025-06-03 13:19:34 +02:00
Jorge Martín
edabb2362b refactor: revert some method removals in SendRequest 2025-06-03 12:59:00 +02:00
Jorge Martín
8a5d4f0d82 test: Increase delay to fix code coverage failure 2025-06-03 12:59:00 +02:00
Jorge Martín
12aed8dc67 test: fix tests after adding the media config check 2025-06-03 12:59:00 +02:00
Jorge Martín
7d03d4ce0d feat(ffi): Add Client::get_max_media_upload_size function
This allows the clients to know the max upload size for a media file and try to compress if it's too large for the homeserver.
2025-06-03 12:59:00 +02:00
Jorge Martín
2680dc65fd fix(sdk): check max_upload_size before attempting to upload any media 2025-06-03 12:59:00 +02:00