Browse Source

Merge pull request #3567 from frebib/frebib/captioned-filename

Use MSC2530 filename when loading media
pull/3502/head
Benoit Marty 3 weeks ago committed by GitHub
parent
commit
249104bf38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt
  2. 8
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt
  3. 8
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt

4
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt

@ -324,7 +324,7 @@ class MessagesFlowNode @AssistedInject constructor( @@ -324,7 +324,7 @@ class MessagesFlowNode @AssistedInject constructor(
is TimelineItemImageContent -> {
val navTarget = NavTarget.MediaViewer(
mediaInfo = MediaInfo(
name = event.content.body,
name = event.content.filename ?: event.content.body,
mimeType = event.content.mimeType,
formattedFileSize = event.content.formattedFileSize,
fileExtension = event.content.fileExtension
@ -358,7 +358,7 @@ class MessagesFlowNode @AssistedInject constructor( @@ -358,7 +358,7 @@ class MessagesFlowNode @AssistedInject constructor(
is TimelineItemVideoContent -> {
val navTarget = NavTarget.MediaViewer(
mediaInfo = MediaInfo(
name = event.content.body,
name = event.content.filename ?: event.content.body,
mimeType = event.content.mimeType,
formattedFileSize = event.content.formattedFileSize,
fileExtension = event.content.fileExtension

8
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemImageView.kt

@ -81,7 +81,13 @@ fun TimelineItemImageView( @@ -81,7 +81,13 @@ fun TimelineItemImageView(
modifier = Modifier
.fillMaxWidth()
.then(if (isLoaded) Modifier.background(Color.White) else Modifier),
model = MediaRequestData(content.preferredMediaSource, MediaRequestData.Kind.File(content.body, content.mimeType)),
model = MediaRequestData(
source = content.preferredMediaSource,
kind = MediaRequestData.Kind.File(
body = content.filename ?: content.body,
mimeType = content.mimeType,
),
),
contentScale = ContentScale.Fit,
alignment = Alignment.Center,
contentDescription = description,

8
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemVideoView.kt

@ -88,7 +88,13 @@ fun TimelineItemVideoView( @@ -88,7 +88,13 @@ fun TimelineItemVideoView(
modifier = Modifier
.fillMaxWidth()
.then(if (isLoaded) Modifier.background(Color.White) else Modifier),
model = MediaRequestData(content.thumbnailSource, MediaRequestData.Kind.File(content.body, content.mimeType)),
model = MediaRequestData(
source = content.thumbnailSource,
kind = MediaRequestData.Kind.File(
body = content.filename ?: content.body,
mimeType = content.mimeType
)
),
contentScale = ContentScale.Fit,
alignment = Alignment.Center,
contentDescription = description,

Loading…
Cancel
Save