Commit Graph

166 Commits

Author SHA1 Message Date
Jorge Martin Espinosa
9074692189 Fix crash when starting a DM (#6419)
`AnchoredDraggable.requireOffset` was called before it was populated when displaying  `CreateDmConfirmationBottomSheet`, because the keyboard and the bottom sheet were causing conflicting animations related to the insets.

Hiding the keyboard before displaying the bottom sheet seems to fix the issue, and `skipPartiallyExpanded` results in a better UX (and also worked around the issue by itself).
2026-03-23 16:00:04 +01:00
bmarty
3a0e01b63d Sync Strings from Localazy 2026-03-16 00:42:32 +00:00
Jorge Martin Espinosa
33a78ecda3 When linkifying, adjust the URLSpan's url too (#6188) 2026-02-12 12:12:57 +00:00
Jorge Martin Espinosa
a805e0ef6d Fix linkify helper index out of bounds with parenthesis (#6140)
When parenthesis were mismatched by having more opening parenthesis than closing ones, we could end up incorrectly making the URLSpan `end` value greater than the actual text length, causing an `IndexOutOfBoundsException`
2026-02-05 09:33:38 +01:00
Benoit Marty
155d3fb96f Fix test compilation 2025-12-29 12:47:21 +01:00
Benoit Marty
6715104f8f Fix class cast exception
java.lang.ClassCastException: io.element.android.libraries.androidutils.json.DefaultJsonProvider cannot be cast to kotlinx.serialization.json.Json
2025-12-29 12:00:58 +01:00
Jorge Martin Espinosa
55185b540d Merge branch 'develop' into fix/crash-on-nightly-incorrect-di-cast 2025-12-22 16:04:25 +01:00
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
Jorge Martín
9127ce743d Change JsonProvider from a parent interface to a typealias
This fixes the error seen in the nightlies
2025-12-22 14:17:08 +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