1
0
mirror of https://github.com/element-hq/element-x-android.git synced 2026-10-23 18:49:00 +03:00

62 Commits

Author SHA1 Message Date
Benoit Marty
845a193500 Move viewfolder/impl tests to the features.viewfolder.impl package
The tests and fakes were in `features.viewfolder.test.*`, which looks like a package of a test module, while they are in the `impl` module and test code from `features.viewfolder.impl.*`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 12:10:20 +02:00
Benoit Marty
b9ed090400 Use only ClipboardHelper to copy to the clipboard, and do not render feedback on Android 13+
Since Android 13, the system displays its own confirmation when content
is copied to the clipboard, so the application does not render its own
Toast or Snackbar anymore on those versions.

Context.copyToClipboard, CopyToClipboardUseCase and the direct
ClipboardManager usage in EventDebugInfoView are removed.
ClipboardHelper.copyPlainText(text, isSensitive, onSuccessOnOldDevice)
is now the only entry point, and AndroidClipboardHelper is the only
class using ClipboardManager.

Copy actions from the views are moved to their Presenter through new
events, or to the Node when there is no Presenter. A ToastHelper is
introduced so that Toasts are kept where they were used before.
Snackbars are kept where they were already used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 11:40:08 +02:00
Benoit Marty
4c4389b29a Remove unnecessary Material3 experimental opt-ins
Many Material3 APIs are now stable, so the `ExperimentalMaterial3Api` and `ExperimentalMaterial3ExpressiveApi`
opt-ins are not required anymore at those places. Also remove the propagating `@ExperimentalMaterial3Api`
marker from `TopAppBarScrollBehaviorLayout`, which does not use experimental API anymore.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:45:30 +02:00
Benoit Marty
740e3b621b Merge pull request #7344 from hayaksi1/fix/6371-save-file-name-conflicts
Keep saving files to Downloads once 32 files share the same name
2026-08-27 10:01:57 +02:00
Benoit Marty
2b55ff097f ViewFileEvents -> ViewFileEvent 2026-08-25 10:31:09 +02:00
Benoit Marty
b2b0927ea9 Merge branch 'develop' into fix/6371-save-file-name-conflicts 2026-08-24 18:14:03 +02:00
Benoit Marty
4c4cdd1678 Merge branch 'develop' into fix/6371-save-file-name-conflicts 2026-08-24 09:38:35 +02:00
hayaksi1
03c330ee07 Rename PreviewParameterProvider subclasses to the PreviewParam suffix
The `Provider` suffix reads as a dependency provider rather than as preview
data, and it collides with the real providers in the codebase — `StringProvider`,
`PickerProvider`, the login feature's `AccountProvider` — so the name says
nothing about which of the two a class is. `PreviewParam` says it.

195 classes are renamed, along with the 185 files named after them, the konsist
rule that enforces the convention, the presentation-class file templates and the
onboarding documentation.

This cannot be split. `Konsist.scopeFromProduction()` scans the whole project, so
flipping the assertion before every class has moved leaves the rule red, and a
rule that accepted either suffix during a transition would be exactly the kind of
compatibility layer this convention change is meant to remove.

Two judgement calls in the rule itself. The `name.endsWith("PreviewProvider")`
exclusion is dropped: its only job was to reject a redundant `Preview` before
`Provider`, and the new suffix already contains it; no class currently ends with
`PreviewProvider`, so removing it changes nothing today. And
`EditableAvatarViewUriProvider` is renamed rather than deleted from the exclusion
list even though no such class exists in this repository, since it presumably
comes from the modules overlaid for the enterprise build.

Nothing keyed off the old suffix: no snapshot filename contains a provider class
name, so no Paparazzi image changes, and the Kover variants match on `*Presenter`,
`*State` and `*ViewKt`, so coverage bounds are unaffected.
2026-08-17 17:40:33 +03:00
Benoit Marty
9822b3d4f7 Add KDoc to the single-interface feature API modules
Cover the last remaining interfaces across features/announcement, cachecleaner,
call, contentscanner, createroom, knockrequests, lockscreen, rolesandpermissions,
startchat, userprofile and viewfolder, with their members and parameters.

Grouped into one commit rather than eleven near-empty ones, per the AGENTS.md rule
about tiny commits.

This completes every features/* api module.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 12:00:42 +02:00
hayaksi1
4558590492 Cover both MediaStore save paths with a fake provider
DefaultFileSave had no test at all and AndroidLocalMediaActions only exercised the
failing path, so neither the uniquifying retry nor the new IOException on a null
insert was ever executed.

FakeMediaStoreContentProvider stands in for the media authority: it records the
display names an insert is attempted with, keeps whatever is copied into it, and can
either collide a name the way MediaStore does past 32 files or refuse to create
anything. Both call sites now go through it for the plain save, the retry and the
rejected insert.

Its name cannot follow the Fake<Interface> convention because it extends the
framework ContentProvider, so it joins the existing exceptions in
KonsistClassNameTest next to FakeFileSystem and FakeKeyStore.
2026-08-10 11:49:15 +03:00
hayaksi1
17365a50d1 Keep saving files to Downloads once 32 files share the same name
MediaStore de-duplicates the display name of a new file itself, but its
uniquifier gives up after 32 collisions and throws IllegalStateException.
Saving then failed with "Sorry, an error occurred" and wrote nothing, and
because image.png is the name most screenshots arrive with, a user who
saves media regularly could reach a state where that name never saved
again without deleting files from Downloads by hand.

A new saveWithUniqueFileName helper in androidutils retries the insert
once with a suffixed name when the platform reports it cannot build a
unique one; a second failure propagates so genuine errors still surface.
withFileNameSuffix builds that name by inserting the suffix before the
extension, and handles names without one.

Both call sites are fixed: AndroidLocalMediaActions and DefaultFileSave
carried byte-identical logic and therefore the identical defect. While in
AndroidLocalMediaActions, a null output uri from ContentResolver.insert
now throws instead of reporting success without writing anything.

The pre-Android-Q path is untouched: it overwrites rather than
uniquifying, so it never reaches this limit.

Relates to https://github.com/element-hq/element-x-android/issues/6371
2026-08-09 01:59:25 +03:00
Benoit Marty
d1cf1aa09f Fix deprecation warning on androidx.compose.material3.ListItem 2026-08-06 18:35:17 +02:00
Benoit Marty
56f033e0ee Revert "Use Folder icon from Compound."
This reverts commit f4adde627f.
2026-04-02 09:25:30 +02:00
Benoit Marty
f4adde627f Use Folder icon from Compound. 2026-03-24 18:06:08 +01:00
renovate[bot]
896d62a81e Update metro to v0.11.0 (#6245)
* Update metro to v0.11.0

* Fix `@AssistedInject` usages

Now the injected variables in the factories must match the names in the constructors

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2026-02-25 16:19:47 +01:00
Benoit Marty
b5d15ee787 Fix issue detected by lint. 2025-12-17 10:59:48 +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
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
43972dba68 Rename fun in Callback for clarity. 2025-10-30 16:32:48 +01:00
Benoit Marty
263e761907 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
67c9daa0bf Add Konsist test to check that toPersistentList() is not used.
Same for `toPersistentSet()` and `toPersistentMap()`.
Fix existing issues.
2025-10-08 15:51:18 +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
e89d21b1b2 Fix issue after rebase. 2025-09-16 14:41:00 +02: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
0955866dcd Rename to follow naming convention 2025-09-16 10:36:35 +02:00
Benoit Marty
e3f7865193 Compute the content in the LaunchEffect 2025-09-08 17:09:23 +02:00
Benoit Marty
c8bf49dde7 Improve rendering of title of the folder view 2025-09-08 16:56:59 +02:00
Benoit Marty
88f38a0523 Format files. 2025-09-08 16:45:54 +02:00
Benoit Marty
f0291b21da Restore commented out code.
Fix regression from #5253
2025-09-08 16:42:58 +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
Benoit Marty
70aa31df00 [a11y] Ensure that heading() is applied to all screen titles. 2025-07-04 12:15:42 +02: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
Benoit Marty
1904631702 Remove blank line 2025-03-18 12:31:41 +01:00
Benoit Marty
6609001040 i18n 2025-03-18 11:43:13 +01:00
Benoit Marty
29f416bda2 Extract FileContent to its own file. 2025-03-18 11:38:36 +01:00
Benoit Marty
3eb92a7849 Render txt files content.
PdfViewer increase the top padding.
2025-03-14 16:51:57 +01:00
Benoit Marty
eda18f8b78 Replace Material icons with Compound icons wherever it's possible 2025-02-26 22:19:19 +01: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