Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Fix bug in Motion photo detection (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 authored Nov 2, 2023
2 parents c11365d + baef66d commit 34e5b45
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
"${BUILT_PRODUCTS_DIR}/background_fetch/background_fetch.framework",
"${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework",
"${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework",
"${BUILT_PRODUCTS_DIR}/file_saver/file_saver.framework",
"${BUILT_PRODUCTS_DIR}/fk_user_agent/fk_user_agent.framework",
"${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework",
"${BUILT_PRODUCTS_DIR}/flutter_image_compress/flutter_image_compress.framework",
Expand Down Expand Up @@ -356,6 +357,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/background_fetch.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_saver.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fk_user_agent.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress.framework",
Expand Down
2 changes: 1 addition & 1 deletion lib/models/file/extensions/file_props.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "package:photos/models/file/trash_file.dart";
extension FilePropsExtn on EnteFile {
bool get isLivePhoto => fileType == FileType.livePhoto;

bool get isMotionPhoto => pubMagicMetadata?.mvi != null;
bool get isMotionPhoto => (pubMagicMetadata?.mvi ?? 0) > 0;

bool get isLiveOrMotionPhoto => isLivePhoto || isMotionPhoto;

Expand Down
2 changes: 1 addition & 1 deletion lib/models/metadata/file_magic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PubMagicMetadata {
double? lat;
double? long;

// Motion Video Index. Positive value indicates that the file is a motion
// Motion Video Index. Positive value (>0) indicates that the file is a motion
// photo
int? mvi;

Expand Down
6 changes: 6 additions & 0 deletions lib/ui/viewer/file/zoomable_live_image_new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>
return motionPhoto.getMotionVideoFile(
index: index,
);
} else if (_enteFile.isMotionPhoto && _enteFile.canEditMetaInfo) {
_logger.finest('Incorrectly tagged as MP, reset tag ${_enteFile.tag}');
FileMagicService.instance.updatePublicMagicMetadata(
[_enteFile],
{motionVideoIndexKey: 0},
).ignore();
}
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1268,10 +1268,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: c0409b2e812c7457908a6e492abae6e4f5b457a7
resolved-ref: e4edd3a158c667976660a788e908d1faf5c5a4f8
url: "https://github.com/ente-io/motion_photo.git"
source: git
version: "0.0.3"
version: "0.0.5"
motionphoto:
dependency: "direct main"
description:
Expand Down

0 comments on commit 34e5b45

Please sign in to comment.