Edit, delete message

This commit is contained in:
2025-05-04 01:43:27 +08:00
parent 6fd61b547e
commit ee1fcd8752
4 changed files with 62 additions and 18 deletions

View File

@ -16,6 +16,18 @@ abstract class UniversalFile with _$UniversalFile {
bool get isOnCloud => data is SnCloudFile;
bool get isOnDevice => !isOnCloud;
factory UniversalFile.fromAttachment(SnCloudFile attachment) {
return UniversalFile(
data: attachment,
type: switch (attachment.mimeType?.split('/').firstOrNull) {
'image' => UniversalFileType.image,
'audio' => UniversalFileType.audio,
'video' => UniversalFileType.video,
_ => UniversalFileType.file,
},
);
}
}
@freezed