Commit Graph

44 Commits

Author SHA1 Message Date
Jorge Martin Espinosa
b219c05d06 Make sure we clean up the pre-processed and uploaded media (#5039)
* Add `MediaSender.cleanUp()` and `MediaPreProcessor.cleanUp()` methods: this will remove the temporary files created when pre-processing media before sending them.

* Make sure we clean up also the previous temporary media.

* Fix the condition for the custom back handler in the attachments preview screen

* Tests: check the clean up is performed when needed
2025-07-23 08:55:20 +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
Benoit Marty
cf17d93580 Stronger lambda error (#4771)
* Make sure lambdaError() make the test fail in all circumstances.

* Fix existing errors on tests.

* Uniformize the way we are creating class under test.

* Cleanup

* Fix typo

* Fix failing test after rebase.
2025-05-27 15:32:09 +00:00
Benoit Marty
caf25894d6 Reduce API of JoinedRoom, caller must use the Timeline API from liveTimeline instead. (#4731)
This removes lots of boilerplate code.
2025-05-20 09:07:43 +02:00
Jorge Martin Espinosa
c537e94146 Split MatrixRoom into BaseRoom and JoinedRoom (#4561)
`JoinedRoom` will now contain both a mandatory live timeline reference and all the functionality associated to it.

`BaseRoom` on the other hand will contain only functionality that's shared for both joined and not joined rooms.

`NotJoinedRoom` is a wrapper around `RoomPreviewInfo` data and a possible local `BaseRoom`, if it exists.

The `RustRoomFactory` cache is now gone since the persistent event cache should have the same effect.
2025-04-23 15:53:40 +02:00
renovate[bot]
9981ae7b1e fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.4.7 (#4548)
* fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.4.8

* Fix API breaks:

- Add `ReplyParameters` class and parameters to send functions.
- Remove outdated OIDC related values.
- Stop pre-processing the timeline to add the timeline start item, this is already done by the SDK.

* Use the new function to reply to messages in a quick reply from a notification, however:

1. We don't have the thread id value at the moment since the SDK does not provide it yet.
2. The replied to event id wasn't being passed from the notification info.

* Remove also timeline start virtual item for DMs, since this wasn't present before either

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2025-04-08 14:21:49 +02: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
c88b54fe2b Remove default parameter values.
This improve code coverage since some default value was never used.
2024-11-26 09:18:11 +01:00
Benoit Marty
67274bcc68 Remove blank line 2024-11-26 09:17:39 +01:00
Benoit Marty
7215786239 Pre-process media during the attachment preview 2024-11-25 17:11:31 +01:00
Benoit Marty
d6ee0846b3 Fix tests 2024-11-21 09:45:27 +01:00
Benoit Marty
ece62b7978 Allow caption for audio and file.
Need to preview all the attachments now, to be able to type a caption.
2024-11-21 09:45:26 +01:00
Benoit Marty
f138ae90aa Do not delete the original file when sending a media. Fixes #3800. 2024-11-08 10:11:06 +01:00
Benoit Marty
495e4b3d60 MediaPreProcessor: remove default value of parameter deleteOriginal. No functional change here. 2024-11-08 10:11:06 +01:00
Benoit Marty
19c56cdbe3 Send caption with media 2024-11-04 14:24:39 +01:00
Benoit Marty
e6f7300be6 Improve FakeMatrixRoom to be able to check all the parameters. 2024-10-30 18:39:55 +01:00
Benoit Marty
2531ccf8e9 Add media upload setting.
Compress media regarding the settings.
Image compression change quality to 78%
Video compression change size to 720 x 48
2024-10-28 10:56:58 +01: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
2b016227e9 Migrate license to AGPL.
Run script `uv run license-editor --repository ../element-x-android`
2024-09-06 17:19:19 +02:00
Benoit Marty
94f38f1af5 Rework FakeMatrixRoom so that it contains only lambdas. (#3229)
* Upgrade lint to 8.7.0-alpha01

* FakeMatrixRoom: lambda everywhere

Fix test compilation issues
2024-07-22 10:39:48 +02:00
Jorge Martin Espinosa
950e502ca6 Improve screenshot testing with ComposablePreviewScanner (#3125)
* Use ComposablePreviewScanner to rework how screenshot testing works
* Add test sharding
* Update screenshots
* Fixes for Element Gallery

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
Co-authored-by: Benoit Marty <benoit@matrix.org>
2024-07-03 13:05:06 +02:00
Benoit Marty
cdf6f48112 Change Test class suffix. 2024-05-30 10:11:18 +02:00
Jorge Martín
f2d240c66d Fix SDK integration 2024-03-20 09:36:35 +01:00
Benoit Marty
378692f743 Fix moar ktlint issues 2024-01-11 10:02:10 +01:00
renovate[bot]
7e9cda3aa9 Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0

* Run `./gradlew ktlintFormat` and fix some issues manually.

* Fix other issues reproted by Ktlint

* Limit false positives, KtLint removes unnecessary curly brace in String templates.

* Remove useless Unit

* Minor improvements over ktlint changes

* Restore `AlertDialogContent` behaviour

* Update screenshots

---------

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>
Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2024-01-10 16:22:24 +01:00
Benoit Marty
55ce9068ef Providing a thumbnail when sending a media is now optional. 2023-12-19 10:41:44 +01:00
Benoit Marty
3e166e3d89 Using Exception is OK here. 2023-11-29 17:03:27 +01:00
Benoit Marty
4f32299280 Use MimeTypes object instead of hard-coded strings. 2023-11-27 21:58:58 +01:00
Marco Romano
1014380e32 Always treat waveform as List<Float> (#1663)
[MSC3246](https://github.com/matrix-org/matrix-spec-proposals/pull/3246) specifies the waveform as a list of ints because:

> Because floating point numbers are not allowed in Matrix events

Though DSP on audio data is almost always done using their floating point representation.
This PR brings the float<->int rescaling in the `matrix` module so that the application code can always work with float waveform samples.
2023-10-27 12:49:58 +00:00
jonnyandrew
5c582bba1b Record and send voice messages (#1596)
---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-10-23 17:28:00 +00:00
Jorge Martin Espinosa
814c8edc4f Media upload cancellation (#1058)
* Initial implementation of media upload cancellation

* Add tests

* Add changelog

* Update screenshots

* Add documentation

* Fix lint issues

* Fix review comments

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-08-17 09:02:03 +00:00
Benoit Marty
56b8969376 Fix warning ('when' is exhaustive so 'else' is redundant here) 2023-07-20 15:33:00 +02:00
ganfra
31abc20fc2 Media: upload audio 2023-07-13 20:34:07 +02:00
ganfra
a8ff6fcbd8 Media upload: branch progress callback to UI 2023-06-28 23:14:08 +02:00
ganfra
0d0a5571af Rust sdk update: make the app compile 2023-06-22 09:50:17 +02:00
ganfra
b6e7228ce0 Fix MediaPreProcessor for images/videos sent as file 2023-06-16 13:52:07 +02:00
Jorge Martín
268447fd8c Fix small issues, improve Result.flatMap 2023-05-29 13:58:29 +02:00
ganfra
2c3fb8a549 Merge branch 'develop' into feature/fga/image_loading 2023-05-22 20:59:37 +02:00
ganfra
4c19bd3644 Media: keep the name of the file when possible 2023-05-22 20:24:42 +02:00
ganfra
1d00120b6a Media : some improvements and cleaning 2023-05-17 17:48:57 +02:00
ganfra
cc7d71af80 Media : branch upload to preview screen (need improvement) 2023-05-17 08:44:35 +02:00
ganfra
801e99a4db Media : extract an extension method to mediaupload 2023-05-16 11:24:14 +02:00
Jorge Martin Espinosa
ed16ea5e48 [Media upload] Upload image, video and files (#411)
* Add media upload

* Display media upload error messages using a Snackbar.
2023-05-11 15:56:13 +00:00
Jorge Martin Espinosa
cd298b9359 [Media upload] Media pre-processing (#403)
* Create `mediaupload` module for media pre-processing.

* Split `mediapicker` and `mediaupload` modules.
2023-05-10 10:06:56 +02:00