TF-2644 Handle total size exceeded maximum size when drag & drop multiple file to composer
This commit is contained in:
@@ -10,15 +10,11 @@ class DownloadImageAsBase64Success extends UIState {
|
||||
final String base64Uri;
|
||||
final String cid;
|
||||
final FileInfo fileInfo;
|
||||
final bool fromFileShared;
|
||||
|
||||
DownloadImageAsBase64Success(
|
||||
this.base64Uri,
|
||||
this.cid,
|
||||
this.fileInfo,
|
||||
{
|
||||
this.fromFileShared = false
|
||||
}
|
||||
this.fileInfo
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -26,7 +22,6 @@ class DownloadImageAsBase64Success extends UIState {
|
||||
base64Uri,
|
||||
cid,
|
||||
fileInfo,
|
||||
fromFileShared,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +1,25 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:model/upload/file_info.dart';
|
||||
import 'package:tmail_ui_user/features/upload/domain/model/upload_attachment.dart';
|
||||
|
||||
class UploadAttachmentSuccess extends UIState {
|
||||
|
||||
final UploadAttachment uploadAttachment;
|
||||
final bool isInline;
|
||||
final bool fromFileShared;
|
||||
|
||||
UploadAttachmentSuccess(
|
||||
this.uploadAttachment,
|
||||
{
|
||||
this.isInline = false,
|
||||
this.fromFileShared = false,
|
||||
}
|
||||
);
|
||||
UploadAttachmentSuccess(this.uploadAttachment);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
uploadAttachment,
|
||||
isInline,
|
||||
fromFileShared,
|
||||
];
|
||||
List<Object?> get props => [uploadAttachment];
|
||||
}
|
||||
|
||||
class UploadAttachmentFailure extends FeatureFailure {
|
||||
final bool isInline;
|
||||
final bool fromFileShared;
|
||||
|
||||
UploadAttachmentFailure(
|
||||
dynamic exception,
|
||||
{
|
||||
this.isInline = false,
|
||||
this.fromFileShared = false,
|
||||
}
|
||||
) : super(exception: exception);
|
||||
final FileInfo fileInfo;
|
||||
|
||||
UploadAttachmentFailure(dynamic exception, this.fileInfo) : super(exception: exception);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
isInline,
|
||||
fromFileShared,
|
||||
...super.props
|
||||
];
|
||||
List<Object?> get props => [...super.props, fileInfo];
|
||||
}
|
||||
@@ -16,7 +16,6 @@ class DownloadImageAsBase64Interactor {
|
||||
{
|
||||
double? maxWidth,
|
||||
bool? compress,
|
||||
bool fromFileShared = false,
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
@@ -33,7 +32,6 @@ class DownloadImageAsBase64Interactor {
|
||||
result!,
|
||||
cid,
|
||||
fileInfo,
|
||||
fromFileShared: fromFileShared
|
||||
));
|
||||
} else {
|
||||
yield Left<Failure, Success>(DownloadImageAsBase64Failure(null));
|
||||
|
||||
@@ -15,8 +15,6 @@ class UploadAttachmentInteractor {
|
||||
FileInfo fileInfo,
|
||||
Uri uploadUri, {
|
||||
CancelToken? cancelToken,
|
||||
bool isInline = false,
|
||||
bool fromFileShared = false,
|
||||
}) async* {
|
||||
try {
|
||||
final uploadAttachment = await _composerRepository.uploadAttachment(
|
||||
@@ -24,17 +22,9 @@ class UploadAttachmentInteractor {
|
||||
uploadUri,
|
||||
cancelToken: cancelToken
|
||||
);
|
||||
yield Right<Failure, Success>(UploadAttachmentSuccess(
|
||||
uploadAttachment,
|
||||
isInline: isInline,
|
||||
fromFileShared: fromFileShared
|
||||
));
|
||||
yield Right<Failure, Success>(UploadAttachmentSuccess(uploadAttachment));
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(UploadAttachmentFailure(
|
||||
e,
|
||||
isInline: isInline,
|
||||
fromFileShared: fromFileShared
|
||||
));
|
||||
yield Left<Failure, Success>(UploadAttachmentFailure(e, fileInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user