Move logic of different BottomSheets in MessagesView to presenters (#600)

* Move bottom sheet logic in `MessagesView` to presenters.

* Make the block inside `SheetState.hide` suspend.
This commit is contained in:
Jorge Martin Espinosa 2023-06-15 14:58:18 +02:00 committed by GitHub
parent 65ecfcc681
commit 244306545f
14 changed files with 294 additions and 84 deletions

View file

@ -37,6 +37,8 @@ import androidx.compose.ui.unit.dp
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.preview.PreviewGroup
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@ -66,6 +68,14 @@ fun ModalBottomSheet(
)
}
@OptIn(ExperimentalMaterial3Api::class)
fun SheetState.hide(coroutineScope: CoroutineScope, then: suspend () -> Unit) {
coroutineScope.launch {
hide()
then()
}
}
// This preview and its screenshots are blank, see: https://issuetracker.google.com/issues/283843380
@Preview(group = PreviewGroup.BottomSheets)
@Composable