Browse Source

Media: clean up code

feature/fga/small_timeline_improvements
ganfra 1 year ago
parent
commit
468ed5276f
  1. 4
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMedia.kt
  2. 2
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaFactory.kt
  3. 7
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/viewer/MediaViewerView.kt
  4. 3
      libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt
  5. 1
      libraries/ui-strings/src/main/res/values/localazy.xml

4
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMedia.kt

@ -26,6 +26,4 @@ import kotlinx.parcelize.Parcelize @@ -26,6 +26,4 @@ import kotlinx.parcelize.Parcelize
data class LocalMedia(
val uri: Uri,
val info: MediaInfo,
) : Parcelable {
}
) : Parcelable

2
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaFactory.kt

@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.media.MediaFile @@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.media.MediaFile
interface LocalMediaFactory {
/**
* This method will create a [LocalMedia] with the given [MediaFile] and [MediaInfo]
* This method will create a [LocalMedia] with the given [MediaFile] and [MediaInfo].
*/
fun createFromMediaFile(
mediaFile: MediaFile,

7
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/viewer/MediaViewerView.kt

@ -64,7 +64,6 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar @@ -64,7 +64,6 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
import io.element.android.libraries.designsystem.utils.rememberSnackbarHostState
import io.element.android.libraries.matrix.api.media.MediaSource
import io.element.android.libraries.matrix.ui.media.MediaRequestData
import io.element.android.libraries.ui.strings.R.*
import kotlinx.coroutines.delay
import io.element.android.libraries.ui.strings.R as StringR
@ -181,7 +180,7 @@ private fun MediaViewerTopBar( @@ -181,7 +180,7 @@ private fun MediaViewerTopBar(
eventSink(MediaViewerEvents.OpenWith)
},
) {
Icon(imageVector = Icons.Default.OpenInNew, contentDescription = stringResource(id = string.action_share))
Icon(imageVector = Icons.Default.OpenInNew, contentDescription = stringResource(id = StringR.string.action_open_with))
}
IconButton(
enabled = actionsEnabled,
@ -189,7 +188,7 @@ private fun MediaViewerTopBar( @@ -189,7 +188,7 @@ private fun MediaViewerTopBar(
eventSink(MediaViewerEvents.SaveOnDisk)
},
) {
Icon(imageVector = Icons.Default.Download, contentDescription = stringResource(id = string.action_save))
Icon(imageVector = Icons.Default.Download, contentDescription = stringResource(id = StringR.string.action_save))
}
IconButton(
enabled = actionsEnabled,
@ -197,7 +196,7 @@ private fun MediaViewerTopBar( @@ -197,7 +196,7 @@ private fun MediaViewerTopBar(
eventSink(MediaViewerEvents.Share)
},
) {
Icon(imageVector = Icons.Default.Share, contentDescription = stringResource(id = string.action_share))
Icon(imageVector = Icons.Default.Share, contentDescription = stringResource(id = StringR.string.action_share))
}
}
)

3
libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt

@ -33,7 +33,8 @@ interface MatrixMediaLoader { @@ -33,7 +33,8 @@ interface MatrixMediaLoader {
/**
* @param source to fetch the data for.
* @param mimeType: optional mime type
* @param mimeType: optional mime type.
* @param body: optional body which will be used to name the file.
* @return a [Result] of [MediaFile]
*/
suspend fun downloadMediaFile(source: MediaSource, mimeType: String?, body: String?): Result<MediaFile>

1
libraries/ui-strings/src/main/res/values/localazy.xml

@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
<string name="action_no">"No"</string>
<string name="action_not_now">"Not now"</string>
<string name="action_ok">"OK"</string>
<string name="action_open_with">"Open with"</string>
<string name="action_quick_reply">"Quick reply"</string>
<string name="action_quote">"Quote"</string>
<string name="action_remove">"Remove"</string>

Loading…
Cancel
Save