* Pass media captions as HTML to the media viewer
`MediaInfo` and `GalleryInfo` carried the formatted caption as a `CharSequence`, which isn't a good fit for `Parcelable` classes. Some producers also passed the raw HTML body in that field, so the caption was rendered with its tags, and gallery messages didn't pass a formatted caption at all.
Replace `formattedCaption` with `htmlCaption: String?` and convert it to styled text in `MediaViewerPresenter`, using the same `HtmlConverterProvider` as the timeline. The converted captions are cached by HTML so page data equality stays stable across list updates.
* Pillify media captions in the media viewer
Move the `TextPillificationHelper` interface to `:features:messages:api` so the media viewer can use it, keeping `DefaultTextPillificationHelper` in the impl module. The fake moves to `:features:messages:test`.
`MediaViewerPresenter` now pillifies converted HTML captions before linkifying them, matching how captions are rendered in the timeline.
* Rename `TextPillificationHelper` to `TextPillificator`, also fix copyright notice.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This adds a feature flag, disabled by default, which disables the 'don't receive push notifications from other accounts used in this device' rule, which is useful in general, but problematic for testing.
The client used to log in was built with `autoEnableBackups(true)` and `autoEnableCrossSigning(true)`.
Its SDK initialization task (cross-signing bootstrap, key backup creation) could still be running
after it was closed, while the final client, which uses the same store, was doing the same work.
This led to duplicate key backups and lost cross-signing private keys on new accounts.
Only the final client now sets up the backup and the cross-signing.
Closes#7955
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The parameter is named `key` in the SDK `ClientBuilder`. The mismatch was reported as a warning,
which failed the compilation of the unit tests since warnings are errors.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The fetch of the ignored users list from the server at startup is a workaround for an SDK issue, link it so that it
can be removed once the issue is fixed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The SDK emits its in-memory ignored users list as soon as we subscribe to it. This list is empty until the account data
is received by the sync, which usually does not happen after a restart since the account data has not changed. This
empty list was overriding the list fetched from the server, so the blocked users entry was hidden in the settings, and
the blocked users list was not updated when unblocking a user.
Subscribe first and then fetch the list from the server, and keep the subscription alive even if the fetch fails.
Fixes#7725, #7726
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Prevent foreground backfill from running when the app is active
This should be a background task, since it can severely degrade performance if the app is in use while it runs.
The worker won't run any more if the app is in foreground and will stop running if it was in background and now it's in foreground.
* Fix return inside `withTimeout`
Co-authored-by: Benoit Marty <benoitm@element.io>
* Remove initial delay: it shouldn't be necessary if the foreground state of the app is checked when the worker starts
Instead, if the app was in foreground, cancel the work and retry in 5 minutes.
---------
Co-authored-by: Benoit Marty <benoitm@element.io>
Thread notification tags have the form "roomId|threadId". clearReadRoomsNotifications
was building a RoomId from the whole tag, which is only validated in debug builds, so
in release an invalid room id reached RoomListService.room(). Add
NotificationCreator.getMessageNotificationRoomId(), the inverse of messageTag(), which
only keeps the part before '|' and checks it is a valid room id.
Also make RoomListServiceInterface.roomOrNull take a RoomId instead of a String.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Extract the logic to observe the total unread count of a MatrixClient, refreshed on each sync
heartbeat, to a shared extension and use it in HomePresenter and PreferencesRootPresenter.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This is mostly done when uploading bug reports and on one hand, it doesn't really make sense since the binary contents will be unreadable anyway, and on the other it also messes up with our debug tools, making debugging some issues harder.
The case where we move the pointer once we've started the click on a link wasn't taken into account, so the click or long click gestures weren't canceled if the gesture ended up being a 'move' one.
Simplify the handler and make it more idiomatic too.
The `File.length()` docs state:
> Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.
On Android, it *seems* to currently have the right behaviour, summing up the size of its children, which made `File.getSizeOfFiles()` double-count the size of some directories.
To avoid this, and be able to control the actual behaviour no matter what future Android versions do, let's count those ourselves.
* 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>
* 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>
The push history was written to the database synchronously, from the app coroutine scope which runs on the main thread, for every received push. Make PushHistoryService.onPushResult suspend and run all the database queries on the IO dispatcher.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Checking if the work is already scheduled does a blocking WorkManager query, which was done on the main thread at session start.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Same issue as when refreshing the profile manually: the profile listener stored the profile (Base64 encoding and session database access) from the session coroutine scope, which runs on the main thread.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The thread list subscription was launched in the room coroutine scope, which runs on the main thread, so the initial sync FFI call and the mapping of all the items and diffs were done on the main thread every time a room was opened.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`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>
The incoming share is now displayed on top of the root, so the FTUE, and the session verification in particular, could be bypassed.
- When the current account is not verified, wait for the FTUE to be complete before displaying the incoming share, as before.
- When the user selects another account which is not verified in the room select screen, display the session verification flow of
the FTUE for this account on top of the share. As in the FTUE, the user has to verify the session or to sign out.
- Expose the FTUE session verification flow with a new SessionVerificationEntryPoint, displayed by OtherSessionVerificationNode
which sets up the session graph of the account to verify.
- Introduce RoomSelectNavigator so that RoomSelectPresenter can request the verification of the selected session.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Scroll the list to the top using a LaunchedEffect instead of recreating the LazyListState on each search query change.
- Use isBlank to check the search query, to match the logic of RoomSelectSearchDataSource.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>