* 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
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>
Add an optional thumbnail to `MatrixUser` and `AvatarData`, filled from the session
database for the other accounts in the room list header, the settings and the account
selection screen. `ImageAvatar` renders this thumbnail instead of the initial letter while
the avatar is loading or when it fails to load, for instance when the homeserver of the
current account is not federated with the one of the other account.
Fixes#5571
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* 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>
Fix API breaks:
- A new `Mentions` room list filter is available.
- `RoomListService.subscribeToRooms` is now `RoomListService.setRoomSubscriptions`.
- `enableAutomaticBackPagination` moved from `Client` to `ClientBuilder`.
* Rename `UrlContentFetcher` to `ClientUrlContentFetcher` and add missing base URL data (server name, homeserver URL)
* Avoid passing the `homeserverUrl/serverName` around.
Calculate the URL in `DefaultRemoteEnterpriseConfigRetriever` using the newly added `homserver` and `server` values as the possible base URLs, depending on the remote config source
* Make sure we don't perform blocking requests to fetch the remote config when restoring a session
Add a `needsRefresh` parameter to `RemoteEnterpriseConfigResult.NotFound` to handle this, and store a `no-config` value in the store to indicate an endpoint has been checked and no config was found
* Bump enterprise module
* Don't restart the sync service if the client is shutting down
This was causing issues when clearing the cache:
1. The client would ask the SDK to clear the caches.
2. The SDK would stop the sync service, clear the caches and set the `pos` value of sliding sync to 0 so the HS returns all the required state the next time the client is used.
3. However, between the sync service being stopped with the `pos=0` change and the client being destroyed, there was enough time for the `SyncOrchestrator` to decide the sync service was stopped for no good reason since there is network connectivity and the app is on foreground, so it restarted the sync, with `pos=0`.
4. This value was persisted, and the next time the new client did an 'initial sync' it had a `pos != 0`, which the HS uses to avoid returning some required state it already fetched.
5. The room list now lacks state events for lots of rooms and room names, avatars, members, etc. are now missing.
---------
Co-authored-by: Benoit Marty <benoitm@element.io>
A m.key.verification.request sent from a client that supports in-chat
verification carries a plain text body for clients that do not. Element X
has no msgtype of its own for it, so it fell through to OtherMessageType
and the timeline printed that body, telling the user their client does
not support in-chat key verification right after a verification they had
just completed.
Drop the event when building the timeline items, as Element X iOS does.
Document the permalink, widget, tracing, core, platform, server and analytics
interfaces along with their members, which completes libraries/matrix/api: all
69 in-scope interfaces and their 398 members now carry documentation.
Notable points recorded here: PermalinkParser reports an unrecognised uri as a
fallback link rather than failing, MatrixWidgetDriver.run is a no-op while it is
already running and send is silently ignored once closed, and every member of
CallAnalyticCredentialsProvider is null when the service is unconfigured or the
user has not consented to analytics.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document NotificationSettingsService and PushersService along with all their
members, and complete the NotificationService documentation.
Fix the documentation of notificationSettingsChangeFlow, which described a state
flow of room notification settings when the member is a SharedFlow<Unit> that
only signals that the push rules changed. That was the sole reference to
RoomNotificationSettingsState in the file, so its now unused import is removed.
The docs also explain why so many of these methods take isEncrypted and
isOneToOne: Matrix keeps a separate default push rule per combination.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add the interface level docs that MediaPreviewService, MatrixMediaLoader and
MxcTools were missing, document MediaFile.path and the nested
ContentScannerUrlProvider.Factory, and add the missing @param entries.
Most members in these packages already had accurate documentation and are left
untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document RoomDirectoryService, RoomDirectoryList, SpaceService, SpaceRoomList
and LeaveSpaceHandle along with their members, add the missing DynamicRoomList
page size doc and the missing @param entries, and give MessageSearchService the
interface level doc it was lacking.
The docs make the ownership rules explicit, since they differ across these
types: a SpaceRoomList and a LeaveSpaceHandle are owned by the caller and must be
destroyed or closed, while a RoomDirectoryList and a MessageSearch are released
when the scope they were created with completes.
RoomList, RoomListService and the search interfaces were already accurate and are
left untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document MatrixAuthenticationService, OAuthRedirectUrlProvider, the two QR code
login data interfaces, and the four device linking interfaces, along with their
members and parameters.
The docs record the ordering constraints a caller has to respect: setHomeserver
must precede any login attempt, the link handlers report their outcome through
their step flow rather than through a return value, and ContinuationMessageSender
expects exactly one of cancel or confirm.
The oauth package holds only a sealed interface, so it is out of scope here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document EncryptionService, SessionVerificationService and
SessionVerificationServiceListener along with their members, and add the missing
@param entries.
From RustEncryptionService: the backup and recovery state flows report a
waiting-for-sync value for as long as the session is not syncing, and
isLastDevice and hasDevicesToVerifyAgainst are polled rather than observed.
PasswordStrengthEstimator was already accurate and is left untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document Timeline and all of its members, TimelineProvider, and the three
lazy providers carried by EventTimelineItem.
Behaviours taken from RustTimeline: collecting membershipChangeEventReceived or
onSyncedEventReceived is what keeps the timeline subscribed to the SDK, paginate
fails with CannotPaginate when the matching status forbids it, the initial
hasMoreToLoad of each pagination status depends on the timeline mode,
timelineItems also carries virtual items such as date separators, and the media
send functions return a handler the caller must await.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document KnockRequest and ThreadsListService along with all their members, and
add the missing @param entries to the already documented RoomPermissions.
For ThreadsListService the docs record what the implementation does with the
subscriptions: subscribeToItemUpdates starts a shared subscription on the first
call and re-emits the whole list, subscribeToPaginationUpdates replays the
current state immediately, and destroy leaves the service unusable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document BaseRoom, JoinedRoom, NotJoinedRoom, RoomAliasHelper and JoinRoom,
along with their members, and add the missing @param entries.
Fix the documentation of BaseRoom.getUpdatedIsEncrypted, which described the
room directory visibility instead of the encryption state it actually returns.
Behaviours taken from the implementations: BaseRoom.predecessorRoom swallows
errors into null, updateMembers only reads the cache on its first call,
JoinedRoom.syncUpdateFlow is an opaque change counter, notification settings
start in an Unknown state until updateRoomNotificationSettings is called, and
JoinRoom maps a Forbidden answer to Failures.UnauthorizedJoin.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document the interface itself and all of its 60+ properties and functions.
Notable behaviours taken from RustMatrixClient that callers cannot guess from
the signatures: getRoom and getJoinedRoom build a new closeable instance on
every call, createRoom/joinRoom/knockRoom wait for the membership to come back
through sync and report a null RoomInfo rather than a failure when that wait
times out, getCacheSize excludes the crypto database, and clearCache destroys
the client while keeping the session.
Also fix the stale wording and the malformed KDoc block on resolveRoomAlias,
and add the missing @param entries on the functions that already had a summary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document MatrixClientProvider, SdkMetadata, HomeserverCapabilitiesProvider,
TemporaryMatrixClientFactory and SyncService, along with each of their members.
Behaviour described here was checked against the implementations
(MatrixSessionCache, RustSdkMetadata, RustHomeserverCapabilitiesProvider,
RustTemporaryMatrixClientFactory and RustSyncService), so the docs mention the
caching, idempotence and error-wrapping that callers cannot infer from the
signatures alone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This is an abstraction over an actual unauthenticated `Client` from the SDK that implements `GetUrlResolver`, and is supposed to be short-lived.
With this, we can use the SDK network stack to perform arbitrary GET url operations.
The `AutoCloseable` implementation makes it easier to clean up any leftover local config after using this temporary client.
* Add default `OAUTH_CLIENT_URL_PATH` alternative
Previously this was `null`, but we want to use `apps/android` instead to identify Element X Android. Element Pro will use a different value, and other custom apps based on EP will use `null` or their own custom value, if they provided one
* Suppress lint check so the pro app can be built
MatrixClient had no way to read or write global account data although the
underlying client supports it.
Add getAccountData and setAccountData to the interface and implement them in
RustMatrixClient using the same withContext/runCatchingExceptions idiom as the
neighbouring methods. The content is the raw JSON string the SDK returns and
accepts: event types are open ended, so a typed wrapper belongs to whichever
caller needs one. Scope is limited to global account data; the room level
variant and the change notification APIs can follow when a feature needs them.