Commit Graph

6756 Commits

Author SHA1 Message Date
Benjamin Bouvier
deb8434ee9 test: add a regression test for the spurious crypto store regeneration 2023-07-28 15:21:12 +02:00
Damir Jelić
63ce957843 fix: don't rely on having sessions in cache priori to encrypting a message 2023-07-28 15:06:12 +02:00
Benjamin Bouvier
819b46f2fb test: add regression test for invalidating the OlmMachine while sending a message 2023-07-28 15:06:12 +02:00
Marco Romano
5c71087b9c Upgrade Ruma
This is to pave the way to the upcoming "polls" work.
2023-07-28 08:38:50 +00:00
Jonas Platte
d865665420 ffi: Replace tracing-android by paranoid-android 2023-07-27 18:25:15 +02:00
Jonas Platte
5f5028ddd0 ffi: Remove redundant dependency specification 2023-07-27 18:25:15 +02:00
Jonas Platte
8703fea24f ffi: Simplify OTLP tracing initialization 2023-07-27 18:25:15 +02:00
Benjamin Bouvier
ab363aa420 chore: slim down UpdateSummary 2023-07-27 17:21:36 +02:00
Jonas Platte
b66cd58a60 ui: Reduce work for updating sender profiles
… we should not be fetching the profile if it's already set.
2023-07-27 16:45:57 +02:00
Ivan Enderlin
7892b8b74a feat(sdk+ui+ffi): Implement (SlidingSyncRoom|Room|RoomListItem)::avatar_url
feat(sdk+ui+ffi): Implement `(SlidingSyncRoom|Room|RoomListItem)::avatar_url`
2023-07-27 16:33:33 +02:00
Jonas Platte
fc3883d08e ffi: Remove async from a few functions
… to hopefully work around current issues.
2023-07-27 12:37:02 +02:00
Ivan Enderlin
c2a8fbd3c9 feat(ui): Implement the “fuzzy match room name” filter
feat(ui): Implement the “fuzzy match room name” filter
2023-07-27 12:32:47 +02:00
Andrew Ferrazzutti
53668d764c Return a KeysBackupRequest instead of the more generic OutgoingRequest 2023-07-27 12:12:08 +02:00
Ivan Enderlin
936a2ee25b chore(sdk): Remove one TODO in Sliding Sync
chore(sdk): Remove one `TODO` in Sliding Sync
2023-07-27 10:37:45 +02:00
Benjamin Bouvier
1f10af9fa9 chore(encryption): replace some AuthenticationRequired with NoOlmMachine
Even if the two issues are likely caused by the same root cause (the user not being
authenticated), they should be used in different contexts, in my understanding:

- the authentication required error should happen only during HTTP requests
- the absence of olm machine should be signalled when we try to get one and it's not been initialized yet

This has caused a bit of confusion when looking at debug traces today, so this patches fixes it.
2023-07-27 10:36:57 +02:00
Ivan Enderlin
38a8ad0a66 chore(ci): Make typos happy. 2023-07-27 10:10:45 +02:00
Ivan Enderlin
d1d6bcdcab doc(ui): Add missing documentation. 2023-07-27 10:10:45 +02:00
Ivan Enderlin
3e93bdbc3f feat(ui): Normallize strings when doing fuzzy matching. 2023-07-27 09:20:43 +02:00
Ivan Enderlin
63ca82c66c feat(ui): Implement the “fuzzy match room name” filter.
WIP
2023-07-26 18:22:14 +02:00
Ivan Enderlin
0c16ff1ae7 chore(cargo): Update ruma. 2023-07-26 16:38:23 +02:00
Ivan Enderlin
a8e5d3ab17 feat(ffi): Update RoomListItem::avatar_url.
This patch updates `RoomListItem::avatar_url` to use
`matrix_sdk_ui::room_list_service::Room::avatar_url` instead of
`matrix_sdk::Room::avatar_url`.

This patch also moves `avatar_url` before `is_direct` (so that it's the
same order as other places in the code).
2023-07-26 16:38:23 +02:00
Chris Smith
af44ac6be4 ffi: Define API stub for m.poll.start and m.poll.end 2023-07-26 14:26:03 +00:00
Ivan Enderlin
38d28e9aa0 feat(ui): Implement Room::avatar_url.
This patch implements `Room::avatar_url`. It tries to calculate
the best avatar URL as much as possible. It's either the URL from
`SlidingSyncRoom::avatar_url` or from `Room::avatar_url`.
2023-07-26 16:06:11 +02:00
Ivan Enderlin
62a203f41e feat(sdk): Implement SlidingSyncRoom::avatar_url.
Based on https://github.com/ruma/ruma/pull/1607, this patch adds
support for `avatar` from a sliding sync response. This patch implements
`SlidingSyncRoom::avatar_url` to get the avatar URL of a sliding sync
room.
2023-07-26 16:06:11 +02:00
Ivan Enderlin
15a6861b8c chore(sdk): Remove one TODO.
The batch subscriber exists in `matrix_sdk_ui::RoomList` (https://
github.com/matrix-org/matrix-rust-sdk/pull/2322) instead of being added
here.

We must keep the observable capacity to 4096, but the `TODO` is no
longer relevant.

Why keeping the capacity to 4096? Because if the batch subscriber (in
`RoomList`) isn't “listened” quickly, we don't want to get a `Reset`.
2023-07-26 15:24:24 +02:00
Ivan Enderlin
163d8ca517 feat(ui): Batch the streams returned by RoomList::entries and RoomList::entries_filtered.
feat(ui): Batch the streams returned by `RoomList::entries` and `RoomList::entries_filtered`.
2023-07-26 15:18:43 +02:00
Ivan Enderlin
efd1d1e9d2 chore(cargo): Use latest version of async-rx. 2023-07-26 14:25:50 +02:00
Ivan Enderlin
8a21a8a6da chore(ui): Address some feedbacks. 2023-07-26 14:19:17 +02:00
Ivan Enderlin
2302a7b377 feat(ui): Use Subscriber<State> to simply drain the batch subscriber for entries.
This patch brings a nice code simplification.

Instead of creating a new `Stream` with `tokio` based on
`Subscriber<State>`` to drain the batch subscriber for
`RoomList::entries` and `::filtered_entries`, we can _simply_ use
`Subscriber<State>` directly! It removes one dependency: `tokio-
stream`, and remove possible issues with the broadcast channel
`tokio::sync::broadcast`. The code is much simpler and straighforward.
2023-07-26 14:07:46 +02:00
Benjamin Bouvier
7469d1c7d8 chore: remove all experimental features on the UI crate
As discussed, we think the entire UI crate should be considered experimental. We've also
observed a proliferation of feature flags there (many of those are my wrong doings, sorry).
Since the one internal user (FFI) of that crate enabled all experimental features, it seems
fine to make them all default, while not providing any extra stability guarantee based on that
action.
2023-07-26 13:35:40 +02:00
Benjamin Bouvier
2cec3b0c45 feat: Run a SlidingSync when retrieving notifications to get more information (#2252)
* feat: run a room sliding sync upon receiving a notification, to get its full content

* test: add test for the new sliding-sync in notifications \o/

* fix: try to get the push rules *after* a possibly-successful event decryption

* feat: set `is_noisy` only if we could build a push context, and test it

* feat: expose the `legacy_get_notification` in the FFI layer

* feat: retrieve events with a `/context` query

* fix: also request the client's user id's member information to get their display name

* feat: include the list of invites in the notification sliding sync

* feat: repeat the query multiple times if the event hasn't been immediately found

* chore: simplify retrying decryption

* chore: fail the sliding sync when fetching a notification if not using a memory store

* chore: update test expectations + sort invites by recency

* chore: cargo fmt

* chore: simplify getting push actions

Either they were already available in the timeline event if we had to re-run decryption, or
we manually compute them. (Previous comment was incorrect, the `push_actions` are now optional
because of another PR of yours truly.)

* fixup! chore: fail the sliding sync when fetching a notification if not using a memory store

* feat: try to handle invites correctly

* chore: build a local client with an in-memory store instead of reusing the parent client

* fix: remove dubious annotation

* feat: allow cloning a Client and modify it on the fly, use that for the notification client

* feat: get rid of the with_memory_state_store public func on ClientBuilder

* feat: include sender_id in the notification invite event

* feat: put sender's id in the `NotificationSenderInfo`

* feat: inherit the parent session when creating a notification client

* chore: reformat comments

* TMP: add logs

* chore: regenerate the olm machine when inheriting a session too

* chore: keep the parent client around for legacy_get_notification/with_context
2023-07-25 17:23:01 +00:00
Benjamin Bouvier
483465e8a8 feat(sliding sync): include the connection id conn_id in the tracing context 2023-07-25 18:49:37 +02:00
Benjamin Bouvier
bef9cbfacc feat: rename Protocol to Scheme + replace server_name_with_protocol by insecure_server_name_no_tls 2023-07-25 18:43:35 +02:00
Benjamin Bouvier
122349ecec feat: allow specifying a protocol along a server name 2023-07-25 18:43:35 +02:00
Benjamin Bouvier
020d5aa292 fix: use a little state machine to handle the response
and that allows to make sure that all event handlers are correctly called for all
events contained in the response.
2023-07-25 17:36:43 +02:00
Benjamin Bouvier
fb5c96e380 test: add test for previous feature 2023-07-25 17:36:43 +02:00
Benjamin Bouvier
8a809dba04 feat(sliding sync): only process encryption events (resp. room events) if configured as so 2023-07-25 17:36:43 +02:00
Benjamin Bouvier
da7d1b092e chore(encryption sync): lower severity of update summary logging
The proxy server can (and does) redispatch unrelated lists/rooms from other sliding sync connections,
so the encryption sync would sometimes see room events. Apparently since this is not considered a bug
in the SS proxy, so we shouldn't spam error traces every time this happens.
2023-07-25 17:36:43 +02:00
Jonas Platte
04aac7bc13 ui: Redact replied-to event inside in_reply_to in timeline 2023-07-25 15:31:14 +02:00
Jonas Platte
004a4aa765 ui: Fix redactions for state events in the timeline 2023-07-25 15:31:14 +02:00
Jonas Platte
09fea85d92 ui: Replace Message by TimelineItemContent in RepliedToEvent 2023-07-25 15:31:14 +02:00
Jonas Platte
d93f4ee4cc Fix clippy lint 2023-07-25 15:31:14 +02:00
Jonas Platte
eb4dab138e ffi: Spawn tokio tasks for the remaining async fns
… as a workaround for cancellation being broken in UniFFI.
2023-07-25 14:34:31 +02:00
Damir Jelić
0a361eff5c Mark our public part of the user identity as verified if we import the private part (#2298)
Co-authored-by: Denis Kasak <dkasak@termina.org.uk>
2023-07-25 12:39:06 +02:00
Jonas Platte
bf26a343da ffi: Spawn tokio tasks for async code that locks async mutexes
Since we seem to have a problem with futures being leaked in Kotlin,
which can otherwise lead to deadlocks.
2023-07-24 20:01:27 +02:00
Ivan Enderlin
d60a65f82b chore: Make Clippy happy. 2023-07-24 16:59:46 +02:00
Ivan Enderlin
d39cbd865b feat(ffi): RoomListEntriesListener::on_update takes a Vec<_> now.
Since `RoomList::entries` returns a batch stream, the listener
now receives a `Vec<VectorDiff<RoomListEntry>>` instead of a
`VectorDiff<RoomListEntry>`.
2023-07-24 16:53:26 +02:00
Ivan Enderlin
3bcd9680fd test(ui): Test the new batch stream on entries and filtered entries.
Only updated the macro is required here. Instead of calling
`StreamExt::now_or_never` on the `$stream`, we call `Iterator::next` on
`$entries` which is a `Vec<VectorDiff<_>>` now.
2023-07-24 16:53:26 +02:00
Ivan Enderlin
1678d0754d feat(ui): Batch the stream returned by RoomList::entries and RoomList::entries_filtered.
This patch uses a newly implemented `async-rx` crate, that provides
`StreamExt`. This trait provides new features on `Stream`, like
`StreamExt::batch_with` which allows to batch values generated by a
`Stream` into a `Vec<Stream::Item>`. The batch is drained based on
another `Stream`: every time a value is produced, it drains the batch
stream.

This feature is used in `RoomList::entries` and
`RoomList::entries_filtered` to batch `Stream<Item = VectorDiff<_>>`
into `Stream<Item = Vec<VectorDiff<_>>>`.

The “drainer” is a broadcast sender, which sends an (empty) value every
time the room list service state changes, so every time something
happens during a sync. Note that it even drains when the room list
service state jumps to `Error` or `Terminated`.
2023-07-24 16:53:26 +02:00
Ivan Enderlin
ac950ac253 doc(sdk): Update documentation of RoomListEntry variants. 2023-07-24 15:12:30 +02:00