Add content scanner support to media gallery and viewer (Element Pro) (#7233)

* Add content scanner support to media gallery and viewer

* Improve UI and previews

* Remove default content validation state in media content views

* Disable click for invalid media items in the gallery events

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa
2026-07-17 15:26:13 +02:00
committed by GitHub
parent 19724aaa78
commit 2705efad15
88 changed files with 892 additions and 441 deletions
@@ -116,6 +116,7 @@ class DefaultContentValidationState(
private fun calculateOverallState(states: Map<String, ContentValidationValue>): ContentValidationValue {
return when {
states.values.isEmpty() -> ContentValidationValue.Unknown
states.values.any { it is ContentValidationValue.Invalid } -> ContentValidationValue.Invalid
states.values.any { it is ContentValidationValue.Loading } -> ContentValidationValue.Loading
states.values.any { it is ContentValidationValue.UnrecoverableError } -> states.values.first { it is ContentValidationValue.UnrecoverableError }
@@ -26,8 +26,10 @@ val LocalEventContentValidationState = staticCompositionLocalOf<EventContentVali
/**
* A noop implementation of the [EventContentValidationCache] that immediately returns a successful validation state. This will be used in FOSS.
*/
class NoopEventContentValidationCache : EventContentValidationCache {
override operator fun get(eventId: EventId): ContentValidationState = noopValue
class NoopEventContentValidationCache(
private val provided: ContentValidationState = noopValue,
) : EventContentValidationCache {
override operator fun get(eventId: EventId): ContentValidationState = provided
}
/**