π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Recover OCR stills from uploaded copies
laurenspriem8cb6ff22d3e3
diff --git a/mobile/apps/photos/changes/ocr-still-source-recovery.md b/mobile/apps/photos/changes/ocr-still-source-recovery.mdnew file mode 100644index 0000000000..f6f5448dad--- /dev/null+++ b/mobile/apps/photos/changes/ocr-still-source-recovery.md@@ -0,0 +1 @@+- Fixed text selection when a photo's local copy is unavailable but an uploaded copy can be retrieved.diff --git a/mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dartindex 2aa0b0bd83..0ae4d20a86 100644--- a/mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dart@@ -240,7 +240,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {_regionDetectionAttempt++;try {- final File? localFile = await getFile(widget.file);+ final File? localFile = await _resolveStillImage(generation);if (!mounted || generation != _evaluationGeneration) return;if (localFile == null || !localFile.existsSync()) {throw StateError("Live-photo still is unavailable");@@ -381,13 +381,24 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {}}+ Future<File?> _resolveStillImage(int generation) async {+ final file = widget.file;+ final canUseUploadedCopy = file.isUploaded && !file.isRemoteOnlyFile;+ File? localFile = await getFile(file);+ if (!mounted || generation != _evaluationGeneration) return null;+ if (canUseUploadedCopy && (localFile == null || !localFile.existsSync())) {+ localFile = await getFile(EnteFile.from(file)..localID = null);+ }+ return localFile;+ }+Future<void> _prepareStillImageOnDemand() async {final generation = _evaluationGeneration;setState(() {_isPreparingOnDemand = true;});try {- final localFile = await getFile(widget.file);+ final localFile = await _resolveStillImage(generation);if (!mounted || generation != _evaluationGeneration) return;if (localFile == null || !localFile.existsSync()) {throw StateError("Could not resolve image for OCR");