Commit Graph

158 Commits

Author SHA1 Message Date
renovate[bot]
7b3f082eb3 fix(deps): update kotlin to 2.3.0 (#5917)
* fix(deps): update kotlin to 2.3.0

* Cleanup - remove `datetime` compat version

* Fix several lint issues caused by the Kotlin compiler inference working better (checks in nullables, vars, etc.)

* Fix tests by removing mock in `File.readBytes`, it seems like it's no longer allowed. Using a tmp file works well enough.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: Jorge Martín <jorgem@element.io>
2025-12-22 14:28:15 +01:00
Benoit Marty
1571b6e719 Upgrade robolectric to version 4.16 (#5923)
* Update dependency org.robolectric:robolectric to v4.16

* Fix file size formatter output on API 26+

* Use more realistic value for maxUploadSize

* Update screenshots

* Fix test issue: "java.security.KeyStoreException: AndroidKeyStore not found"

* Add exceptions.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ElementBot <android@element.io>
2025-12-19 15:37:38 +01:00
Benoit Marty
9e00ca323d Fix file size formatter output on API 26+ 2025-12-18 11:18:25 +01:00
Benoit Marty
fd446e98dd Link new device using QrCode. 2025-12-16 16:14:04 +01:00
ElementBot
6880cf518c Sync Strings from Localazy (#5904)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-12-15 23:51:19 +01:00
Jorge Martín
a59b9c86e9 URL-encode deep link path segments in DefaultDeepLinkCreator
Decode them later in `DefaultDeepLinkParser` too
2025-12-10 15:58:41 +01:00
Benoit Marty
72b3decf4c Detekt: enable rule exceptions.SwallowedException and fix existing issue. 2025-12-05 09:45:23 +01:00
Jorge Martin Espinosa
396edbce3d Enable logging OkHttp traffic based on the current log level (#5750)
* Use `LogLevel` to decide whether to log the HTTP requests and responses

Added `DynamicHttpLoggingInterceptor` for this.

* Code cleanup.

* Use Timber.d

* OutOfMemoryError should not be caught. They are considered unrecoverable.

* Improve code in DefaultBugReporter.

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
2025-11-18 15:18:27 +01:00
Benoit Marty
1292da2a72 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty
b748fcc631 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
0a0224b586 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Benoit Marty
fc9c90181c Merge pull request #5592 from element-hq/feature/bma/constValKey
Improve how data is handled for the WorkManager.
2025-10-24 19:20:44 +02:00
Benoit Marty
937519639d Add missing test. 2025-10-23 09:59:24 +02:00
Benoit Marty
826cacf209 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
241a968d66 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
Jorge Martin Espinosa
b90dc081b7 Fix media viewer not being dismissed with reduced motion enabled (#5555)
This is also called 'remove animations' in some Android versions. It seems like the associated coroutine dispatcher never allows the `delay` calls to complete, or maybe they take too long and the coroutine is cancelled before they finish.
2025-10-17 10:10:13 +00:00
Benoit Marty
0656b5b2c4 Merge remote-tracking branch 'origin/develop' into feature/bma/assetReader 2025-10-16 20:34:38 +02:00
Benoit Marty
535211631d Improve AssetReader. 2025-10-16 16:46:40 +02:00
Benoit Marty
14c7a63f45 Extract code that log a ConsoleMessage so that it can be reused. 2025-10-16 16:15:09 +02:00
Benoit Marty
8b703ed046 Let the enterprise build be able to update the colors. 2025-10-15 11:25:58 +02:00
Benoit Marty
629fc552e5 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
bmarty
676d7f6c8f Sync Strings from Localazy 2025-09-05 07:44:19 +00:00
Jorge Martín
dca1c5b516 Remove dagger and anvil dependencies, try to simplify gradle build scripts a bit 2025-09-04 16:49:21 +02:00
Jorge Martín
e06bacbff3 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín
fc3153bd26 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín
92a4b8b66b Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
Benoit Marty
c275b538dc Increase readability of big numbers. 2025-08-26 12:16:20 +02:00
Benoit Marty
1db2830d44 Add test on calculateOptimalBitrate 2025-08-26 11:13:49 +02:00
Benoit Marty
e075529adb Improve code readability a bit. 2025-08-26 11:07:24 +02:00
Benoit Marty
b943cdcdc0 Add unit test on VideoCompressorHelper 2025-08-26 11:06:35 +02:00
Jorge Martin Espinosa
8c1c0b63bd Use variable bitrate mode when transcoding to ensure compatibility with old devices (#5223)
* Use variable bitrate mode when transcoding

This should be compatible with more devices that may lack the needed codecs to properly encode using constant bitrate mode (CBR).

* Fix video output size (again)
2025-08-26 10:41:07 +02:00
Jorge Martin Espinosa
2f2e886e9f Handle preference stores corruption by clearing them (#5086)
* Handle preference stores corruption by clearing them:
    - Use the centralised `PreferenceDataStoreFactory` instead of `preferences by`.
    - Add `DefaultPreferencesCorruptionHandlerFactory.replaceWithEmpty` to its `create(name)` method so all preference stores are cleared if they're corrupted.

* Add detekt rule to make sure we use `PreferenceDataStoreFactory` instead of `by preferencesDataStore`

* Remove `@SingleIn` annotations as the annotated class no longer have to be singletons
2025-08-22 06:59:06 +00:00
Jorge Martin Espinosa
5feb7a99a9 Fix bitrate value used for video transcoding (#5183)
* Fix bitrate value used for video transcoding:

It should be 1000 times what it is now. The video size estimation was wrong since the retrieved duration value was in milliseconds, not seconds.

* Use `Duration` as the result type for `getDuration`
2025-08-18 21:12:11 +00:00
Jorge Martin Espinosa
a170d80cb3 Add media file limit size warning and media quality selection (#5131)
* Add `VideoCompressorPreset` enum

This represents the different compression presets used for processing videos before uploading them

* Add `VideoCompressorHelper` util class to calculate the scaled output size of the video given an input size and its optimal bitrate

Also add `MediaOptimizationConfig` which will be used to decide how to apply compression in `MediaPreProcessor`

* Add `RustMatrixClient.getMaxFileUploadSize()` function and `MaxUploadSizeProvider` so we can import only this functionality into other components

* Try preloading the max file upload size the first time we get network connectivity - it's a best effort

This should help ensure we'll have this value available later, even if we still need to load it asynchronously.

* Split the `compressMedia` preference into `compressImages` and `compressMediaPreset`

* Modify the media processing parts to use the new classes and utils

* Add `MediaOptimizationSelectorPresenter`, which will retrieve the compression values and the max file upload size, also estimating the compressed video file sizes if needed.

* Add a feature flag to allow selecting the media upload quality per upload

* Integrate the previous changes with the attachments preview screen

Add strings from localazy too.

* Adapt the rest of the app calls to upload media to using the media optimization configs

* Allow modifying the default compression values in advanced settings, based on the feature flag value

* Pass the `fileSize` in `MediaUploadInfo` too, to be able to check it against the `maxUploadSize`

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
2025-08-11 17:22:46 +02:00
Benoit Marty
2dec34374e Prevent users from using Element FOSS on homeservers that enforce the usage of Element Pro. 2025-08-06 10:23:16 +02:00
Jorge Martin Espinosa
6c184076a9 Calculate video output size taking into account portrait mode (#5068) 2025-07-23 14:19:08 +02:00
Benoit Marty
366d040d01 Remove dead code. 2025-07-10 08:30:39 +02:00
ElementBot
1944004409 Sync Strings from Localazy (#4983)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-07-04 14:37:59 +00:00
bmarty
2e8f8ec057 Sync Strings from Localazy 2025-06-30 00:33:54 +00:00
Jorge Martin Espinosa
407c7ed70a Simplify message composer layout (#4884)
Co-authored-by: ElementBot <android@element.io>
2025-06-24 14:05:28 +02:00
Jorge Martin Espinosa
cfb9cc3edc Fix for message composer losing focus in Compose 1.8.0 (#4853)
Co-authored-by: ElementBot <android@element.io>
2025-06-10 16:39:26 +00:00
Jorge Martin Espinosa
55805bcfee Element Call: Add audio output selector handled by Android (#4663)
- Add onUrlLoaded callback to WebViewWidgetMessageInterceptor
- Add WebViewAudioManager component and use it instead of the AudioManager extension functions
- Enable controlling the audio devices in Element Call from the OS instead of automatically detecting them
- Simplify the window flags in ElementCallActivity
- Work around the issue where the default audio device wasn't using the right audio stream
- Add onAudioPlaybackStarted, use it to start the audio-device related logic
2025-06-09 09:12:53 +02:00
Jorge Martin Espinosa
58a3ea8b1f Add catchingExceptions method to replace runCatching (#4797)
- Add `runCatchingExceptions` and `mapCatchingExceptions` to replace `runCatching` and `mapCatching`.
- Make `tryOrNull { ... }` catch only exceptions too.
- Apply the changes to the whole project.
- Add new Rust fakes for tests to handle the code that's now unblocked - previously it just threw an `UnsatisfiedLinkError` which we ignored.
- Add a new `detekt-rules` project with a `RunCatchingRule` to prevent `runCatching` and `mapCatching` usages.
2025-06-04 09:02:26 +02:00
ElementBot
498cf15d38 Sync Strings (#4775) 2025-05-30 08:47:39 +00:00
Benoit Marty
318f72a78d Ensure the CI is marked as failed when Maestro test is failing (#4700)
* Ensure the CI is marked as failed when Maestro test is failing

* Fix typo in String to disable bookmark in ChromeCustomTab

* Fix Maestro test now that matrix.org is using MAS to authenticate.

* Fix Maestro test - other issues due to recent changes.

* Maestro: add test on Element Call

* Run through Chrome on boarding step.

* Try suggestion from https://github.com/mobile-dev-inc/Maestro/issues/1126#issuecomment-2842220361

* Revert "Try suggestion from https://github.com/mobile-dev-inc/Maestro/issues/1126#issuecomment-2842220361"

This reverts commit d400644622c1a240deb61040f9095e3221e07f21.

* Add comment on Maestro flow.
2025-05-15 17:14:41 +02:00
Benoit Marty
b322a4bae5 Disable mutliple click (parallel or serial) on a room (#4683)
* Disable mutliple click (parallel or serial) on a room (Fixes #4619)

* Rename method from FirstThrottler

* Move check to the Compose and add unit test on it.
2025-05-13 14:12:19 +02:00
Benoit Marty
e8e75af506 Update "Learn more" link (#4686)
* Update target link for "Learn more".

* Rename VerifySelfSession* to OutgoingVerification*

* Optimize import

* Refactor to avoid long line

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
2025-05-09 11:10:30 +02:00
ElementBot
491eda9ba5 Sync Strings from Localazy (#4612)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-04-22 08:57:00 +02:00
Benoit Marty
e2e58749f5 [a11y] Make more items focusable (#4605)
* Fix settings entry point not available when there is no avatar on the account. Fixes #4599.

* Use Ktx extension `String.toUri()`

* Allow screen reader to focus on the user avatar to allow editing it.

* Fix import order
2025-04-22 08:50:50 +02:00
Benoit Marty
5d3de494d7 Fix audio output selection for Element Call (#4602)
* Fix audio output selection.

* Ensure that Element Call audio output uses a new connected device, even during a call.
Also add a few logs.

* Extract functions.

* Add more log and protect from crash.

* Revert formatting change

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
2025-04-17 10:36:42 +02:00