This commit is contained in:
Neeraj Gupta 2023-08-25 10:57:39 +05:30
parent f81c92bfee
commit 6ad4a71f23
2 changed files with 9 additions and 3 deletions

View file

@ -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);
}

View file

@ -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();
}