68 Commits

Author SHA1 Message Date
Benoit Marty 34d17f4903 Merge pull request #7041 from element-hq/feature/bma/compileWithSdk37
Compile with sdk37 and target API 37
2026-06-18 16:15:47 +02:00
Jorge Martin Espinosa 9dc3dec72e Replace ContentResolver.delete usage with a backwards-compatible version (#7053)
The previous signature needed API 30, the new one is available since API 1
2026-06-18 15:48:21 +02:00
Benoit Marty c430877d87 Ensure Robolectric test are run using API 36 until the library support API 37. 2026-06-18 12:18:32 +02:00
Benoit Marty 568e137cd4 Merge branch 'develop' into feature/bma/multipleForward 2026-06-17 10:31:44 +02:00
Jorge Martin Espinosa 8e9c0bedf2 Fix sharing media inside the app (#7016)
When a `MediaSource` is disposed, the local temp file associated to it will be deleted from disk.

When we try sharing a media from the media viewer screen to another room, this will dismiss the screen, which in turn will dispose of the media source and remove the file, which then fails to be shared.

If we copy it first and then make sure we delete it after trying to send it, it works fine.
2026-06-16 16:42:59 +02:00
Benoit Marty d33852d32f Room selection: add a limitation of 10 rooms for Share and Forward actions. 2026-06-12 09:22:29 +02:00
Benoit Marty 4ad495d36c Add support for slash commands (under Feature Flag) (#6482)
* Add support for slash commands

* Update screenshots

* Rename module `slash` to `slashcommands`

* Rename `SlashCommand` to `SlashCommandService`

* Introduce MsgType in order to send text message with a different msgtype value.

* Format file and add parameter names, add default values and cleanup

* Add isSupported parameter to filter out unsupported yet commands.

* Slash commands: disable suggestions if the feature is disabled.

* Fix sending shrug command.

* Add missing test on SuggestionsProcessor

* Add tests on MessageComposerPresenter about slash command.

* Fix import ordering

* Add missing tests on CommandExecutor

* Add missing tests in MarkdownTextEditorStateTest

* Slash commands: Improve code when sending message with prefix.

* Slash commands: Add support for /unflip

---------

Co-authored-by: ElementBot <android@element.io>
2026-04-02 16:15:32 +02:00
Jorge Martin Espinosa ae6ea76794 Use ShareIntentHandler early to avoid distributing the whole intent (#6274)
* Use `ShareIntentHandler` early to avoid distributing the whole intent

This would make the intent be serialized as part of `NavTarget` and could potentially lead to `TransactionTooLargeException`s.

We now pass a new `ShareIntentData` class around, containing the minimum amount of data needed. We also have a new `OnSharedData` post-processor to revoke uri access after they've been shared.

* Move `UriToShare` next to `ShareIntentData` and add docs
2026-03-03 13:12:33 +00:00
Jorge Martín 01fc964cb6 When handling a plain text share intent, check if it contains Uris before handling its content. 2025-11-20 16:41:23 +01:00
Benoit Marty 8285478688 API modules do not need to setup dependency injection.
Move the implementation to the impl modules.
2025-11-12 19:05:39 +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
Benoit Marty 7ad9c8f687 Rename handleEvents to handleEvent 2025-11-07 12:21:43 +01:00
Benoit Marty fdd4e2115c Always use the handleEvent(s) function the same way. 2025-11-03 18:49:00 +01:00
Benoit Marty 07b6148035 Remove context(parentNode: Node) and provide the parent Node as a parameter. 2025-10-31 12:04:57 +01:00
Benoit Marty 6298209ad9 Create Fake classes in test modules 2025-10-30 18:32:31 +01:00
Benoit Marty f174084942 Use context parameter for the parentNode 2025-10-30 16:32:53 +01:00
Benoit Marty 02dc71c4c3 Remove NodeBuilder to ensure that Params and Callback are always provided. 2025-10-30 16:32:52 +01:00
Benoit Marty be03c50aaf Ensure a Callback and only one is provided in the Plugin. Also reduce boilerplate code in Nodes. 2025-10-30 16:32:51 +01:00
Benoit Marty 70cbf3c090 Improve code on ShareNode 2025-10-29 09:03:37 +01:00
Benoit Marty 263e761907 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
renovate[bot] 5b9ce7a210 Update metro to v0.6.7 (#5416)
* Update metro to v0.6.7

* Replace `@Inject` with `@AssistedInject` where needed

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2025-09-26 08:16:36 +00:00
Benoit Marty 4d7d0ac8d0 Avoid using AndroidJUnit4 runner to test Entrypoint implementations. 2025-09-16 14:38:32 +02:00
Benoit Marty a1aeb24f23 Add test on DefaultEntryPoints 2025-09-16 14:38:32 +02:00
Benoit Marty a575019760 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
Benoit Marty e88743bd6a Rename anvil modules to annotations and codegen 2025-09-05 14:26:27 +02:00
Jorge Martín e8328858ab Fixes after rebase 2025-09-04 16:49:21 +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
Jorge Martin Espinosa 35928e3630 Threads - first iteration (#5165)
* Initial threads support: parse `ThreadSummary`.

Replace several `isThreaded` values with `EventThreadInfo`, which contains the info about the event either being the root of a thread or part of it.

* Add `Threaded` timeline mode

* Add a `liveTimeline` parameter to `TimelineController`'s  constructor. This way we can customise which timeline will be used as the 'live' one. Also add `@LiveTimeline` DI qualifier for the actual live timeline of the room.

* Create `ThreadedMessagesNode`. Allow opening a thread in a separate screen.

* Add the callbacks for the list menu actions - even if they're the wrong ones and will send the data to the room instead

* Send attachments and location in threads

* Fix polls in threads, add support for sending voice messages in threads

* Display thread summaries only when the feature flag is enabled

* Use 'Reply' instead of 'Reply in thread' when in threaded timeline mode

* Remove incorrect usage of `Timeline` in `MessageComposerPresenter`. This led to replies to threaded events not appearing as actual replies.

---------

Co-authored-by: ElementBot <android@element.io>
2025-08-19 13:35:48 +00:00
renovate[bot] 90ad9616c0 Update dependency org.matrix.rustcomponents:sdk-android to v25.8.18 (#5182)
* Update dependency org.matrix.rustcomponents:sdk-android to v25.8.18

* Fix broken API changes:
- The send queue usage is now mandatory.
- The media upload progress now comes back in the send queue state (this still hasn't been applied to the UI in the timeline).

* Update screenshots
---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: ElementBot <android@element.io>
2025-08-18 16:41:14 +02:00
Benoit Marty 3e73496c85 Remove FeatureFlag.IncomingShare 2025-08-12 15:52:05 +02:00
Jorge Martin Espinosa adc61b3826 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
renovate[bot] 040fde7f22 Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23 (#5073)
* Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23

* Adapt to SDK changes:

- Add 'creator' role, adapt existing logic to it.
- Remove `ReplyParameters`, replace with `EventId` where possible.
- Fix changes in OIDC auth methods.
- Add more join rules.

* Make sure both creators and users with power level >= 150 are displayed as 'owners' in the room member list.

* Don't close the roles and permissions screen if the user is a creator

* Use `MediaPreviewValue.DEFAULT` for `MediaPreviewConfig.DEFAULT` too

* Improve APIs around checking roles and power levels:
    - Ensure `RoomInfo.RoomPowerLevels.users` can't be directly used to check power levels since it can't check the power levels for creators.
    - Add a few helper functions to handle actions that relied on the previous `users` property, and docs to explain their usages.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2025-07-24 11:58:30 +02:00
Benoit Marty 5f191d9f9c Fix coroutine scope (#4820)
* Inject the session scope instead of the application scope where it's possible.

* Create AppCoroutineScope annotation to let developers explicitly choose the appropriate CoroutineScope when injecting one.
2025-06-04 15:33:51 +00:00
Jorge Martin Espinosa efdc10e60a 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
Jorge Martin Espinosa 9b9d75aa5f Add ActiveRoomsHolder to manage the active rooms for a session (#4758) 2025-05-26 11:03:55 +00:00
Benoit Marty 8d115213cc 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 4f39e09f91 Fix generic mime type being uploaded when several files are externally shared with the app. (#4715)
i.e. `image/*` when sharing a png and jpg file.
2025-05-13 15:26:47 +00:00
Jorge Martin Espinosa 1904c98c9a Make sure any JoinedRustRoom is destroyed after use (#4678) 2025-05-05 16:09:07 +02:00
Jorge Martin Espinosa 619aa6f2de 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] b9385ce382 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 97f3be3dc5 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 4a5259f1d9 Fix tests 2024-11-21 09:45:27 +01:00
Benoit Marty 4e9f429491 Merge pull request #3776 from element-hq/feature/bma/targetApi35
Target api 35
2024-11-05 09:39:50 +01:00
Benoit Marty 920c50cc3d Compile and target API 35.
Tested OK on a API 35 emulator.
2024-10-31 09:27:52 +01:00
Benoit Marty 4b98ee92e3 Improve FakeMatrixRoom to be able to check all the parameters. 2024-10-30 18:39:55 +01:00
Benoit Marty a51c2753ba Fix test compilation issue. 2024-10-28 13:50:47 +01:00