Fix for not clearing the new post message. It adds a delay to allow the composer to save the viewModel after calling cancel
This commit is contained in:
@@ -214,7 +214,10 @@ fun NewPostView(
|
|||||||
PostButton(
|
PostButton(
|
||||||
onPost = {
|
onPost = {
|
||||||
postViewModel.sendPost(relayList = relayList)
|
postViewModel.sendPost(relayList = relayList)
|
||||||
onClose()
|
scope.launch {
|
||||||
|
delay(100)
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isActive = postViewModel.canPost()
|
isActive = postViewModel.canPost()
|
||||||
)
|
)
|
||||||
@@ -224,7 +227,10 @@ fun NewPostView(
|
|||||||
Spacer(modifier = StdHorzSpacer)
|
Spacer(modifier = StdHorzSpacer)
|
||||||
CloseButton(onPress = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
scope.launch {
|
||||||
|
delay(100)
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
backgroundColor = MaterialTheme.colors.surface,
|
backgroundColor = MaterialTheme.colors.surface,
|
||||||
@@ -1220,9 +1226,7 @@ private fun MarkAsSensitive(
|
|||||||
@Composable
|
@Composable
|
||||||
fun CloseButton(onPress: () -> Unit) {
|
fun CloseButton(onPress: () -> Unit) {
|
||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = onPress,
|
||||||
onPress()
|
|
||||||
},
|
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors = ButtonDefaults
|
colors = ButtonDefaults
|
||||||
.buttonColors(
|
.buttonColors(
|
||||||
|
|||||||
Reference in New Issue
Block a user