π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] move authentication check into showTrashPage
Priyanshu Dangared8f3421d2f41
diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dartindex eafbc38cc1..d5d0bc06c7 100644--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart@@ -2,7 +2,6 @@ import "dart:async";import "dart:io";import "package:ente_components/ente_components.dart";-import "package:ente_lock_screen/local_authentication_service.dart";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:ente_strings/ente_strings.dart";import "package:flutter/foundation.dart" show kDebugMode;@@ -51,15 +50,7 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {title: l10n.trash,subtitle: l10n.restoreOrPermanentlyDeleteItems,icon: HugeIcons.strokeRoundedDelete01,- onTap: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- l10n.authToViewTrashedFiles,- );- if (!hasAuthenticated || !context.mounted) return;- await showTrashPage(context);- },+ onTap: () => showTrashPage(context),),const SizedBox(height: Spacing.sm),_buildFreeSpaceOption(diff --git a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dartindex 47ac30e85c..082fbfb9b0 100644--- a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart@@ -107,12 +107,6 @@ Future<void> showAlbumsManageSheet(BuildContext context) {icon: HugeIcons.strokeRoundedDelete01,iconColor: const Color(0xFFE3505A),onTap: () async {- final ok = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- strings.authToViewTrashedFiles,- );- if (!ok || !context.mounted) return;if (sheetContext.mounted) {Navigator.of(sheetContext).pop();}diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dartindex 08a421b07a..7b3ae5018e 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart@@ -2,6 +2,7 @@ import "dart:io";import "package:collection/collection.dart";import "package:ente_components/ente_components.dart";+import "package:ente_lock_screen/local_authentication_service.dart";import "package:ente_photos_platform/ente_photos_platform.dart"show DeviceTrashClient;import "package:ente_pure_utils/ente_pure_utils.dart";@@ -30,6 +31,10 @@ import "package:photos/ui/viewer/gallery/state/selection_state.dart";import "package:photos/utils/device_info.dart";Future<void> showTrashPage(BuildContext context) async {+ final l10n = context.strings;+ final hasAuthenticated = await LocalAuthenticationService.instance+ .requestLocalAuthentication(context, l10n.authToViewTrashedFiles);+ if (!hasAuthenticated) return;final isDeviceTrashSupported =flagService.internalUser &&Platform.isAndroid &&