Commit Graph

134 Commits

Author SHA1 Message Date
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
Jorge Martin Espinosa
4dda027ed4 Use in-call volume and mode for EC, allow external audio devices (#4481)
* Use in-call volume and mode for EC:
* Try routing audio to external device
* Place speaker before earpiece in list of audio devices
2025-04-11 16:46:51 +02:00
Jorge Martin Espinosa
e2afa9a691 Add Google Tink dependency, replacing androidx.security.crypto (#4405)
* Add Google Tink dependency, replacing `androidx.security.crypto`

* Replace the `EncryptedFile` implementation too

* Extract constants, add some more docs
2025-03-17 10:04:21 +01:00
bmarty
9456ee921d Sync Strings from Localazy 2025-03-10 00:28:38 +00:00
Jorge Martin Espinosa
247071b196 Try avoiding trailing punctuation inside linkified URLs. (#4214)
Create `LinkfierHelper` and post-process URLSpans added to make sure they honor the actual URLs in text by removing unnecessarily added trailing punctuation.
2025-02-21 16:58:59 +00:00
bmarty
3dddd90d97 Sync Strings from Localazy 2025-02-17 00:30:17 +00:00
bmarty
5a4cac7d2d Sync Strings from Localazy 2025-02-03 00:29:01 +00:00
Benoit Marty
05fc76822a Apply dual licenses: AGPL + Element Commercial to file headers.
2 replace all actions have been performed:
- "SPDX-License-Identifier: AGPL-3.0-only" to "SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial"
- "Please see LICENSE in the repository root for full details." to "Please see LICENSE files in the repository root for full details."
2025-01-07 10:05:04 +01:00
Benoit Marty
35bbb3a139 Add Accept-Language to extra header when opening CustomChromeTab
Follow good practice from https://developer.android.com/guide/topics/resources/app-languages#consider-header
2024-12-16 16:58:58 +01:00
ElementBot
411895456b Sync Strings - add translations to Finnish (#3883)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2024-11-18 11:37:17 +00:00
Benoit Marty
22bb8796ef Delete temporary created files. 2024-11-08 10:11:06 +01:00
Jorge Martin Espinosa
6b2aa7eb8c Refresh room summaries when date or time changes in the device (#3683)
* Add `DateTimeObserver` to rebuild the room summary data when the date/time changes.

* Add time changed action too, to trigger when the user manually changes date/time

* Fix timezone issue by adding `TimezoneProvider`, fix tests

* Create test for `DateTimeObserver` usage in `RoomListDataSource`

* Create aRoomListRoomSummaryFactory function.

* Improve test by faking the lastMessageTimestampFormatter

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
2024-10-16 09:10:58 +00:00
Benoit Marty
67140fe165 Do what the doc says: if no CustomChrome tab is available, try to open the Url in any installed browser. 2024-10-08 09:10:12 +02:00
Jorge Martin Espinosa
2efdb3ae45 Centralise the DI code generation logic (#3562)
* Create Anvil extension helper

* Use the helper everywhere
2024-09-30 12:20:28 +00:00
Benoit Marty
7a9a7c4af5 Protection against ActivityNotFoundException. 2024-09-24 16:21:41 +02:00
Benoit Marty
62a6e916a6 Migrate license to AGPL - XML files. 2024-09-06 17:43:35 +02:00
Benoit Marty
2b016227e9 Migrate license to AGPL.
Run script `uv run license-editor --repository ../element-x-android`
2024-09-06 17:19:19 +02:00
bmarty
5765d9bf9f Sync Strings from Localazy 2024-08-19 00:25:36 +00:00
Jorge Martín
252b3e11a0 Improve existing APIs 2024-08-13 08:55:06 +02:00
bmarty
d288ace4bd Sync Strings from Localazy 2024-07-29 00:26:27 +00:00
ElementBot
9522569860 Sync Strings (#3232)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2024-07-22 08:59:47 +00:00
jmartinesp
58f2cbf489 Sync Strings from Localazy 2024-07-03 11:21:27 +00:00
Benoit Marty
d43b0e8401 Remove the method supportNotificationChannels() from SystemUtils, it has been copied in NotificationChannels.kt 2024-06-26 11:59:48 +02:00
bmarty
57510316ec Sync Strings from Localazy 2024-06-10 00:17:04 +00:00
Benoit Marty
ffff1c904f Use functions from IntentCompat 2024-06-06 09:56:36 +02:00