feat(llc, ui): add support for thumbUrl in video attachment. (#1362)
* feat(llc, ui): add support for thumbUrl in file attachment. Signed-off-by: xsahil03x <[email protected]> * chore(ui): use widget.fit instead of hardcoded fit. Signed-off-by: xsahil03x <[email protected]> * fix analysis Signed-off-by: xsahil03x <[email protected]> Co-authored-by: Salvatore Giordano <[email protected]>
This commit is contained in:
co-authored by
Salvatore Giordano
parent
8b6c59929f
commit
1e9e942c46
@@ -493,36 +493,41 @@ class Channel {
|
||||
|
||||
final isImage = it.type == 'image';
|
||||
final cancelToken = CancelToken();
|
||||
Future<String> future;
|
||||
Future<SendAttachmentResponse> future;
|
||||
if (isImage) {
|
||||
future = sendImage(
|
||||
it.file!,
|
||||
onSendProgress: onSendProgress,
|
||||
cancelToken: cancelToken,
|
||||
extraData: it.extraData,
|
||||
).then((it) => it.file);
|
||||
);
|
||||
} else {
|
||||
future = sendFile(
|
||||
it.file!,
|
||||
onSendProgress: onSendProgress,
|
||||
cancelToken: cancelToken,
|
||||
extraData: it.extraData,
|
||||
).then((it) => it.file);
|
||||
);
|
||||
}
|
||||
_cancelableAttachmentUploadRequest[it.id] = cancelToken;
|
||||
return future.then((url) {
|
||||
return future.then((response) {
|
||||
client.logger.info('Attachment ${it.id} uploaded successfully...');
|
||||
if (isImage) {
|
||||
|
||||
// If the response is SendFileResponse, then we might also be getting
|
||||
// thumbUrl in case of video. So we need to update the attachment with
|
||||
// both the assetUrl and thumbUrl.
|
||||
if (response is SendFileResponse) {
|
||||
updateAttachment(
|
||||
it.copyWith(
|
||||
imageUrl: url,
|
||||
assetUrl: response.file,
|
||||
thumbUrl: response.thumbUrl,
|
||||
uploadState: const UploadState.success(),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
updateAttachment(
|
||||
it.copyWith(
|
||||
assetUrl: url,
|
||||
imageUrl: response.file,
|
||||
uploadState: const UploadState.success(),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user