feat: Better image sending experience
This commit is contained in:
parent
63563a245d
commit
cc0eba83fd
6 changed files with 17 additions and 18 deletions
|
|
@ -414,10 +414,10 @@ class ChatController extends State<Chat> {
|
|||
bytes: audioFile.readAsBytesSync(),
|
||||
name: audioFile.path,
|
||||
);
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () =>
|
||||
room!.sendFileEvent(file, inReplyTo: replyEvent, extraContent: {
|
||||
await room!.sendFileEvent(
|
||||
file,
|
||||
inReplyTo: replyEvent,
|
||||
extraContent: {
|
||||
'info': {
|
||||
...file.info,
|
||||
'duration': result.duration,
|
||||
|
|
@ -427,7 +427,7 @@ class ChatController extends State<Chat> {
|
|||
'duration': result.duration,
|
||||
'waveform': result.waveform,
|
||||
},
|
||||
}),
|
||||
},
|
||||
);
|
||||
setState(() {
|
||||
replyEvent = null;
|
||||
|
|
|
|||
|
|
@ -290,6 +290,8 @@ class Message extends StatelessWidget {
|
|||
)),
|
||||
),
|
||||
row,
|
||||
if (event.fileSendingStatus != null)
|
||||
Text(event.fileSendingStatus!.name),
|
||||
if (event.hasAggregatedEvents(timeline, RelationshipTypes.reaction))
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
|
|
|
|||
|
|
@ -31,20 +31,16 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|||
Future<void> _send() async {
|
||||
var file = widget.file;
|
||||
MatrixImageFile? thumbnail;
|
||||
if (file is MatrixImageFile &&
|
||||
!origImage &&
|
||||
file.bytes.length > minSizeToCompress) {
|
||||
file = await MatrixImageFile.shrink(
|
||||
bytes: file.bytes,
|
||||
name: file.name,
|
||||
compute: widget.room.client.runInBackground,
|
||||
);
|
||||
}
|
||||
if (file is MatrixVideoFile && file.bytes.length > minSizeToCompress) {
|
||||
file = await file.resizeVideo();
|
||||
thumbnail = await file.getVideoThumbnail();
|
||||
}
|
||||
await widget.room.sendFileEvent(file, thumbnail: thumbnail);
|
||||
widget.room.sendFileEvent(
|
||||
file,
|
||||
thumbnail: thumbnail,
|
||||
shrinkImageMaxDimension: origImage ? null : 1600,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ extension LocalizedBody on Event {
|
|||
Future<MatrixFile?> downloadAndDecryptAttachmentCached(
|
||||
{bool getThumbnail = false}) async {
|
||||
final mxcUrl =
|
||||
attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail).toString();
|
||||
attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail)?.toString() ??
|
||||
eventId;
|
||||
_downloadAndDecryptFutures[mxcUrl] ??= downloadAndDecryptAttachment(
|
||||
getThumbnail: getThumbnail,
|
||||
downloadCallback: (Uri url) async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue