ente/lib/models/file/extensions/file_props.dart

25 lines
800 B
Dart
Raw Normal View History

2023-08-25 06:18:06 +00:00
import "package:photos/core/configuration.dart";
2023-08-25 04:39:30 +00:00
import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/file/trash_file.dart";
2023-08-25 04:39:30 +00:00
extension FilePropsExtn on EnteFile {
bool get isLivePhoto => fileType == FileType.livePhoto;
bool get isMotionPhoto => pubMagicMetadata?.mvi != null;
bool get isLiveOrMotionPhoto => isLivePhoto || isMotionPhoto;
2023-08-25 05:27:39 +00:00
2023-08-25 06:18:06 +00:00
bool get isOwner =>
2023-08-30 11:36:23 +00:00
(ownerID == null) || (ownerID == Configuration.instance.getUserID());
2023-08-25 05:27:39 +00:00
2023-08-25 06:18:06 +00:00
bool get canEditMetaInfo => isUploaded && isOwner;
bool get isTrash => this is TrashFile;
2023-08-25 07:21:21 +00:00
// Return true if the file was uploaded via collect photos workflow
bool get isCollect => uploaderName != null;
String? get uploaderName => pubMagicMetadata?.uploaderName;
2023-08-25 04:39:30 +00:00
}