Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix OCR overlay blocking swipe, zoom, and handle drag

Amrithesh Kakkoth Entef4461c472ca3
diff --git a/mobile/apps/photos/lib/states/detail_page_state.dart b/mobile/apps/photos/lib/states/detail_page_state.dart
index d529a4d520..dc0de7465b 100644
--- a/mobile/apps/photos/lib/states/detail_page_state.dart
+++ b/mobile/apps/photos/lib/states/detail_page_state.dart
@@ -18,6 +18,10 @@ class InheritedDetailPageState extends InheritedWidget {
/// Holds the generatedID of the file currently showing thumbnail fallback.
/// Only the file with matching ID should display the fallback indicator.
final ValueNotifier<int?> showingThumbnailFallbackNotifier;
+
+ /// Whether the photo viewer is currently zoomed in.
+ final ValueNotifier<bool> isZoomedNotifier;
+
// Cannot be const because we accept a ValueNotifier instance at runtime
// ignore: prefer_const_constructors_in_immutables
InheritedDetailPageState({
@@ -26,6 +30,7 @@ class InheritedDetailPageState extends InheritedWidget {
required this.enableFullScreenNotifier,
required this.isInSharedCollectionNotifier,
required this.showingThumbnailFallbackNotifier,
+ required this.isZoomedNotifier,
});
static InheritedDetailPageState of(BuildContext context) =>
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index a86fd70fdb..ad535c75de 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -91,12 +91,14 @@ class _DetailPageState extends State<DetailPage> {
final _enableFullScreenNotifier = ValueNotifier(false);
final _isInSharedCollectionNotifier = ValueNotifier(false);
final _showingThumbnailFallbackNotifier = ValueNotifier<int?>(null);
+ final _isZoomedNotifier = ValueNotifier(false);
@override
void dispose() {
_enableFullScreenNotifier.dispose();
_isInSharedCollectionNotifier.dispose();
_showingThumbnailFallbackNotifier.dispose();
+ _isZoomedNotifier.dispose();
super.dispose();
}
@@ -109,6 +111,7 @@ class _DetailPageState extends State<DetailPage> {
enableFullScreenNotifier: _enableFullScreenNotifier,
isInSharedCollectionNotifier: _isInSharedCollectionNotifier,
showingThumbnailFallbackNotifier: _showingThumbnailFallbackNotifier,
+ isZoomedNotifier: _isZoomedNotifier,
child: _Body(widget.config),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart b/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart
index 1923e5fa00..fb9912bae8 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart
@@ -10,6 +10,7 @@ import "package:photos/l10n/l10n.dart";
import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/file/trash_file.dart";
+import "package:photos/states/detail_page_state.dart";
import "package:photos/utils/file_util.dart";
/// Inline text detection widget that mimics Apple's Live Text behavior:
@@ -189,20 +190,29 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {
return const SizedBox.shrink();
}
+ final isZoomedNotifier = InheritedDetailPageState.maybeOf(context)
+ ?.isZoomedNotifier;
+
return ValueListenableBuilder<bool>(
valueListenable: widget.enableFullScreenNotifier,
builder: (context, isFullScreen, _) {
- final bool shouldHide = isFullScreen || widget.isGuestView;
-
- return Positioned.fill(
- child: IgnorePointer(
- ignoring: shouldHide,
- child: AnimatedOpacity(
- opacity: shouldHide ? 0.0 : 1.0,
- duration: const Duration(milliseconds: 150),
- child: _buildInlineOverlay(context),
- ),
- ),
+ return ValueListenableBuilder<bool>(
+ valueListenable: isZoomedNotifier ?? ValueNotifier(false),
+ builder: (context, isZoomed, _) {
+ final bool shouldHide =
+ isFullScreen || widget.isGuestView || isZoomed;
+
+ return Positioned.fill(
+ child: IgnorePointer(
+ ignoring: shouldHide,
+ child: AnimatedOpacity(
+ opacity: shouldHide ? 0.0 : 1.0,
+ duration: const Duration(milliseconds: 150),
+ child: _buildInlineOverlay(context),
+ ),
+ ),
+ );
+ },
);
},
);
@@ -216,6 +226,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {
autoDetect: true,
backgroundColor: Colors.transparent,
showUnselectedBoundaries: true,
+ overlayOnly: true,
controller: _detectorController,
strings: TextDetectorStrings(
processingOverlayMessage: l10n.ocrProcessingOverlayMessage,
diff --git a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
index 358f726027..85a0ed22c4 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@@ -85,6 +85,9 @@ class _ZoomableImageState extends State<ZoomableImage> {
widget.shouldDisableScroll!(value != PhotoViewScaleState.initial);
}
_isZooming = value != PhotoViewScaleState.initial;
+ InheritedDetailPageState.maybeOf(context)
+ ?.isZoomedNotifier
+ .value = _isZooming;
debugPrint("isZooming = $_isZooming, currentState $value");
// _logger.info('is reakky zooming $_isZooming with state $value');
};
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index 065e8b450c..2ad54bddd1 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -1793,8 +1793,8 @@ packages:
dependency: "direct main"
description:
path: "."
- ref: c907f27a5e7bcb8d46a7698a7d5d38d8f76a6564
- resolved-ref: c907f27a5e7bcb8d46a7698a7d5d38d8f76a6564
+ ref: cdf5aaebe773e50a0a713bb53d00c7141d0078cc
+ resolved-ref: cdf5aaebe773e50a0a713bb53d00c7141d0078cc
url: "https://github.com/Amrithesh-Kakkoth/mobile_ocr"
source: git
version: "1.0.0"
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index 7832389364..3bc56b0a81 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -152,8 +152,8 @@ dependencies:
ml_linalg: ^13.11.31
mobile_ocr:
git:
- url: https://github.com/ente-io/mobile_ocr
- ref: f5ff2124c8424196ea3dc5cf493d98107a5276d4
+ url: https://github.com/Amrithesh-Kakkoth/mobile_ocr
+ ref: cdf5aaebe773e50a0a713bb53d00c7141d0078cc
modal_bottom_sheet: ^3.0.0
motionphoto:
git: "https://github.com/ente-io/motionphoto.git"