From af9b0b444c154682497f37100548ad3b63b12ea8 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 25 Sep 2023 15:29:13 -0400 Subject: [PATCH] Fix for not clearing the new post message. It adds a delay to allow the composer to save the viewModel after calling cancel --- .../amethyst/ui/actions/NewPostView.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt index 0b72847d2..74f9103fc 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt @@ -214,7 +214,10 @@ fun NewPostView( PostButton( onPost = { postViewModel.sendPost(relayList = relayList) - onClose() + scope.launch { + delay(100) + onClose() + } }, isActive = postViewModel.canPost() ) @@ -224,7 +227,10 @@ fun NewPostView( Spacer(modifier = StdHorzSpacer) CloseButton(onPress = { postViewModel.cancel() - onClose() + scope.launch { + delay(100) + onClose() + } }) }, backgroundColor = MaterialTheme.colors.surface, @@ -1220,9 +1226,7 @@ private fun MarkAsSensitive( @Composable fun CloseButton(onPress: () -> Unit) { Button( - onClick = { - onPress() - }, + onClick = onPress, shape = ButtonBorder, colors = ButtonDefaults .buttonColors(