TF-2764 Add PDFViewer to preview PDF attachment
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
|
||||
import 'package:core/data/constants/constant.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';
|
||||
|
||||
@@ -9,7 +8,7 @@ extension AttachmentExtension on Attachment {
|
||||
|
||||
String getIcon(ImagePaths imagePaths, {MediaType? fileMediaType}) {
|
||||
final mediaType = type ?? fileMediaType;
|
||||
log('AttachmentExtension::getIcon(): mediaType: $mediaType');
|
||||
|
||||
if (isDisplayedPDFIcon) {
|
||||
return imagePaths.icFilePdf;
|
||||
}
|
||||
@@ -33,6 +32,7 @@ extension AttachmentExtension on Attachment {
|
||||
return imagePaths.icFileEPup;
|
||||
}
|
||||
|
||||
bool get isDisplayedPDFIcon => type?.mimeType == 'application/pdf' ||
|
||||
(type?.mimeType == 'application/octet-stream' && name?.endsWith('.pdf') == true);
|
||||
bool get isDisplayedPDFIcon => type?.mimeType == Constant.pdfMimeType
|
||||
|| (type?.mimeType == Constant.octetStreamMimeType
|
||||
&& name?.endsWith(Constant.pdfExtension) == true);
|
||||
}
|
||||
Reference in New Issue
Block a user