mobile: remove file on apiSendMessage error (#2487)

This commit is contained in:
spaced4ndy 2023-05-23 12:43:18 +04:00 committed by GitHub
parent c32e45f686
commit 1326701440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -376,8 +376,12 @@ fun ComposeView(
live = live,
ttl = ttl
)
if (aChatItem != null) chatModel.addChatItem(cInfo, aChatItem.chatItem)
return aChatItem?.chatItem
if (aChatItem != null) {
chatModel.addChatItem(cInfo, aChatItem.chatItem)
return aChatItem.chatItem
}
if (file != null) removeFile(context, file)
return null
}

View file

@ -726,6 +726,9 @@ struct ComposeView: View {
}
return chatItem
}
if let file = file {
removeFile(file)
}
return nil
}