TF-2644 Handle total size exceeded maximum size when drag & drop multiple file to composer
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:http_parser/http_parser.dart';
|
||||
import 'package:model/email/attachment.dart';
|
||||
import 'package:model/upload/file_info.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/extensions/attachment_extension.dart';
|
||||
import 'package:tmail_ui_user/features/upload/domain/extensions/media_type_extension.dart';
|
||||
import 'package:tmail_ui_user/features/upload/domain/model/upload_task_id.dart';
|
||||
import 'package:tmail_ui_user/features/upload/presentation/model/upload_file_status.dart';
|
||||
|
||||
@@ -17,7 +18,6 @@ class UploadFileState with EquatableMixin {
|
||||
final int uploadingProgress;
|
||||
final Attachment? attachment;
|
||||
final CancelToken? cancelToken;
|
||||
final bool fromFileShared;
|
||||
|
||||
UploadFileState(
|
||||
this.uploadTaskId,
|
||||
@@ -27,7 +27,6 @@ class UploadFileState with EquatableMixin {
|
||||
this.uploadingProgress = 0,
|
||||
this.attachment,
|
||||
this.cancelToken,
|
||||
this.fromFileShared = false,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -38,7 +37,6 @@ class UploadFileState with EquatableMixin {
|
||||
int? uploadingProgress,
|
||||
Attachment? attachment,
|
||||
CancelToken? cancelToken,
|
||||
bool? fromFileShared,
|
||||
}) {
|
||||
return UploadFileState(
|
||||
uploadTaskId ?? this.uploadTaskId,
|
||||
@@ -47,7 +45,6 @@ class UploadFileState with EquatableMixin {
|
||||
uploadingProgress: uploadingProgress ?? this.uploadingProgress,
|
||||
attachment: attachment ?? this.attachment,
|
||||
cancelToken: cancelToken ?? this.cancelToken,
|
||||
fromFileShared: fromFileShared ?? this.fromFileShared
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,11 +69,16 @@ class UploadFileState with EquatableMixin {
|
||||
double get percentUploading => uploadingProgress / 100;
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
var mediaType = attachment?.type;
|
||||
if (mediaType == null && file != null) {
|
||||
mediaType = MediaType.parse(file!.mimeType);
|
||||
try {
|
||||
MediaType? mediaType = attachment?.type;
|
||||
if (mediaType == null && file != null) {
|
||||
mediaType = MediaType.parse(file!.mimeType);
|
||||
}
|
||||
return mediaType?.getIcon(imagePaths, fileName: fileName) ?? imagePaths.icFileEPup;
|
||||
} catch (e) {
|
||||
logError('UploadFileState::getIcon: Exception: $e');
|
||||
return imagePaths.icFileEPup;
|
||||
}
|
||||
return attachment?.getIcon(imagePaths, fileMediaType: mediaType) ?? imagePaths.icFileEPup;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -87,6 +89,5 @@ class UploadFileState with EquatableMixin {
|
||||
uploadingProgress,
|
||||
attachment,
|
||||
cancelToken,
|
||||
fromFileShared,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user