Commit Graph

10714 Commits

Author SHA1 Message Date
Jonas Platte
4043f9bf5d refactor(sdk): Un-cfg SendAttachment::with_send_progress_observable
It (now) compiles on WASM just fine.
2025-01-10 03:02:37 -05:00
Jonas Platte
ff5dcbf631 refactor(common): Warn if LinkedChunk::updates() return value is not used 2025-01-09 16:20:51 -05:00
Jonas Platte
6c053a86bf chore: Fix new nightly warnings 2025-01-09 16:20:51 -05:00
Benjamin Bouvier
0cae54cc3f chore(ui): rename "utils" to "algorithms"
It only contains functions used to search items in the timeline now \o/
2025-01-09 17:27:53 +01:00
Benjamin Bouvier
692aceba50 chore(ui): move RelativePosition in timeline/controller 2025-01-09 17:27:53 +01:00
Benjamin Bouvier
c4a86a3d0a chore(ui): move timeline/read_receipts to timeline/controller/read_receipts
Read receipts only make sense in the context of the timeline controller.
2025-01-09 17:27:53 +01:00
Benjamin Bouvier
5f5aa81174 chore(ui): move date and timestamp functionality to timeline/date_dividers.rs
`util.rs` files are… not the best thing. These types and functions were
only used by the date dividers file, so let's move them there.
2025-01-09 17:27:53 +01:00
Benjamin Bouvier
6e0f258a39 chore(sdk): move send_queue.rs to send_queue/mod.rs 2025-01-09 17:27:53 +01:00
Stefan Ceriu
c4bfbd0f44 feat(ffi): move tracing setup from the final client to the ffi layer (#4492)
Having the final clients define the tracing filters / log levels proved
to be tricky to keep in check resulting missing logs (e.g. recently
introduced modules like the event cache) or unexpected behaviors (e.g.
missing panics because we don't set a global filter). As such we decided
to move the tracing setup and default definitions over to the rust side
and let rust developers have full control over them.

We will now take a general log level and optional extra targets and 
apply them on top of the rust side defined defaults. Targets that log
more than the requested by default will remain unchanged while the
others will increase their log levels to match. Certain targets like
`hyper` will be ignored in this step as they're too verbose others 
like `matrix_sdk` because they're too generic.
2025-01-09 18:08:44 +02:00
Benjamin Bouvier
8e0ee47637 refactor(event cache): eliminate intermediate function append_events_locked
and replace it with an inlined call to `append_events_locked_impl`,
that's then renamed `append_events_locked`.
2025-01-09 15:36:36 +01:00
Benjamin Bouvier
0915eeed51 chore(event cache): simplify and add logs to RoomEventCacheState::propagate_changes 2025-01-09 15:36:36 +01:00
Benjamin Bouvier
fb54e869e9 chore(event cache): add more logs when the event cache tasks are shutting down 2025-01-09 15:36:36 +01:00
Benjamin Bouvier
9e97ed3134 test(event cache): add a regression test for not deleting a gap that wasn't inserted 2025-01-09 12:12:12 +01:00
Benjamin Bouvier
b926c4287a refactor(event cache): use a more fine-grained check for the gap removal 2025-01-09 12:12:12 +01:00
Ivan Enderlin
ddf4d575b7 fix(sdk): Ensure a gap has been inserted before removing it.
This patch fixes a bug where the code assumes a gap has been inserted,
and thus, is always present. But this isn't the case. If `prev_batch`
is `None`, a gap is not inserted, and so we cannot remove it. This patch
checks that `prev_batch` is `Some(_)`, which means the invariant is
correct, and the code can remove the gap.
2025-01-09 12:12:12 +01:00
Damir Jelić
2a954e3ce3 fix(base): Correctly name the LeftRoomUpdate in its debug implementation (#4487)
Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
2025-01-09 11:10:33 +00:00
Jonas Platte
b837865226 refactor(ui): Inherit Send / Sync bounds on RoomDataProvider from super traits 2025-01-09 09:26:55 +01:00
Jonas Platte
eac5a5eb35 refactor(ui): Fix unused import on wasm 2025-01-09 09:26:55 +01:00
Jonas Platte
d6c64027f6 refactor(sdk): Un-cfg Client::rooms_stream
It compiles on WASM too.
2025-01-09 09:26:55 +01:00
Ivan Enderlin
df4b69666c chore: Make Clippy and wasm-pack happy. 2025-01-08 21:30:41 +01:00
Ivan Enderlin
5675ac7f46 refactor(sdk): Remove SlidingSyncRoomInner::client.
This patch removes `SlidingSyncRoomInner::client` because, first
off, it's not `Send`, and second, it's useless. Nobody uses it, it's
basically dead code… annoying dead code… bad dead code!
2025-01-08 21:30:41 +01:00
Ivan Enderlin
6b2233f8c4 fix(sdk): Use spawn from matrix_sdk_common to make it compatible with wasm32-u-u. 2025-01-08 21:30:41 +01:00
Ivan Enderlin
61dd560499 feat: Remove the experimental-sliding-sync feature flag.
Sliding sync is no longer experimental. It has a solid MSC4186, along
with a solid implementation inside Synapse. It's time to consider it
mature.

The SDK continues to support the old MSC3575 in addition to MSC4186.
This patch only removes the `experimental-sliding-sync` feature flag.
2025-01-08 21:30:41 +01:00
Damir Jelić
62567ca6eb refactor(crypto): Use the simplified locks across the crypto crate 2025-01-08 18:59:22 +01:00
Damir Jelić
46dc2a9c5e refactor: Use the simplified locks in the failures cache 2025-01-08 18:59:22 +01:00
Damir Jelić
891583b70e refactor: Add Mutex and RwLock wrappers that panic on poison 2025-01-08 18:59:22 +01:00
Ivan Enderlin
e19bdbfd59 test(ui): Adjust tests according to the new Timeline behaviour. 2025-01-08 17:04:58 +01:00
Ivan Enderlin
14d0cc1935 refactor(ui): Remove TimelineSettings::vectordiffs_as_inputs.
From now on, this patch considers that `VectorDiff`s are the official
input type for the `Timeline`, via `RoomEventCacheUpdate` (notably
`::UpdateTimelineEvents`).

This patch removes `TimelineSettings::vectordiffs_as_inputs`. It thus
removes all deduplication logics, as it is supposed to be managed by the
`EventCache` itself.
2025-01-08 17:04:58 +01:00
Ivan Enderlin
b8d0384da7 refactor: Remove RoomEventCacheUpdate::AddTimelineEvents.
This patch removes the `AddTimelineEvents` variant from
`RoomEventCacheUpdate` since it is replaced by `UpdateTimelineEvents`
which shares `VectorDiff`.

This patch also tests all uses of `UpdateTimelineEvents` in existing
tests.
2025-01-08 17:04:58 +01:00
Ivan Enderlin
4e0a6d15ca chore(sdk): Merge imports for the sake of clarity. 2025-01-08 17:04:58 +01:00
Ivan Enderlin
251433382f chore(test): Remove a warning.
`owned_user_id` is only used by a test behind the
`experimental-sliding-sync` feature flag.
2025-01-08 17:04:58 +01:00
Benjamin Bouvier
34e993435d fix(ffi): ensure the log level for panic is always set (#4485)
If it's present, we just let it untouched. Otherwise, we set it to
`error` if it's missing. See code comment explaining why we need this.

This makes sure we log panics at the FFI layer, since the `log-panics`
crate will use the `panic` target at the error level.
2025-01-08 15:51:14 +00:00
Benjamin Bouvier
dc2775e194 chore!(ffi): rename thumbnail_url to thumbnail_path
This is a breaking change because uniffi may use foreign-language named
parameters based on the Rust parameter name.
2025-01-08 14:20:06 +01:00
Benjamin Bouvier
45c3752cae refactor!(ffi): common out more code in send_attachment and distinguish early from late errors
Some errors can be handled immediately and don't need a request to be
spawned, e.g. invalid mimetype and so on. The returned task handle still
deals about "late" errors about the upload failing (for sync uploads) or
the send queue failing to push the media upload (for async uploads).
2025-01-08 14:20:06 +01:00
Benjamin Bouvier
ed178602d7 chore!(ffi): group parameters to upload in UploadParameters
Note: `Box<dyn ProgressWatcher>` couldn't be put in a `Record`, so
doesn't belong in `UploadParameters` as a result.
2025-01-08 14:20:06 +01:00
Benjamin Bouvier
35a03278c3 chore(ffi): rename url to filename in the FFI methods for sending attachments 2025-01-08 14:20:06 +01:00
Valere
9e69b631ee Merge pull request #4450 from matrix-org/valere/serialize_known_sender_data_b64
fix(crypto): Serialize sender data msk in base64 instead of numbers
2025-01-08 14:06:13 +01:00
Valere
5ff556f6c3 fix(crypto): Serialize sender data msk in base64 instead of numbers 2025-01-08 13:22:37 +01:00
Ivan Enderlin
d64960679f refactor(sdk): Rename RoomEvents::filter_duplicated_events.
This patch renames `RoomEvents::filter_duplicated_events` to
`collect_valid_and_duplicated_events` as I believe it improves the
understanding of the code. The variables named `unique_events` are
renamed `events` as all (valid) events are returned, not only the unique
ones.
2025-01-08 13:01:59 +01:00
Ivan Enderlin
7ff1170681 chore: Re-indent. 2025-01-08 11:47:24 +01:00
Ivan Enderlin
55e25a3717 feat(sdk,ui): Add EventsOrigin::Pagination.
This patch adds the `Pagination` variant to the `EventsOrigin` enum.
Not something really mandatory and that is likely to fix a bug, but it's
now correct.
2025-01-08 11:43:03 +01:00
Joe Groocock
3f977b79fa feat(timeline): allow sending mentions along with media
Since 8205da898e it has been possible to
attach (intentional) mentions to _edited_ media captions, but the
send_$mediatype() timeline APIs provided no way to send them with the
initial event. This fixes that.

Signed-off-by: Joe Groocock <me@frebib.net>
2025-01-08 10:43:43 +01:00
Benjamin Bouvier
aca8c8b8ee chore: remove some allow(dead_code) annotations and associated dead code (#4472)
We have quite a few `allow(dead_code)` annotations. While it's OK to use
in situations where the Cargo-feature combination explodes and makes it
hard to reason about when something is actually used or not, in other
situations it can be avoided, and show actual, dead code.
2025-01-08 10:37:18 +01:00
Kévin Commaille
47c24b9a17 fix(sdk): Fix test now that Ruma is fixed
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-08 10:35:28 +01:00
Kévin Commaille
47445b10f1 chore: Upgrade Ruma
This is using the ruma-0.12 branch where non-breaking changes are backported.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-08 10:35:28 +01:00
Jonas Platte
c5a9a1e215 Clean up some imports
With experimental-sliding-sync enabled and e2e-encryption disabled,
there were a bunch of warnings about unused imports. This fixes them
(but a few warnings about other unused items remain).
2025-01-08 09:18:56 +01:00
Benjamin Bouvier
2ef14ded41 refactor(event cache): a few AllEventsCache refactorings (#4471)
I was investigating a potential deadlock with the event cache storage,
and only found a few places where to make the code a bit more idiomatic
and more readable.
2025-01-07 17:25:52 +01:00
Benjamin Bouvier
8205da898e feat(send queue): allow setting intentional mentions in media captions edits
Fixes #4302.
2025-01-07 16:52:53 +01:00
Benjamin Bouvier
618e47250d feat!(base): reintroduce Room::display_name
`compute_display_name` is made private again, and used only within the
base crate. A new public counterpart `Room::display_name` is introduced,
which returns a cached value for, or computes (and fills in cache) the
display name. This is simpler to use, and likely what most users expect
anyways.
2025-01-07 15:25:32 +01:00
Benjamin Bouvier
5110aa64aa doc(base): update lying doc comment of compute_display_name
It claimed that it would immediately return when the cached display name
value was computed, but that's absolutely not the case.

Spotted while reviewing a PR updating `iamb` to the latest version of
the SDK.
2025-01-07 14:39:07 +01:00