deleteMessage method
- ChatItem item
Deletes the specified ChatItem posted by the authenticated MyUser.
Implementation
Future<void> deleteMessage(ChatItem item) async {
try {
await _chatService.deleteChatItem(item);
} on DeleteChatMessageException catch (e) {
switch (e.code) {
case DeleteChatMessageErrorCode.artemisUnknown:
MessagePopup.error('err_data_transfer'.l10n);
break;
case DeleteChatMessageErrorCode.notAuthor:
case DeleteChatMessageErrorCode.quoted:
case DeleteChatMessageErrorCode.read:
MessagePopup.error(e.toMessage());
break;
case DeleteChatMessageErrorCode.unknownChatItem:
// No-op.
break;
}
} on DeleteChatForwardException catch (e) {
switch (e.code) {
case DeleteChatForwardErrorCode.artemisUnknown:
MessagePopup.error('err_data_transfer'.l10n);
break;
case DeleteChatForwardErrorCode.notAuthor:
case DeleteChatForwardErrorCode.quoted:
case DeleteChatForwardErrorCode.read:
MessagePopup.error(e.toMessage());
break;
case DeleteChatForwardErrorCode.unknownChatItem:
// No-op.
break;
}
} catch (e) {
MessagePopup.error(e);
rethrow;
}
}