Commit Graph

1663 Commits

Author SHA1 Message Date
Jorge Martin Espinosa 9cc5cf9a01 Add total unread notification count to home screen (#7891)
* Add total unread notification count to home screen

This will be calculated on each sync heartbeat (for now, using the state updates for the room list service).

* Simplify `counter` parameter logic

* Read the total unread count when the home screen is first displayed

---------

Co-authored-by: Benoit Marty <benoitm@element.io>
2026-10-13 10:58:07 +00:00
Benoit Marty ffe8f4a14e Merge pull request #7900 from element-hq/feature/bma/settingsMainThreadJank
Fix animation glitches when opening the settings
2026-10-13 11:30:36 +02:00
ElementBot 092cded211 Update Matrix Rust SDK to 26.10.07-nightly (#7880)
* Update Matrix Rust SDK to 26.10.07-nightly

* Adapt to the new QR code login task API

`generate()` and `scan()` of `GrantLoginWithQrCodeHandler` and `LoginWithQrCodeHandler`
now return a task instead of suspending until the flow is over. Wait for the task to
complete, and cancel it if the coroutine is cancelled, so that the flow is also stopped
on the Rust side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Add tests for the cancellation of the QR code login tasks

Check that cancelling the coroutine of the link new device handlers and of the QR code
login cancels the task returned by the SDK, so that the flow is stopped on the Rust side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Fix import ordering in the link new device handler tests

ktlint expects the imports to be sorted in lexicographic order.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 11:21:21 +02:00
Benoit Marty 3170ff4422 Remove useless Unit type. 2026-10-13 10:42:05 +02:00
Benoit Marty d5780507c9 Make storeUserProfile main-safe instead of wrapping getUserProfile 2026-10-13 09:28:49 +02:00
Benoit Marty 8912341439 Avoid database access on the main thread when opening the settings
`getUserProfile()` was storing the user profile (DB read, avatar Base64 encoding, DB write) on the caller
dispatcher, i.e. the main thread when called from a presenter, causing glitches in the screen transition.
- Run the whole `getUserProfile()` on the session dispatcher.
- Make `DatabaseSessionStore` main-safe by running the queries on the IO dispatcher.
- Do not refresh the profile twice from the settings screen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 10:42:19 +02:00
Jorge Martin Espinosa f12b9c77d5 Enable global search feature flag (#7890)
Enable the global search feature by default for all variants of the app
2026-10-09 15:24:29 +00:00
Benoit Marty 5d498ee37b Merge pull request #7883 from element-hq/feature/bma/roomSelectSearchField
Use a search field to filter the rooms in the room select screen
2026-10-09 15:09:50 +02:00
Benoit Marty 10afe7c18c Release room list entries resources even if onControllerCreated is cancelled
Use try/finally instead of the awaitClose block, so that the entries stream, the controller and the
dynamic adapters are destroyed even if the suspending onControllerCreated callback is cancelled or
throws before awaitClose is reached.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 14:28:17 +02:00
Jorge Martin Espinosa d8a072755f Add edit and redaction send state support (#7840)
* Expose edit/redaction send states and retry/abort send from the Rust SDK

Pending edits and redactions have their own send queue entries, separate
from the original event. Surface them so the UI can reflect and act on them:

- Add `SendTarget` (Event, Edit, Redaction, Reaction) to the matrix API,
  with a mapper to the Rust SDK type.
- Add `editSendState` and `redactionSendState` to `EventTimelineItem` and
  map them from the SDK item.
- Add `Timeline.retrySend` / `Timeline.abortSend`, which take a `SendTarget`
  so the right queued request is retried or removed. Implement them in
  `RustTimeline` and in `FakeTimeline`.

* Track edit and redaction send states on timeline events

`TimelineItem.Event` now carries `editSendState` and `redactionSendState`
next to `localSendState`.

- `failedToSend` is true when any of the three states is failed, so a
  failed edit or redaction is shown like a failed message.
- `pendingSend()` returns the first pending state together with its
  `SendTarget`; the read receipt row, the send failure dialog and the
  timeline presenter use it instead of reading `localSendState` directly.
- `TimelineItemReadReceiptView` is restructured so the row is only
  rendered when there is something to show, and the send state takes
  precedence over read receipts.
- Update the previews provider and test fixtures for the new fields, and
  make `aMessageEvent`'s send state nullable.

* Retry and remove failed sends through the timeline

Retrying or removing a failed message used the event's `SendHandle`, which
only knows about the original send. Route both through the timeline with
the `SendTarget` of the pending request instead:

- `TimelineController` gains `retrySend` (which also re-enables the send
  queue) and `abortSend`, acting on the current timeline.
- `MessagesPresenter` retries via `retrySend`, and does nothing when the
  event has no pending send state.
- Redacting something that was never sent (no event ID) or a pending
  edit/redaction now aborts the queued request rather than sending a
  redaction, and no confirmation is asked for.
- Update the presenter tests accordingly.

* Log send queue errors

Log when the SDK reports a send queue error for a room, and when the
send queue is disabled, to help diagnose messages stuck in the queue.

* Make sure we display send queue errors before verification states

* Fix logic for displaying read receipts and add more screenshot tests

* Only use states with read receipts in `ReadReceiptBottomSheetStatePreviewParam`

* Handle `LocalEventSendState = null` state just like `LocalEventSendState.Sent`

* Add `TimelineItemAction.AbortSend` and use it for both:
  1. Aborting sending a message/edit/redaction from the 'sending failed' dialog.
  2. Abort sending a local message when selected from the timeline -> redact action.

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
2026-10-09 10:30:52 +02:00
Benoit Marty 2177a62ff1 Apply the room list filter requested before the controller is created
The dynamic entries controller of a room list is created asynchronously, once
the entries are observed. Filters set before that were silently dropped, so for
instance the search query was not applied to the rooms of a newly selected
account in the room select screen.

RustDynamicRoomList now owns the controller, remembers the last requested filter,
and applies it when the controller is created if it differs from the initial one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 09:00:48 +02:00
ganfra 512bab05a6 Merge branch 'develop' into feature/fga/timeline-multi-forward 2026-10-08 17:38:14 +02:00
Benoit Marty 6e810f2ffd Use one RustClientSessionDelegate per client, so that an auth error only affects the session it belongs to
The RustMatrixClientFactory was using a single RustClientSessionDelegate for
all the clients. The delegate keeps a reference to the last bound client only,
and didReceiveAuthError does not tell which session is concerned. With several
accounts, when the session of one account was revoked, the session of the last
restored account was invalidated and its local data deleted instead, while the
revoked session kept on syncing with an invalid token. Also the isLoggingOut
flag was never reset, so any later auth error was ignored.

The clients which are not associated to a stored session (temporary clients
and clients used to perform a login) now use a NoOpClientSessionDelegate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 14:26:47 +02:00
Jorge Martin Espinosa 3fe0e09e3c Add global search backfill worker (#7860)
* Add search backfill worker

This will run on background at most once an hour while the device has internet connectivity and the device is charging and start back-paginating through the user's rooms to make sure the search results are populated.

It'll run for the maximum time the default workers allow, 10 minutes.

* Create `RustMatrixClient.Factory` AssistedFactory to help with DI and add `SearchBackfillService`

* Start search backfill when entering the search screen, just once. This should help getting initial search results if none or few are found at first
2026-10-07 10:41:19 +00:00
ElementBot 9805422a8a Update Matrix Rust SDK to 26.10.05-nightly (#7844)
* Update Matrix Rust SDK to 26.10.01-nightly

* Add ivy repository for nightly SDK binding versions

* Fix API breaks

* Make sure we can't release a version with a `-nightly` SDK version

* Fix typo

Co-authored-by: Benoit Marty <benoitm@element.io>

* Update Matrix Rust SDK to 26.10.05-nightly

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: Benoit Marty <benoitm@element.io>
2026-10-07 11:13:36 +02:00
Benoit Marty 08a0885cfc Merge pull request #7821 from element-hq/bma/removeUnusedDependencies
Remove unused Gradle dependencies
2026-10-06 12:23:32 +02:00
ganfra 5ab9860e89 Merge branch 'develop' into feature/fga/timeline-multi-forward 2026-10-05 17:54:00 +02:00
Jorge Martin Espinosa b038e30d28 Exclude custom state events from the timeline (#7854)
Don't display custom state events not supported by the SDK
2026-10-05 11:12:12 +02:00
Benoit Marty 954eb731e7 Remove unused Gradle dependencies
Remove dependencies flagged as unused by the Dependency Analysis Gradle Plugin
(`./gradlew buildHealth`) and explicitly declared in module build files.

Removals were skipped when the dependency provides transitively something the
module (or a consumer of an `api` dependency) uses directly, as well as for
runtime-only dependencies (element-call-embedded, sentry-android,
rustls-platform-verifier). Dependencies added by the convention plugin helpers
(composeDependencies, testCommonDependencies) are left untouched.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 15:47:48 +02:00
Benoit Marty d68e92a4f0 Remove verification listeners of logged out sessions
- Clear the listener when RustSessionVerificationService is destroyed.
- IncomingVerificationRequestObserver removes the listener of the clients which are not in the MatrixSessionCache anymore.
- Remove the sessions from the MatrixSessionCache when they are removed from the SessionStore (logout, account deactivation).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 18:23:14 +02:00
ganfra 4563a30795 Merge branch 'develop' into feature/fga/timeline-multi-forward 2026-09-29 20:57:37 +02:00
Valere 43a1364671 Give the native call component its view of Matrix
The factory lives in libraries/matrix/impl because that is the only module compiled against the Rust SDK, and is app-scoped because a call is started for whichever account it belongs to rather than the one on screen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-29 18:44:49 +02:00
ganfra 193a5b1dbc Merge branch 'develop' into feature/fga/timeline-multi-forward 2026-09-29 17:15:40 +02:00
Jorge Martin Espinosa 03fd288c47 Upgrade to rustls-platform-verifier:0.2.0 (#7791)
* Upgrade to `rustls-platform-verifier:0.2.0`.

This re-enables certificate revocation checks, but v0.2.0 contains a list of CRL servers that can be accessed using clear text requests to check the validity of certain certificates, which should fix the issue that prevented us from using certificate revocation and at the same time strengthening the security of the client app.

Since we already had some network configuration in Element X, and `network_security_config.xml` files can't be merged, what we can do is manually download and merge the XML contents using `tools/dependencies/update_rustls_platform_verifier.py` like this:

```sh
./update_rustls_platform_verifier.py 0.2.0
```

It will automatically bump the Gradle dependency and merge the security config entries.

* Bump SDK bindings to `v26.09.28`, containing the rustls bump on the SDK side

* Fix unused resources caused by `app/src/main/res/xml/network_security_config_element.xml`
2026-09-28 15:35:33 +00:00
Jorge Martin Espinosa 0f98c5c0e0 Migrate SqliteStoreBuilder.passphrase usage to use highEntropyPassphrase (#7802)
* Migrate `SqliteStoreBuilder.passphrase` usage to use `highEntropyPassphrase`

This is the first step in migrating existing sessions from using a passphrase that needs key derivation, slowing down opening SDK DBs to just a raw key using the already random keys of the 'passphrase'

* Remove no longer necessary `keyOfSize` extension function
2026-09-28 17:32:42 +02:00
Benoit Marty db23023eda Store the user avatar thumbnail in the session database
Add a `userAvatarData` column to the session database, containing the base64 encoded
thumbnail of the user avatar. It will allow rendering the avatar of an account without
having to use its Matrix client, for instance on the signed out screen, or for other
accounts when the homeservers are not federated.

The thumbnail is downloaded when the user profile is retrieved or updated, and only if
the avatar URL has changed. The profile is now also persisted when received from the
own profile subscription.

Part of #5571

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 11:12:47 +02:00
ganfra 93831ffcbc Forward several events at once 2026-09-25 18:47:17 +02:00
Jorge Martin Espinosa 306e1cb950 Upgrade SDK bindings to v26.09.26 (#7780)
* Bump SDK bindings to `v26.09.26`

This version contains a fix for issues in `v26.09.25` related to certificate verification.

* Fix breaking API changes in the latest bindings

* Unify `FeatureFlags.RoomThreadList` with `FeatureFlags.Threads`
2026-09-25 16:08:19 +02:00
Jorge Martin Espinosa 8b1b5560d9 Add recent search results to global search (#7742)
* Add global search results history: keep the latest 25 items used in the global search, save them to an encrypted file store.

* Integrate the search history in the global search feature

* Add `MatrixClient.getRoomInfo` and use it in `GlobalSearchPresenter`

---------

Co-authored-by: ElementBot <android@element.io>
2026-09-22 15:17:57 +00:00
Jorge Martin Espinosa 3c3e8f8f6f Start sync manually after completing the auth flow (#7734)
Do it before we wait for the known verification state so we can receive updates from the encryption sliding sync flow.
2026-09-21 14:34:34 +02:00
Jorge Martin Espinosa 8cd3750cde Make global search use a Joined filter for room results (#7695)
Before this, global search returned also invites, which wasn't planned.
2026-09-11 17:36:38 +02:00
Benoit Marty 58b0f2ebc3 Merge pull request #7591 from element-hq/bma/iterateOnClientCreation
Iterate on client creation
2026-09-11 13:22:42 +02:00
Benoit Marty 3cde1523b4 Fix quality and tests. 2026-09-08 17:47:53 +02:00
Benoit Marty a817b6f219 Rename methods and update documentation. 2026-09-08 17:06:53 +02:00
Benoit Marty 59e72fc3ee Stop deleting the session data of a logged in account on the next login
sessionPaths keeps pointing at the directories of the account which has
just been logged in, and it was never reset. Adding another account
calls setHomeserver(), whose rotateSessionPath() starts by deleting the
directories of the previous sessionPaths, so the file and cache
directories of the first account were wiped.

finalizeClientCreation() now forgets the session paths once the login
succeeded. It is done there rather than in clear() on purpose: after a
failed attempt the directories are orphaned and must still be deleted by
the rotateSessionPath() of the next attempt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 16:47:58 +02:00
Benoit Marty 579ec9bd6a Close the client used to log in before creating the client of the session
Since the login flows stopped handing their client over to
RustMatrixClientFactory and let finalizeClientCreation() build a fresh
one from the SessionData, two problems appeared.

The client built by loginWithQrCode() was never owned by anyone: it is
not assigned to currentClient, so clear() had nothing to close and the
Rust Client stayed open for the whole app lifetime, holding the session
stores of the freshly logged in account. It is now tracked in
currentClient, and also disposed of when the QR login fails, which is
safe because that flow always builds its own client.

The client of the session was also built while the login client was
still open. Both use the same session paths, so their state and crypto
SQLite stores, and the search index when message search is enabled, were
opened twice at the same time with no cross process lock to protect
them. clear() now runs before the final client is created.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 16:47:58 +02:00
Benoit Marty 1f18a18917 Iterate on hooks implementation 2026-09-08 16:47:57 +02:00
Benoit Marty 5ce531fd44 Ensure we create a fresh Client when the sessionId is know after authentication. 2026-09-08 16:46:46 +02:00
renovate[bot] 3df1906d2a Update dependency org.matrix.rustcomponents:sdk-android to v26.09.08 (#7668)
* Update dependency org.matrix.rustcomponents:sdk-android to v26.09.08

* Fix API breaks:

- There's no `SyncServiceBuilder.withProfilesExtension()` method anymore. This is now enabled unconditionally in the SDK.
- Timeline filters no longer use the `org.matrix.rustcomponents.sdk.TimelineEventFilter` FFI wrapper, but the `uniffi.matrix_sdk_ui.TimelineEventFilter` type directly. This also changes the underlying types used for inclusion/exclusion.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2026-09-08 16:22:14 +02:00
Jorge Martin Espinosa f0a0700f5d Bump SDK bindings to v26.09.3 (#7637)
Fix API breaks:

- A new `Mentions` room list filter is available.
- `RoomListService.subscribeToRooms` is now `RoomListService.setRoomSubscriptions`.
- `enableAutomaticBackPagination` moved from `Client` to `ClientBuilder`.
2026-09-07 14:19:19 +02:00
Jorge Martin Espinosa dcd0bc782f Make sure enforce_element_pro is taken into account in FOSS (#7631)
* Make sure `enforce_element_pro` is taken into account in FOSS

* Make sure we crate `RustTemporaryMatrixClient` instances with a proper `serverName` value
2026-09-03 10:05:40 +02:00
Benoit Marty ab09500e7e Remove unused import 2026-08-31 15:06:39 +02:00
Benoit Marty 8081682f8f Remove ExternalSession, fallback login with Element Web is gone. 2026-08-31 12:07:20 +02:00
hayyaksi b85174d35e Only track read receipts on message-like events (#7361)
Ask the SDK to track receipts on message-like events only, for the live
timeline and for the focused and threaded ones, so all three agree. The
disabled case for the media and pinned-event timelines is unchanged. 

This matches the behaviour on Element X iOS.

The SDK attaches the receipt to the preceding event rather than the next
one, which is the placement its API offers.
2026-08-31 11:44:40 +02:00
Benoit Marty 8b03e4d41a Ensure that sessionVerifiedStatus is updated when the crypto is ready.
If we do not do that the FTUE state stays on WaitingForInitialState and user is stuck on a blank screen.
2026-08-31 09:14:03 +02:00
Benoit Marty d9c39e8f98 Merge pull request #7480 from bxdxnn/fix/deleted-messages-thread
Fix removed messages hiding its thread on deletion
2026-08-27 10:04:36 +02:00
Benoit Marty 776cfc9c80 Add new type RoomRetention 2026-08-25 15:55:51 +02:00
Benoit Marty 16bc825c17 username has been renamed to serverNameFromUserId, but it is not necessary if we call homeserverUrl, so just remove it. 2026-08-25 15:55:29 +02:00
bxdxnn 3d400bad4a Merge 2026-08-24 20:04:47 +00:00
bxdxnn 65a827559b Merge 2026-08-24 10:30:25 +00:00