Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix OCR for HEIC files on Android

laurenspriem997a6bf342aa
diff --git a/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart b/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
index 28ff461a8d..2a749b0a2e 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
@@ -266,7 +266,10 @@ class _TextDetectionOverlayButtonState
}
await routeToPage(
context,
- TextDetectionPage(imagePath: path),
+ TextDetectionPage(
+ file: widget.file,
+ imagePath: path,
+ ),
);
} catch (error, stackTrace) {
_logger.severe("Failed to start text detection", error, stackTrace);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/text_detection_page.dart b/mobile/apps/photos/lib/ui/viewer/file/text_detection_page.dart
index 45bb9b86bd..745b3becd3 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/text_detection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/text_detection_page.dart
@@ -3,12 +3,18 @@ import 'package:flutter/services.dart';
import 'package:logging/logging.dart';
import 'package:mobile_ocr/mobile_ocr.dart';
import 'package:photos/l10n/l10n.dart';
-import 'package:photos/ui/common/loading_widget.dart';
+import 'package:photos/models/file/file.dart';
+import 'package:photos/ui/viewer/file/zoomable_image.dart';
class TextDetectionPage extends StatefulWidget {
+ final EnteFile file;
final String imagePath;
- const TextDetectionPage({required this.imagePath, super.key});
+ const TextDetectionPage({
+ required this.file,
+ required this.imagePath,
+ super.key,
+ });
@override
State<TextDetectionPage> createState() => _TextDetectionPageState();
@@ -23,15 +29,24 @@ class _TextDetectionPageState extends State<TextDetectionPage> {
backgroundColor: Colors.black,
body: SafeArea(
child: Stack(
+ fit: StackFit.expand,
children: [
+ IgnorePointer(
+ child: ZoomableImage(
+ widget.file,
+ tagPrefix: "text_detection_",
+ backgroundDecoration: const BoxDecoration(
+ color: Colors.transparent,
+ ),
+ ),
+ ),
TextDetectorWidget(
imagePath: widget.imagePath,
autoDetect: true,
- backgroundColor: Colors.black,
+ backgroundColor: Colors.transparent,
showUnselectedBoundaries: true,
strings: TextDetectorStrings(
processingOverlayMessage: l10n.ocrProcessingOverlayMessage,
- loadingIndicatorLabel: l10n.ocrLoadingIndicatorLabel,
selectionHint: l10n.ocrSelectionHint,
noTextDetected: l10n.ocrNoTextDetected,
retryButtonLabel: l10n.ocrRetryButtonLabel,
@@ -41,9 +56,6 @@ class _TextDetectionPageState extends State<TextDetectionPage> {
imageDecodeFailedError: l10n.ocrImageDecodeFailedError,
genericDetectError: l10n.ocrGenericDetectError,
),
- loadingWidget: const Center(
- child: EnteLoadingWidget(color: Colors.white, size: 24),
- ),
onTextCopied: (text) {
HapticFeedback.lightImpact();
},
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index 109eb50cb2..3a79cf7cd2 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -1711,8 +1711,8 @@ packages:
dependency: "direct main"
description:
path: "."
- ref: b6eb61dd1606f1b140bbfc9f1f5d1af8b27dfc3b
- resolved-ref: b6eb61dd1606f1b140bbfc9f1f5d1af8b27dfc3b
+ ref: "8dba33ad89eea99683780469bc4d0ec4993d61c3"
+ resolved-ref: "8dba33ad89eea99683780469bc4d0ec4993d61c3"
url: "https://github.com/ente-io/mobile_ocr"
source: git
version: "1.0.0"
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index 6b796262ca..6343cdb3d7 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -139,7 +139,7 @@ dependencies:
mobile_ocr:
git:
url: https://github.com/ente-io/mobile_ocr
- ref: b6eb61dd1606f1b140bbfc9f1f5d1af8b27dfc3b
+ ref: 8dba33ad89eea99683780469bc4d0ec4993d61c3
modal_bottom_sheet: ^3.0.0
motion_photos:
git: "https://github.com/ente-io/motion_photo.git"
diff --git a/mobile/apps/photos/scripts/internal_changes.txt b/mobile/apps/photos/scripts/internal_changes.txt
index 5e598195ee..d5056921e4 100644
--- a/mobile/apps/photos/scripts/internal_changes.txt
+++ b/mobile/apps/photos/scripts/internal_changes.txt
@@ -1,3 +1,4 @@
+- Laurens: Fix OCR for HEIC files on Android
- Neeraj: (i) Show public link to album participants
- Neeraj: (i) Admin role, only enables participant management. Photos management WIP.
- Prateek: (i) Optimize home widget image quality with V2 implementation (1024px vs 512px, uses PhotoManager thumbnails for local files, isolate processing for remote images)