Close the media preview screen ASAP with sending queue enabled (#4089)

* Close the attachment preview screen ASAP when sending media with the send queue is enabled

* When the send queue FF is not enabled make sure to dismiss the screen after the media has been sent

* Make sure we get a scaled thumbnail from videos too, not only for images

* Unify several state holders into `SendActionState`.

* Fix lint issues, add `Flow.firstInstanceOf` extension fun

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa
2025-01-08 16:49:17 +01:00
committed by GitHub
parent 28cf775c32
commit f72fb9650b
15 changed files with 286 additions and 126 deletions

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2025 New Vector 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.core.coroutine
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only
* Please see LICENSE in the repository root for full details.
*/
/**
* Returns the first element of the flow that is an instance of [T], waiting for it if necessary.
*/
suspend inline fun <reified T> Flow<*>.firstInstanceOf(): T {
return first { it is T } as T
}