1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-20 00:35:17 +00:00

Can delete conversation messages

This commit is contained in:
2019-05-04 08:58:14 +02:00
parent 533d2a86a3
commit 1f0d70848f
4 changed files with 110 additions and 15 deletions

View File

@ -320,6 +320,27 @@ class ConversationsHelper {
return SendMessageResult.SUCCESS;
}
/// Delete permanently a message specified by its [id]
Future<bool> deleteMessage(int id) async {
// Delete the message online
final response = await APIRequest(
uri: "conversations/deleteMessage",
needLogin: true,
args: {
"messageID": id.toString()
}
).exec();
if(response.code != 200) return false;
// Delete the message locally
return await _conversationMessagesDatabaseHelper.delete(id);
}
/// Turn an API response into a ConversationMessage object
ConversationMessage _apiToConversationMessage({
@required int conversationID,