Commit Graph

2231 Commits

Author SHA1 Message Date
Damir Jelić
9d732395ce feat(ui): Introduce a "offline" mode for the SyncService 2025-01-31 09:58:55 +01:00
Ivan Enderlin
5b3b87d3e2 chore(ui): Rename Timeline::subscribe_batched to ::subscribe.
This patch renames `Timeline::subscribe_batched` to
`Timeline::subscribe`. Since the `Timeline::subscribe` method has been
removed because unused, it no longer makes sense to have a “batched”
variant here. Let's simplify things!
2025-01-28 09:54:31 +01:00
Ivan Enderlin
254ac6f2ce refactor(ui): Unify the Timeline pagination API.
This patch simplifies the `Timeline` pagination API as follows:

- a unique `paginate_backwards` method (no more
  `focused_paginate_backwards` and `live_paginate_backwards`),
- a unique `paginate_forwards` method (no more
  `focused_paginate_forwards`, the `live` variant was absent).

The idea is to unify pagination by hiding the `live` and `focused` mode.
It was already partially the case with `paginate_backards`, but the
`live` and `focused` variants were also present. I believe it creates
an unnecessary confusion.
2025-01-27 17:02:09 +01:00
Ivan Enderlin
468a7ac883 doc(ffi): Remove useless #[cfg(doc)] imports.
This patch removes 2 useless imports that are behind a `#[cfg(doc)]` but
never used.
2025-01-27 17:02:09 +01:00
Richard van der Hoff
3e610c80e1 Merge pull request #4581 from matrix-org/rav/refactor_share_keys
crypto: refactor the room key sharing strategies
2025-01-27 15:51:04 +00:00
Richard van der Hoff
7c57f2cee4 crypto: split out new device collection strategies
Rather than a bunch of flags on `DeviceBasedStrategy`, separate the strategies
properly.
2025-01-27 15:34:43 +00:00
Stefan Ceriu
2657eb7866 feat(ui): expose a method for checking whether a message contains only emojis and should be boosted (use a bigger font size) (#4577)
- supports only text room message types
- enumerates through their body's grapheme clusters and check that every
single one of them is an emoji
- part of the `LazyTimelineItemProvider` so that it can be opt in
2025-01-27 14:00:01 +00:00
torrybr
aaecbf07f2 refactor: dont panic if beacon_info is not found 2025-01-27 11:05:24 +01:00
torrybr
f336638a17 refactor: move subscribe into arc 2025-01-27 11:05:24 +01:00
torrybr
839fbe477c feat(beacons): expose ffi functions to start, stop and subscribe 2025-01-27 11:05:24 +01:00
Kévin Commaille
3e78e441d4 refactor(sdk): Move oidc module to authentication::oidc
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-22 20:22:13 +01:00
Kévin Commaille
02c2e55855 refactor(sdk): Move matrix_auth module to authentication::matrix
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-22 20:22:13 +01:00
Stefan Ceriu
a528624274 chore(ffi): replace all the different timeline builder methods with one taking a configuration (#4561) 2025-01-22 13:56:53 +02:00
Hubert Chathi
e826c54a42 Use the dehydrated device format implemented by vodozemac (#4421)
Signed-off-by: Hubert Chathi <hubertc@matrix.org>
2025-01-22 09:38:48 +01:00
Stefan Ceriu
2cb6ee8e6d chore(ffi): silence useless logs coming out of the ffi crate
Setting the default log level to `debug` results in logs like:

```
log: log_event
log: latest_event
log: log_event
log: log_event
log: room_info
log: latest_event
log: log_event
log: room_info
```

Presumably they're coming out of the custom tracing configuration and we definitely don't need them.
2025-01-16 15:17:24 +02:00
Jorge Martín
bd5d7aafee feat(ffi): Add FFI bindings for fn Room::own_membership_details.
Also add `membership_change_reason` field to `ffi::RoomMember`.
2025-01-14 16:23:51 +01:00
Daniel Salinas
9641aa9082 feat(send queue): Add an enqueued time to to-be-sent events (#4385)
Add a new created_at to the send_queue_events and
dependent_send_queue_events stored records. This will allow clients to
understand how stale a pending message might be in the event that the
queue encounters and error and becomes wedged.

This change is exposed through the FFI on the `EventTimelineItem` struct
as a new optional field named `local_created_at`. It will be `None` for
any Remote event, and `Some` for Local events (except for those that
were enqueued before the migrations were run).

Signed-off-by: Daniel Salinas

---------

Signed-off-by: Daniel Salinas <zzorba@users.noreply.github.com>
Co-authored-by: Daniel Salinas <danielsalinas@daniels-mbp-2.myfiosgateway.com>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
Co-authored-by: Daniel Salinas <danielsalinas@Daniels-MBP-2.attlocal.net>
2025-01-13 16:41:05 +00:00
Benjamin Bouvier
279c78b3e2 chore!(encryption): rename are_we_the_last_man_standing to is_last_device
While the former name is arguably more fun, the latter is more
descriptive of what the function does.
2025-01-13 16:51:33 +01:00
Jorge Martín
5548f38393 feat(ffi): Add FFI bindings for the new room privacy settings feature. 2025-01-13 11:29:10 +01:00
Valere
a79d409f9d task(bindings): Expose withdraw_verification in UserIdentity 2025-01-10 15:18:12 +01:00
Kévin Commaille
b3491582d0 feat(sdk): Allow to set and check whether an image is animated
Using MSC4230.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-10 14:37:56 +01:00
Jonas Platte
6c053a86bf chore: Fix new nightly warnings 2025-01-09 16:20:51 -05: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
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
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
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
8205da898e feat(send queue): allow setting intentional mentions in media captions edits
Fixes #4302.
2025-01-07 16:52:53 +01:00
Kévin Commaille
c50358366f refactor!(sdk): Set thumbnail in AttachmentConfig with builder method instead of constructor
`AttachmentConfig::with_thumbnail()` is replaced by
`AttachmentConfig::new().thumbnail()`.

Simplifies the use of `AttachmentConfig`, by avoiding code like:

```rust
let config = if let Some(thumbnail) = thumbnail {
  AttachmentConfig::with_thumbnail(thumbnail)
} else {
  AttachmentConfig::new()
};
```

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-12-22 17:45:04 +00:00
Daniel Salinas
f8a9d12c88 Use a type alias to allow bindings to take advantage of custom types 2024-12-20 10:46:13 +01:00
Benjamin Bouvier
5f5e979e16 refactor!: Put the RequestConfig argument of Client::send() into a builder method
Instead of `Client::send(request, request_config)`, consumers can now do
`Client::send(request).with_request_config(request_config)`.
2024-12-20 10:35:18 +01:00
Jorge Martín
616c193a30 feat(room): create a cleanup task in Room::subscribe_to_knock_requests
This cleanup task will run while the knock request subscription runs and will use the `Room::room_member_updates_sender` notification to call `Room::remove_outdated_seen_knock_requests_ids` and remove outdated seen knock request ids automatically.
2024-12-19 14:14:05 +01:00
Integral
f18e0b18a1 Replace PathBuf/Utf8PathBuf with Path/Utf8Path when ownership not needed 2024-12-19 13:29:09 +01:00
Valere
95582a6c3c feat(crypto-bindings): Save/Load dehydrated pickle key
review: better tests
2024-12-17 09:51:28 +01:00
Jorge Martín
866b5fea40 feat(room): Separate RoomState::Banned from RoomState::Left.
This is needed to tell apart rooms in left and banned state in places like `RoomInfo` or `RoomPreview`.

The banned rooms will still count as left rooms in the sync processes.
2024-12-16 19:19:56 +01:00
Benjamin Bouvier
34ea42aec0 feat(ffi): expose the linked chunk debug string function at the FFI layer 2024-12-16 16:41:03 +01:00
Jorge Martín
05d46e6027 Rename JoinRequest in the SDK crates to KnockRequest, make Room::mark_knock_requests_as_seen thread safe and pass user_ids instead of event_ids: the user ids will be used to get the related member state events and they'll only be marked as seen if they're in a knock state.
Also, add extra checks to the integration tests.
2024-12-16 14:08:09 +01:00
Jorge Martín
338769508e feat(ffi): add bindings for subscribing to the join requests 2024-12-16 14:08:09 +01:00
Kévin Commaille
8d2e672996 feat!: Upgrade Ruma to 0.12.0
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-12-16 11:56:44 +01:00
Valere
2b39476d9b feat(crypto): Support storing the dehydrated device pickle key 2024-12-13 13:05:19 +01:00
Richard van der Hoff
780a4630e4 chore(ffi): avoid hardcoding clang version
Update the workaround for https://github.com/rust-lang/rust/issues/109717 to
avoid hardcoding the clang version; instead, run `clang -dumpversion` to figure
it out.

While we're there, use the `CC_x86_64-linux-android` env var, which should
point to clang, rather than relying on `ANDROID_NDK_HOME` to be set.
2024-12-12 12:54:00 +00:00
Richard van der Hoff
fda374ee81 feat(ffi): Add new properties to UnableToDecryptInfo
Followup to https://github.com/matrix-org/matrix-rust-sdk/pull/4360: expose
the new properties via FFI
2024-12-11 18:42:28 +00:00
Stefan Ceriu
634edf2b65 chore(ui): rename all timeline "day dividers" to "date deviders" following the introduction of montly divider mode 2024-12-10 14:11:48 +02:00
Stefan Ceriu
935e4df927 feat(ui): make the timeline date separators configurable; have them appear either when the day changes or when the month changes. 2024-12-10 14:11:48 +02:00
Benjamin Bouvier
32e2070f56 refactor(ffi): use a bool instead of an option to make the API less awkward
By default, the event cache store will be disabled. If disabled, it will
clean all the events in the cache store; most of the time this will do
nothing, since the store will not even be filled with any event data, so
it would be cheap to do. If some data was filled in the cache store
before, then it would be cleared after the cache store has been
disabled.

This makes a less awkward API than the previous one, where `None` and
`Some(false)` carried different semantics.
2024-12-10 12:05:29 +01:00
Benjamin Bouvier
4ee96aaffc feat(event cache): add a way to clear a single room's persistent storage 2024-12-10 12:05:29 +01:00
Benjamin Bouvier
0783cf89ba feat(ffi): add a feature flag to enable persistent storage for the event cache 2024-12-10 12:05:29 +01:00