TF-2510 Show PDF icon in composer`
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
|
|
||||||
import 'package:core/core.dart';
|
import 'package:core/domain/extensions/media_type_extension.dart';
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:core/utils/app_logger.dart';
|
||||||
|
import 'package:http_parser/http_parser.dart';
|
||||||
import 'package:model/email/attachment.dart';
|
import 'package:model/email/attachment.dart';
|
||||||
|
|
||||||
extension AttachmentExtension on Attachment {
|
extension AttachmentExtension on Attachment {
|
||||||
|
|
||||||
String getIcon(ImagePaths imagePaths) {
|
String getIcon(ImagePaths imagePaths, {MediaType? fileMediaType}) {
|
||||||
final mediaType = type;
|
final mediaType = type ?? fileMediaType;
|
||||||
log('AttachmentExtension::getIcon(): mediaType: $mediaType');
|
log('AttachmentExtension::getIcon(): mediaType: $mediaType');
|
||||||
if (isDisplayedPDFIcon) {
|
if (isDisplayedPDFIcon) {
|
||||||
return imagePaths.icFilePdf;
|
return imagePaths.icFilePdf;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
import 'package:core/domain/extensions/media_type_extension.dart';
|
|
||||||
import 'package:core/presentation/resources/image_paths.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:core/utils/app_logger.dart';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:http_parser/http_parser.dart';
|
import 'package:http_parser/http_parser.dart';
|
||||||
import 'package:model/email/attachment.dart';
|
import 'package:model/email/attachment.dart';
|
||||||
import 'package:model/upload/file_info.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/model/upload_task_id.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';
|
import 'package:tmail_ui_user/features/upload/presentation/model/upload_file_status.dart';
|
||||||
|
|
||||||
@@ -77,24 +76,7 @@ class UploadFileState with EquatableMixin {
|
|||||||
if (mediaType == null && file != null) {
|
if (mediaType == null && file != null) {
|
||||||
mediaType = MediaType.parse(file!.mimeType);
|
mediaType = MediaType.parse(file!.mimeType);
|
||||||
}
|
}
|
||||||
log('AttachmentExtension::getIcon(): mediaType: $mediaType');
|
return attachment?.getIcon(imagePaths, fileMediaType: mediaType) ?? imagePaths.icFileEPup;
|
||||||
if (mediaType == null) {
|
|
||||||
return imagePaths.icFileEPup;
|
|
||||||
}
|
|
||||||
if (mediaType.isDocFile()) {
|
|
||||||
return imagePaths.icFileDocx;
|
|
||||||
} else if (mediaType.isExcelFile()) {
|
|
||||||
return imagePaths.icFileXlsx;
|
|
||||||
} else if (mediaType.isPowerPointFile()) {
|
|
||||||
return imagePaths.icFilePptx;
|
|
||||||
} else if (mediaType.isPdfFile()) {
|
|
||||||
return imagePaths.icFilePdf;
|
|
||||||
} else if (mediaType.isZipFile()) {
|
|
||||||
return imagePaths.icFileZip;
|
|
||||||
} else if (mediaType.isImageFile()) {
|
|
||||||
return imagePaths.icFilePng;
|
|
||||||
}
|
|
||||||
return imagePaths.icFileEPup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user