Commit Graph

53 Commits

Author SHA1 Message Date
Benoit Marty 08a0885cfc Merge pull request #7821 from element-hq/bma/removeUnusedDependencies
Remove unused Gradle dependencies
2026-10-06 12:23:32 +02:00
Benoit Marty ab20281b26 Fix wrong package names and namespaces in several modules
Some modules were using package names or namespaces inherited from copy-paste
or from older module names (e.g. `features.logout.impl` in the deactivation
module, `features.api` in the migration api module, `sessionstorage` in the
cachestore module), or containing typos (`roomaliasesolver`,
`roomdetetailsedit`).

Move the sources to the package matching their module, update the imports, and
rename the impacted screenshots accordingly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:43:22 +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
Jorge Martin Espinosa 8b2c207728 Move the :libraries:wellknown logic into enterprise modules (#7429)
* Extract `IsEnterpriseBuild` use case

Having it inside `EnterpriseService` made having DI cycles with the `BuildMeta` provider too easy

* Rename `EnterpriseService.defaultHomeserverList()` to `homeserverAllowList()`

This seems more aligned with the way this list works

* Move most of the logic from `:libraries:wellknown` to `:enterprise:feature:enterprise`, both `shared` and `impl` modules

Ideally I would have added everything into `impl`, but some of the classes needed to be shared between the different `:enterprise:features` modules, and those are in the `shared` module, lacking a better name/strategy

* Add `EnterpriseService.isElementProEnforced`

With this, we don't need to provide the `RemoteEnterpriseConfig` anymore to any consumers, everything goes through `EnterpriseService` or other providers

* Remove `EnterpriseService.overriddenElementWellKnown`

This leaks the remote enterprise config/element well known contents to the app in a public interface.

* Create `CustomMapTilerConfigProvider` to avoid leaking the `RemoteEnterpriseConfig` in public APIs

This commit also starts moving some of the well-known related values to the enterprise modules

* Add missing docs to `EnterpriseService` and `SessionEnterpriseService`

* Fix tests

* Fix lint issues

* Bump enterprise module
2026-08-17 13:21:47 +00:00
Benoit Marty 9e32801d02 Merge pull request #7426 from element-hq/feature/bma/documentation
Add KDoc to all the interfaces of the api modules
2026-08-14 13:46:28 +02:00
Benoit Marty c6af196bf0 Add KDoc to the libraries/wellknown API interfaces
Document WellknownRetriever, ElementWellknownStore, ElementWellKnownParser and
their factories, along with every member.

The caching semantics are the part callers need and cannot see in the signatures,
so they are recorded here: the store reports entries older than a day as outdated
rather than missing, the retriever returns such a value immediately and refreshes
in the background, an enterprise build with a hardcoded configuration
short-circuits entirely, and the parser ignores unknown JSON fields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 09:50:08 +02:00
Jorge Martin Espinosa 22195a47f2 Move the custom tile server URL config to the Element wellknown content (#7416)
* Move the custom tile server URL config to the Element wellknown content

* Iteration: use whole `MapTilerConfig` in the remote config
2026-08-14 08:20:37 +02:00
Jorge Martín 6c7f4d3b24 Add some missing tests to improve coverage 2026-08-11 13:18:49 +02:00
Jorge Martín e371b46c68 Rename GetUrlResolver to UrlContentFetcher and TemporaryMatrixClientFactory.createTemporaryMatrixClient to just create 2026-08-11 13:18:49 +02:00
Jorge Martín dbc28df3eb Remove unnecessary call to fetchElementWellKnown when the value was up to date in the store in DefaultWellknownRetriever 2026-08-11 13:18:49 +02:00
Jorge Martín e92016c68e Improve host extraction in DefaultWellknownRetriever 2026-08-11 13:18:49 +02:00
Jorge Martín e24468c74f Fix and add tests 2026-08-11 13:18:49 +02:00
Jorge Martín e3290707d9 Remove no longer needed SessionWellknownRetriever 2026-08-11 13:18:49 +02:00
Jorge Martín 89908c2511 Add WellknownRetrieverResul.upToDateDataOrNull helper function for the enterprise module 2026-08-11 13:18:49 +02:00
Jorge Martín b9afbf0692 Add a session-scoped WellknownRetriever provider so we don't have to build it every time there 2026-08-11 13:18:49 +02:00
Jorge Martín 25eca29cd2 Rework WellknownRetriever so it uses the GetUrlResolver
Also, allow instantiating it using a factory: with this we can always decide where to take the config from and how to do it

Do the same for `ElementWellknownStore` so we can store and restore the values for different sources (endpoints) independently
2026-08-11 13:18:49 +02:00
Jorge Martín 49abaf5a5c Create EnterpriseRemoteConfigSource enum
This allows us to decide where to get the remote enterprise config from.
2026-08-11 13:18:49 +02:00
Jorge Martin Espinosa 925376b6af Allow adding extra elements to the developer settings from external modules (#7230)
* Add `ExtraDeveloperOptionsRenderer` to display extra UI components in the developer settings screen. It defaults to not displaying anything, using `NoopExtraDeveloperOptionsRenderer`

* Add `EnterpriseService.overriddenElementWellKnown` method to fetch the current overridden element well known value, if any

* Modify the well known retrievers to use the overridden value if it's there. Also extract the JSON parsing to its own `ElementWellKnownParser` component.

* Bump enterprise repo reference.
2026-07-21 10:18:56 +02:00
Jorge Martin Espinosa 62cc7e0505 Allow homeserver to disable encryption in Element Pro (#7198)
* Allow HS to disable encryption in Element Pro

Add `force_disable_e2ee` support in the Element well known retriever and cache to allow a homeserver to disable encrypted room creation and enabling encryption in an existing room in Element Pro clients

* Bump enterprise repo back to `main` branch
2026-07-15 13:29:16 +02:00
Jorge Martin Espinosa 885e042c12 Initial content scanner integration (#7139)
* Create a `ContentScanner` component:

- Add `:features:contentscanner:api` module with the interface.
- Implement the concrete component using the Rust SDK in `:libraries:matrix:impl`.

This can be used to both set up the content scanner media fetching in the SDK Client and manually scanning media sources from the Android side

* Create `ContentScannerUrlProvider` in a new `:features:contentscaner:api` module as a noop implementation

Use it as a placeholder for the code to instantiate a `RustContentScanner` with the fetched URL and set it as part of the SDK client.

* Expose the optional `ContentScanner` in the `@SessionScope`

* Split the storage part of the Element well-known retriever so it can be reused for the non-session bound retriever.

Also add the new `content_scanner_url` field to it.

This will be used by the enterprise code to fetch the actual content scanner url.

* Bump enterprise commit to have access to the actual content scanner url provider implementation

* Fix tests and lint issues

* Use the right namespace for `:features:contentscanner:api`, also use the right namespace for `impl`

---------

Co-authored-by: Benoit Marty <benoitm@element.io>
2026-07-08 07:50:22 +00:00
Jenna Vassar fdac92a9ea Rename the custom recovery passphrase well-known to match the merged schema
The merged element-enterprise#261 well-known schema advertises the feature
under custom_recovery_passphrase (no _settings/_requirements suffix), so the
parser previously looking for custom_recovery_passphrase_settings would never
activate the flow. Update the @SerialName and drop the narrow "Requirements"
suffix from the type — the block is now general, extensible feature settings —
to mirror the .pkl CustomRecoveryPassphrase class. Bumps the enterprise
submodule to the matching consumer change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 15:03:24 -07:00
Jenna Vassar a205d03b43 Floor the custom recovery passphrase minimum at 1 instead of ignoring the spec
When the homeserver advertises custom_recovery_passphrase_settings, always run
the custom passphrase flow, flooring min_character_count at 1 (covering missing,
zero, and negative values) so the derived passphrase can never be empty. Any
stronger minimum stays the operator's choice. Replaces the previous behaviour of
dropping the spec and falling back to the auto-generated key.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 14:42:38 -07:00
Jenna Vassar 2931418018 Parse custom_recovery_passphrase_settings from Element .well-known
Add CustomRecoveryPassphraseRequirements to ElementWellKnown and decode
the custom_recovery_passphrase_settings block (currently just
min_character_count) from the homeserver's element.json. Invalid specs
(missing or non-positive min_character_count) are logged and mapped to
null so the setup flow falls back to the generated-key path. Field names
match the ESS well-known schema (element-enterprise#261).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 13:33:18 -07:00
Benoit Marty 2f45ca8835 Merge pull request #6682 from element-hq/feature/bma/customMasScheme
Add a way to tweak MAS url.
2026-05-07 10:51:32 +02:00
Benoit Marty 61f074ddc1 Let our Json parser accept comments and trailing comma. 2026-05-04 10:05:11 +02:00
Benoit Marty 3dd2a60b3a Do not use generic Exception 2026-04-29 22:51:54 +02:00
Benoit Marty 8512279d96 Add a cache for Element .well-known file. 2026-04-29 22:29:41 +02:00
Benoit Marty c1e908a8e6 Fix tests. 2026-04-29 22:29:41 +02:00
Benoit Marty a76b55e580 Add a way to tweak MAS url. 2026-04-29 22:29:40 +02:00
Benoit Marty df4c719151 Let enterprise build be able to use a different notification channel for noisy notification. 2026-02-11 11:57:01 +01:00
Benoit Marty eb31505dc7 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty f86431e663 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty c4e0370f41 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Jorge Martin Espinosa 7aa564e74d Use the SDK Client to check whether a homeserver is compatible (#5664)
* Use the SDK `Client` to check whether a HS is compatible

* Remove usage of unused `WellKnown`, keep `ElementWellKnown`

* Make `HomeServerLoginCompatibilityChecker.check` return `true/false` values to distinguish non-valid homeservers from a failed check

* Use `inMemoryStore` and `serverNameOrHomeserverUrl`

* Do some cleanup of `isValid` and `isWellknownValid`

* Make the debounce for starting the search a bit higher, as checking for the homeservers seems more resource-intensive now
2025-11-04 15:43:00 +01:00
Benoit Marty 76493f52ec Merge branch 'develop' into feature/bma/metro070 2025-10-23 11:30:25 +02:00
Benoit Marty 263e761907 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty 5b5c007cd2 Improve API of interface WellknownRetriever to be able to distinguish between 404 and other errors. 2025-10-22 15:28:31 +02:00
Benoit Marty b45fb2128b Improve API of interface WellknownRetriever to be able to distinguish between 404 and other errors. 2025-10-22 14:45:15 +02:00
Benoit Marty 38908a42a2 Update API around brandColor. 2025-10-20 16:33:46 +02:00
Benoit Marty df48ed5a2d Introduce JsonProvider.
It will ensure that classes are using the correct Json instances in the unit tests.
2025-10-20 09:40:42 +02:00
Benoit Marty 7c437761c4 Move Json provider from Network module to AppModule to reuse it. 2025-10-16 16:37:08 +02:00
Benoit Marty a575019760 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
Jorge Martín 4ab62a6a38 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín 29a97fc0d9 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín b76a71ebf5 Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
Benoit Marty 84130da367 Code cleanup 2025-08-11 14:53:40 +02:00
Benoit Marty e35eebf084 Add unit test on DefaultSessionWellknownRetriever 2025-08-11 12:13:21 +02:00
Benoit Marty bac59f6caa Merge 2 mapCatchingExceptions into a single one. 2025-08-11 10:55:42 +02:00
Benoit Marty d277a604bb Inject the Json parser 2025-08-11 10:49:39 +02:00
Benoit Marty 275c5b41c5 Fix compilation issue 2025-08-08 18:08:30 +02:00