Fix / disable context menu on not sent messages

This commit is contained in:
Valere 2019-06-07 15:49:41 +02:00
parent 220e6224e7
commit c9240c2dce
2 changed files with 6 additions and 5 deletions

View File

@ -95,7 +95,7 @@ class MessageActionsViewModel(initialState: MessageActionState) : VectorViewMode
messageBody = body,
ts = dateFormat.format(Date(originTs ?: 0)),
showPreview = body != null,
canReact = event.root.type == EventType.MESSAGE,
canReact = event.root.type == EventType.MESSAGE && event.sendState.isSent(),
senderAvatarPath = parcel.informationData.avatarUrl
)
} else {

View File

@ -54,13 +54,14 @@ class MessageMenuViewModel(initialState: MessageMenuState) : VectorViewModel<Mes
?: event.root.content.toModel()
val type = messageContent?.type

if (event.sendState == SendState.UNSENT) {
if (!event.sendState.isSent()) {
//Resend and Delete
return MessageMenuState(
//TODO
listOf(
SimpleAction(ACTION_RESEND, R.string.resend, R.drawable.ic_send, event.root.eventId),
//TODO delete icon
SimpleAction(ACTION_DELETE, R.string.delete, R.drawable.ic_delete, event.root.eventId)
// SimpleAction(ACTION_RESEND, R.string.resend, R.drawable.ic_send, event.root.eventId),
// //TODO delete icon
// SimpleAction(ACTION_DELETE, R.string.delete, R.drawable.ic_delete, event.root.eventId)
)
)
}