mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Fix issues reported by Konsist.
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ import io.element.android.libraries.mediaviewer.impl.local.audio.MediaAudioView
|
|||||||
import io.element.android.libraries.mediaviewer.impl.local.file.MediaFileView
|
import io.element.android.libraries.mediaviewer.impl.local.file.MediaFileView
|
||||||
import io.element.android.libraries.mediaviewer.impl.local.image.MediaImageView
|
import io.element.android.libraries.mediaviewer.impl.local.image.MediaImageView
|
||||||
import io.element.android.libraries.mediaviewer.impl.local.pdf.MediaPdfView
|
import io.element.android.libraries.mediaviewer.impl.local.pdf.MediaPdfView
|
||||||
import io.element.android.libraries.mediaviewer.impl.local.txt.TxtFileView
|
import io.element.android.libraries.mediaviewer.impl.local.txt.TextFileView
|
||||||
import io.element.android.libraries.mediaviewer.impl.local.video.MediaVideoView
|
import io.element.android.libraries.mediaviewer.impl.local.video.MediaVideoView
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -49,7 +49,7 @@ fun LocalMediaView(
|
|||||||
localMedia = localMedia,
|
localMedia = localMedia,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
mimeType == MimeTypes.PlainText -> TxtFileView(
|
mimeType == MimeTypes.PlainText -> TextFileView(
|
||||||
localMedia = localMedia,
|
localMedia = localMedia,
|
||||||
textFileViewer = textFileViewer,
|
textFileViewer = textFileViewer,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import io.element.android.libraries.architecture.AsyncData
|
|||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
||||||
open class TxtFileProvider : PreviewParameterProvider<AsyncData<ImmutableList<String>>> {
|
open class TextFileContentProvider : PreviewParameterProvider<AsyncData<ImmutableList<String>>> {
|
||||||
override val values: Sequence<AsyncData<ImmutableList<String>>>
|
override val values: Sequence<AsyncData<ImmutableList<String>>>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
AsyncData.Uninitialized,
|
AsyncData.Uninitialized,
|
||||||
+6
-6
@@ -32,7 +32,7 @@ import kotlinx.collections.immutable.ImmutableList
|
|||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TxtFileView(
|
fun TextFileView(
|
||||||
localMedia: LocalMedia?,
|
localMedia: LocalMedia?,
|
||||||
textFileViewer: TextFileViewer,
|
textFileViewer: TextFileViewer,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -55,7 +55,7 @@ fun TxtFileView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TxtFileViewContent(
|
TextFileContentView(
|
||||||
data = data.value,
|
data = data.value,
|
||||||
textFileViewer = textFileViewer,
|
textFileViewer = textFileViewer,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@@ -63,7 +63,7 @@ fun TxtFileView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun TxtFileViewContent(
|
private fun TextFileContentView(
|
||||||
data: AsyncData<ImmutableList<String>>,
|
data: AsyncData<ImmutableList<String>>,
|
||||||
textFileViewer: TextFileViewer,
|
textFileViewer: TextFileViewer,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -95,10 +95,10 @@ private fun TxtFileViewContent(
|
|||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TxtFileViewPreview(
|
internal fun TextFileContentViewPreview(
|
||||||
@PreviewParameter(TxtFileProvider::class) text: AsyncData<ImmutableList<String>>,
|
@PreviewParameter(TextFileContentProvider::class) text: AsyncData<ImmutableList<String>>,
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
TxtFileViewContent(
|
TextFileContentView(
|
||||||
data = text,
|
data = text,
|
||||||
textFileViewer = { lines, modifier ->
|
textFileViewer = { lines, modifier ->
|
||||||
Text(
|
Text(
|
||||||
@@ -51,6 +51,7 @@ class KonsistClassNameTest {
|
|||||||
.withoutName(
|
.withoutName(
|
||||||
"AspectRatioProvider",
|
"AspectRatioProvider",
|
||||||
"OverlapRatioProvider",
|
"OverlapRatioProvider",
|
||||||
|
"TextFileContentProvider",
|
||||||
)
|
)
|
||||||
.also {
|
.also {
|
||||||
// Check that classes are actually found
|
// Check that classes are actually found
|
||||||
|
|||||||
Reference in New Issue
Block a user