refactor
This commit is contained in:
parent
f81c92bfee
commit
6ad4a71f23
2 changed files with 9 additions and 3 deletions
|
@ -7,4 +7,8 @@ extension FilePropsExtn on EnteFile {
|
|||
bool get isMotionPhoto => pubMagicMetadata?.mvi != null;
|
||||
|
||||
bool get isLiveOrMotionPhoto => isLivePhoto || isMotionPhoto;
|
||||
|
||||
bool isOwner(int userID) => (ownerID == null) || (ownerID! == userID);
|
||||
|
||||
bool canEditMetaInfo(int userID) => isUploaded && isOwner(userID);
|
||||
}
|
||||
|
|
|
@ -182,10 +182,12 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
final motionPhoto = MotionPhotos(imageFile.path);
|
||||
final index = await motionPhoto.getMotionVideoIndex();
|
||||
if (index != null) {
|
||||
if (widget.enteFile.pubMagicMetadata?.mvi == null &&
|
||||
(widget.enteFile.ownerID ?? 0) == Configuration.instance.getUserID()!) {
|
||||
// Update the metadata if it is not updated
|
||||
if (!_enteFile.isMotionPhoto &&
|
||||
_enteFile
|
||||
.canEditMetaInfo(Configuration.instance.getUserID()!)) {
|
||||
FileMagicService.instance.updatePublicMagicMetadata(
|
||||
[widget.enteFile],
|
||||
[_enteFile],
|
||||
{motionVideoIndexKey: index.start},
|
||||
).ignore();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue