TF-2116 Insert image at mouse cursor position

(cherry picked from commit cb347e5077eddb1366daf706aa87eb2291f71aab)
This commit is contained in:
dab246
2023-09-08 11:41:35 +07:00
committed by Dat H. Pham
parent d0744e7560
commit e63a8f7d7f
11 changed files with 164 additions and 53 deletions
@@ -10,24 +10,31 @@ class DownloadImageAsBase64Interactor {
DownloadImageAsBase64Interactor(this._composerRepository);
Stream<Either<Failure, Success>> execute(
String url,
String cid,
FileInfo fileInfo,
{
double? maxWidth,
bool? compress
}
String url,
String cid,
FileInfo fileInfo,
{
double? maxWidth,
bool? compress,
bool fromFileShared = false,
}
) async* {
try {
yield Right<Failure, Success>(DownloadingImageAsBase64());
final result = await _composerRepository.downloadImageAsBase64(
url,
url,
cid,
fileInfo,
maxWidth: maxWidth,
compress: compress
);
if (result?.isNotEmpty == true) {
yield Right<Failure, Success>(DownloadImageAsBase64Success(
result!,
cid,
fileInfo,
maxWidth: maxWidth,
compress: compress);
if (result?.isNotEmpty == true) {
yield Right<Failure, Success>(DownloadImageAsBase64Success(result!, cid, fileInfo));
fromFileShared: fromFileShared
));
} else {
yield Left<Failure, Success>(DownloadImageAsBase64Failure(null));
}
@@ -15,7 +15,8 @@ class UploadAttachmentInteractor {
FileInfo fileInfo,
Uri uploadUri, {
CancelToken? cancelToken,
bool isInline = false
bool isInline = false,
bool fromFileShared = false,
}) async* {
try {
final uploadAttachment = await _composerRepository.uploadAttachment(
@@ -23,9 +24,17 @@ class UploadAttachmentInteractor {
uploadUri,
cancelToken: cancelToken
);
yield Right<Failure, Success>(UploadAttachmentSuccess(uploadAttachment, isInline: isInline));
yield Right<Failure, Success>(UploadAttachmentSuccess(
uploadAttachment,
isInline: isInline,
fromFileShared: fromFileShared
));
} catch (e) {
yield Left<Failure, Success>(UploadAttachmentFailure(e, isInline: isInline));
yield Left<Failure, Success>(UploadAttachmentFailure(
e,
isInline: isInline,
fromFileShared: fromFileShared
));
}
}
}