automatically retry message delete

This commit is contained in:
Salvatore Giordano
2020-03-11 17:44:56 +01:00
parent 54f1901620
commit fe5adc72dc
5 changed files with 99 additions and 30 deletions
+21 -7
View File
@@ -586,14 +586,28 @@ class _MessageInputState extends State<MessageInput> {
_attachments.add(attachment);
});
final res = await channel.sendFile(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
),
);
String url;
attachment.url = res.file;
if (type == FileType.IMAGE) {
final res = await channel.sendImage(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
contentType: MediaType.parse('image/jpeg'),
),
);
url = res.file;
} else {
final res = await channel.sendFile(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
),
);
url = res.file;
}
attachment.url = url;
setState(() {
attachment.uploaded = true;