π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
further cleanup
laurenspriem117a8dd4a809
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dartindex 8894fb2a8b..d7e0991c70 100644--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart@@ -37,7 +37,7 @@ import "package:photos/ui/tools/editor/video_editor_page.dart";import "package:photos/ui/viewer/file/file_app_bar.dart";import "package:photos/ui/viewer/file/file_bottom_bar.dart";import 'package:photos/ui/viewer/file/file_widget.dart';-import "package:photos/ui/viewer/file/inline_text_detection.dart";+import "package:photos/ui/viewer/file/ocr/inline_text_detection.dart";import "package:photos/ui/viewer/file/panorama_viewer_screen.dart";import "package:photos/ui/viewer/file/qr_code_detection_helper.dart";import "package:photos/ui/viewer/file/qr_code_highlight_overlay.dart";diff --git a/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dartsimilarity index 100%rename from mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dartrename to mobile/apps/photos/lib/ui/viewer/file/ocr/inline_text_detection.dartdiff --git a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dartindex 60e2158d9e..405083c525 100644--- a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart@@ -4,9 +4,10 @@ import 'dart:io';import 'package:flutter/material.dart';import 'package:mobile_ocr/mobile_ocr.dart'show DisplayImageHelper, MobileOcr, TextBlock;+import 'package:photos/theme/colors.dart';+import 'package:photos/theme/ente_theme.dart';import 'package:photos/ui/viewer/file/ocr/text_overlay_widget.dart';-const Color _entePrimaryColor = Color(0xFF1DB954);const double _enteSelectionHighlightOpacity = 0.28;/// Collection of user-facing strings used by [TextDetectorWidget].@@ -393,12 +394,13 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {final TextSelectionThemeData baseSelectionTheme = TextSelectionTheme.of(context,);+ final Color primaryColor = getEnteColorScheme(context).primary500;final TextSelectionThemeData overlaySelectionTheme = baseSelectionTheme.copyWith(- selectionColor: _entePrimaryColor.withValues(+ selectionColor: primaryColor.withValues(alpha: _enteSelectionHighlightOpacity,),- selectionHandleColor: _entePrimaryColor,+ selectionHandleColor: primaryColor,);return TextSelectionTheme(@@ -419,34 +421,33 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {return Container(padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),decoration: BoxDecoration(- color: Colors.red.withValues(alpha: 0.9),+ color: getEnteColorScheme(context).warning500.withValues(alpha: 0.9),borderRadius: BorderRadius.circular(16),),child: Text(message,textAlign: TextAlign.center,- style: const TextStyle(- color: Colors.white,- fontSize: 14,- fontWeight: FontWeight.w600,- ),+ style: getEnteTextTheme(+ context,+ ).smallBold.copyWith(color: textBaseDark),),);}Widget _buildNetworkErrorBanner(String message) {+ final Color cautionColor = getEnteColorScheme(context).caution500;return Container(padding: const EdgeInsets.all(20),decoration: BoxDecoration(color: Colors.black.withValues(alpha: 0.85),borderRadius: BorderRadius.circular(16),border: Border.all(- color: Colors.orange.withValues(alpha: 0.3),+ color: cautionColor.withValues(alpha: 0.3),width: 1,),boxShadow: [BoxShadow(- color: Colors.orange.withValues(alpha: 0.2),+ color: cautionColor.withValues(alpha: 0.2),blurRadius: 20,spreadRadius: 2,),@@ -455,21 +456,14 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {child: Column(mainAxisSize: MainAxisSize.min,children: [- Icon(- Icons.cloud_download_outlined,- color: Colors.orange.shade300,- size: 40,- ),+ Icon(Icons.cloud_download_outlined, color: cautionColor, size: 40),const SizedBox(height: 12),Text(message,textAlign: TextAlign.center,- style: const TextStyle(- color: Colors.white,- fontSize: 15,- fontWeight: FontWeight.w500,- height: 1.4,- ),+ style: getEnteTextTheme(+ context,+ ).small.copyWith(color: textBaseDark),),const SizedBox(height: 16),OutlinedButton.icon(@@ -485,8 +479,8 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {icon: const Icon(Icons.refresh, size: 18),label: Text(widget.strings.retryButtonLabel),style: OutlinedButton.styleFrom(- foregroundColor: Colors.orange.shade300,- side: BorderSide(color: Colors.orange.shade300),+ foregroundColor: cautionColor,+ side: BorderSide(color: cautionColor),padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),),),@@ -507,17 +501,15 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {children: [Icon(Icons.search_off,- color: Colors.white.withValues(alpha: 0.7),+ color: textBaseDark.withValues(alpha: 0.7),size: 16,),const SizedBox(width: 8),Text(widget.strings.noTextDetected,- style: TextStyle(- color: Colors.white.withValues(alpha: 0.8),- fontSize: 14,- fontWeight: FontWeight.w500,- ),+ style: getEnteTextTheme(+ context,+ ).small.copyWith(color: textBaseDark.withValues(alpha: 0.8)),),],),diff --git a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_overlay_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_overlay_widget.dartindex eb16e33c25..415db7ff7c 100644--- a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_overlay_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_overlay_widget.dart@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';import 'package:mobile_ocr/mobile_ocr.dart' show CharacterBox, TextBlock;+import 'package:photos/theme/colors.dart';+import 'package:photos/theme/ente_theme.dart';import 'package:photos/ui/viewer/file/ocr/text_reading_order.dart';// OCR character boxes tend to overhang slightly on the left edge, so keep the@@ -553,6 +555,9 @@ class _TextOverlayWidgetState extends State<TextOverlayWidget> {);}+ TextStyle get _toolbarButtonTextStyle =>+ getEnteTextTheme(context).small.copyWith(color: textBaseDark);+Size _measureToolbarScreenSize(MaterialLocalizations localizations,TextStyle buttonTextStyle,@@ -606,11 +611,7 @@ class _TextOverlayWidgetState extends State<TextOverlayWidget> {final MaterialLocalizations localizations = MaterialLocalizations.of(context,);- const TextStyle buttonTextStyle = TextStyle(- color: Colors.white,- fontSize: 14,- fontWeight: FontWeight.w500,- );+ final TextStyle buttonTextStyle = _toolbarButtonTextStyle;final Size screenSize = _measureToolbarScreenSize(localizations,@@ -856,11 +857,7 @@ class _TextOverlayWidgetState extends State<TextOverlayWidget> {context,);- const TextStyle buttonTextStyle = TextStyle(- color: Colors.white,- fontSize: 14,- fontWeight: FontWeight.w500,- );+ final TextStyle buttonTextStyle = _toolbarButtonTextStyle;final Widget toolbar = Container(decoration: BoxDecoration(diff --git a/mobile/apps/photos/test/ui/viewer/file/inline_text_detection_test.dart b/mobile/apps/photos/test/ui/viewer/file/inline_text_detection_test.dartdeleted file mode 100644index c9d8678c47..0000000000--- a/mobile/apps/photos/test/ui/viewer/file/inline_text_detection_test.dart+++ /dev/null@@ -1,83 +0,0 @@-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";-import "package:photos/models/file/file.dart";-import "package:photos/models/file/file_type.dart";-import "package:photos/states/detail_page_state.dart";-import "package:photos/ui/viewer/file/inline_text_detection.dart";--void main() {- testWidgets("inactive OCR leaves still-photo taps available", (tester) async {- var tapped = false;-- await tester.pumpWidget(- _testViewer(- photo: GestureDetector(- key: const Key("photo"),- behavior: HitTestBehavior.opaque,- onTap: () => tapped = true,- child: const SizedBox.expand(),- ),- ),- );- await tester.pump();-- await tester.tap(find.byKey(const Key("photo")));-- expect(tapped, isTrue);- });-- testWidgets("inactive OCR leaves still-photo paging available", (- tester,- ) async {- final pageController = PageController();- addTearDown(pageController.dispose);-- await tester.pumpWidget(- _testViewer(- photo: PageView(- controller: pageController,- children: const [- ColoredBox(color: Colors.black),- SizedBox.expand(),- ],- ),- ),- );- await tester.pump();-- await tester.drag(find.byType(PageView), const Offset(-600, 0));- await tester.pumpAndSettle();-- expect(pageController.page, 1);- });-}--Widget _testViewer({required Widget photo}) {- final file = EnteFile()- ..generatedID = 1- ..fileType = FileType.image;-- return MaterialApp(- home: InheritedDetailPageState(- enableFullScreenNotifier: ValueNotifier(false),- isInSharedCollectionNotifier: ValueNotifier(false),- showingThumbnailFallbackNotifier: ValueNotifier(null),- isZoomedNotifier: ValueNotifier(false),- zoomTransformNotifier: ValueNotifier(ZoomTransform.identity),- child: Scaffold(- body: Stack(- children: [- Positioned.fill(child: photo),- Positioned.fill(- child: InlineTextDetection(- file: file,- controller: InlineTextDetectionController(),- isGuestView: false,- ),- ),- ],- ),- ),- ),- );-}diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arbindex c64324a3f5..14b6c87c37 100644--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb@@ -2604,8 +2604,6 @@"ocrModelsNetworkRequiredError": "Network connection required to download OCR models on first use","ocrModelsPrepareFailed": "Could not prepare OCR models","ocrNoTextDetected": "No text detected",- "ocrProcessingOverlayMessage": "Detecting text...",- "ocrSelectionHint": "Swipe or double tap to select just what you need","of_": "of","offlineEnableBackupTagLabel": "10 GB FREE!","offlineFacesBannerSubtitle": "Sign up to tag people and easily find them later.",