mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Add a FileViewerEntryPoint to render in-memory content as a file
Introduce io.element.android.libraries.mediaviewer.api.FileViewerEntryPoint, a reusable screen which renders content that is not a Matrix media the same way the media viewer renders a file, with Share and Download actions. The caller provides a filename, a mime type and the whole content as a String. The node writes it to a temporary file in the cache directory, then reuses LocalMediaView (so text content goes through TextFileViewer) and LocalMediaActions for sharing and saving on disk. The node is contributed to AppScope so that the screen can be used from any graph, since MediaViewerNode itself is bound to RoomScope and depends on the timeline data sources. Also route MimeTypes.Json to TextFileView in LocalMediaView, so that a json file is rendered as text instead of falling back to the generic file card. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.mediaviewer.test
|
||||
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import io.element.android.libraries.mediaviewer.api.FileViewerEntryPoint
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeFileViewerEntryPoint : FileViewerEntryPoint {
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
params: FileViewerEntryPoint.Params,
|
||||
callback: FileViewerEntryPoint.Callback,
|
||||
): Node = lambdaError()
|
||||
}
|
||||
Reference in New Issue
Block a user