Hide the send quality toggle for gifs.

This commit is contained in:
Alex Hart
2026-09-02 16:11:22 -03:00
parent 4be2685211
commit e9e0c2bc19
2 changed files with 14 additions and 8 deletions
@@ -161,8 +161,15 @@ internal fun MediaEditorToolbarSharedButtons(
}
}
/**
* Gifs are exempt along with documents: an image/gif is never re-encoded on send, and the mp4s we treat as gifs are
* already sized by whoever handed them to us, so a quality choice there is a control that does nothing.
*/
private fun isQualityVisible(state: MediaEditState, editorState: EditorState): Boolean {
return !state.isStory && editorState !is EditorState.Document
return !state.isStory &&
editorState !is EditorState.Document &&
editorState !is EditorState.Gif &&
editorState !is EditorState.VideoGif
}
private fun isSaveVisible(editorState: EditorState): Boolean {
@@ -28,9 +28,8 @@ import org.signal.mediasend.MediaSendDependenciesRule
import org.signal.mediasend.test.TestTags
/**
* Covers which of the shared toolbar actions each kind of media gets, which is the parity contract with the v2 review
* screen: send quality is meaningless for stories and documents, saving is for stills only, and adding media is off the
* table for documents and view-once sends.
* Covers which of the shared toolbar actions each kind of media gets: send quality is meaningless for stories,
* documents and gifs, saving is for stills only, and adding media is off the table for documents and view-once sends.
*/
@RunWith(RobolectricTestRunner::class)
@Config(application = Application::class)
@@ -55,10 +54,10 @@ class MediaEditorToolbarSharedButtonsTest {
}
@Test
fun `Given a gif, when rendering the toolbar, then quality, save and add media are offered`() {
fun `Given a gif, when rendering the toolbar, then quality is not offered`() {
setContent(state(media = GIF), EditorState.Gif)
assertQuality(visible = true)
assertQuality(visible = false)
assertSave(visible = true)
assertAddMedia(visible = true)
}
@@ -73,10 +72,10 @@ class MediaEditorToolbarSharedButtonsTest {
}
@Test
fun `Given a video gif, when rendering the toolbar, then saving is not offered`() {
fun `Given a video gif, when rendering the toolbar, then quality and saving are not offered`() {
setContent(state(media = VIDEO_GIF), EditorState.VideoGif)
assertQuality(visible = true)
assertQuality(visible = false)
assertSave(visible = false)
assertAddMedia(visible = true)
}