Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fix panorama metadata detection trigger

Neeraj Gupta7f77635a3d5e
diff --git a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
index 25cb85a905..8e605391e3 100644
--- a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
@@ -4,6 +4,7 @@ import "package:flutter/material.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/details_sheet_event.dart";
import "package:photos/generated/l10n.dart";
+import "package:photos/models/file/extensions/file_props.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import "package:photos/theme/ente_theme.dart";
@@ -143,7 +144,9 @@ Future<void> showSingleFileDeleteSheet(
}
Future<void> showDetailsSheet(BuildContext context, EnteFile file) async {
- guardedCheckPanorama(file).ignore();
+ if (file.isUploaded && file.isPanorama() == null) {
+ guardedCheckPanorama(file).ignore();
+ }
Bus.instance.fire(
DetailsSheetEvent(
localID: file.localID,
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
index 40e13eb18c..a64fd9457a 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
@@ -120,9 +120,9 @@ class FileBottomBarState extends State<FileBottomBar> {
@override
Widget build(BuildContext context) {
- if (widget.file.canBePanorama()) {
- lastFileGenID = widget.file.generatedID;
+ if (widget.file.canBePanorama() && widget.file.isPanorama() == null) {
if (lastFileGenID != widget.file.generatedID) {
+ lastFileGenID = widget.file.generatedID;
guardedCheckPanorama(widget.file).ignore();
}
}
diff --git a/mobile/apps/photos/lib/utils/panorama_util.dart b/mobile/apps/photos/lib/utils/panorama_util.dart
index 124a016e46..ff38950aca 100644
--- a/mobile/apps/photos/lib/utils/panorama_util.dart
+++ b/mobile/apps/photos/lib/utils/panorama_util.dart
@@ -1,3 +1,4 @@
+import "package:logging/logging.dart";
import "package:photos/models/file/extensions/file_props.dart";
import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
@@ -7,6 +8,8 @@ import "package:photos/src/rust/api/motion_photo_api.dart";
import "package:photos/utils/exif_util.dart";
import "package:photos/utils/file_util.dart";
+final _logger = Logger("PanoramaUtil");
+
/// Check if the file is a panorama image.
Future<bool> checkIfPanorama(EnteFile enteFile) async {
if (enteFile.fileType != FileType.image) {
@@ -42,6 +45,9 @@ Future<void> guardedCheckPanorama(EnteFile file) async {
if (file.isPanorama() != null) {
return;
}
+ _logger.info(
+ "Checking panorama for ${file.uploadedFileID ?? file.localID ?? file.generatedID}",
+ );
final result = await checkIfPanorama(file);
// Update the metadata if it is not updated