Skip to content

armgit / ente

Public Imported from GitHub
0

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

minor fix

AmanRajSinghMouryacf68c3077f15
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index 19f33b3e76..6e8717670a 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -853,7 +853,6 @@
},
"important": "Important",
"unimportant": "Unimportant",
- "addingToImportant": "Marking as important...",
"removingFromImportant": "Removing from important...",
"markingAsImportant": "Marking as important...",
"fileMarkedAsImportant": "Item marked as important",
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 0452dffd5b..e3a912f755 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -2530,12 +2530,6 @@ abstract class AppLocalizations {
/// **'Unimportant'**
String get unimportant;
- /// No description provided for @addingToImportant.
- ///
- /// In en, this message translates to:
- /// **'Marking as important...'**
- String get addingToImportant;
-
/// No description provided for @removingFromImportant.
///
/// In en, this message translates to:
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index fa4227d157..f5a7a4c89c 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -1471,9 +1471,6 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get unimportant => 'Unimportant';
- @override
- String get addingToImportant => 'Marking as important...';
-
@override
String get removingFromImportant => 'Removing from important...';
diff --git a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart b/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart
index 1a27e8f077..73f80b8b7e 100644
--- a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart
@@ -4,6 +4,7 @@ import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/events/collections_updated_event.dart";
import "package:locker/l10n/l10n.dart";
+import "package:locker/services/favorites_service.dart";
import "package:locker/services/files/sync/models/file.dart";
import "package:locker/ui/components/item_list_view.dart";
import "package:locker/ui/components/popup_menu_item_widget.dart";
@@ -94,16 +95,14 @@ class FilePopupMenuWidget extends StatelessWidget {
value: 'toggle_important',
padding: EdgeInsets.zero,
height: 0,
- child: FutureBuilder<bool>(
- future: FileActions.isImportant(file),
- initialData: false,
- builder: (context, snapshot) {
- final isImportant = snapshot.data ?? false;
+ child: Builder(
+ builder: (context) {
+ final isImportant = FavoritesService.instance.isFavoriteCache(file);
return PopupMenuItemWidget(
icon: Icon(
isImportant ? Icons.star_rounded : Icons.star_border_rounded,
color: colorScheme.textBase,
- size: 20,
+ size: 22,
),
label: isImportant
? context.l10n.unimportant
@@ -124,7 +123,7 @@ class FilePopupMenuWidget extends StatelessWidget {
color: colorScheme.textBase,
size: 20,
),
- label: "Save",
+ label: context.l10n.save,
isFirst: false,
isLast: false,
),
diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 401e8d157d..fceee38dcd 100644
--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -601,5 +601,4 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
}
}
}
-
}
diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dart
index de47df9825..115b51be77 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -407,14 +407,9 @@ class FileActions {
}
}
- /// Checks if a file is marked as important
- static Future<bool> isImportant(EnteFile file) async {
- try {
- return await FavoritesService.instance.isFavorite(file);
- } catch (e) {
- _logger.severe("Error checking important status: $e");
- return false;
- }
+ /// Checks if a file is marked as important using cache
+ static bool isImportant(EnteFile file) {
+ return FavoritesService.instance.isFavoriteCache(file);
}
/// Toggles important status of a single file
@@ -423,12 +418,12 @@ class FileActions {
EnteFile file, {
VoidCallback? onSuccess,
}) async {
- final isCurrentlyImportant = await isImportant(file);
+ final isCurrentlyImportant = isImportant(file);
final dialog = createProgressDialog(
context,
isCurrentlyImportant
? context.l10n.removingFromImportant
- : context.l10n.addingToImportant,
+ : context.l10n.markingAsImportant,
isDismissible: false,
);
@@ -460,7 +455,7 @@ class FileActions {
if (context.mounted) {
showToast(
context,
- context.l10n.somethingWentWrong,
+ context.l10n.failedToUpdateImportantStatus(e.toString()),
);
}
}
@@ -481,13 +476,10 @@ class FileActions {
try {
await dialog.show();
- final List<EnteFile> filesToMark = [];
- for (final file in files) {
- final isFileImportant = await isImportant(file);
- if (!isFileImportant) {
- filesToMark.add(file);
- }
- }
+ // Use sync cache for better performance
+ final filesToMark = files
+ .where((file) => !FavoritesService.instance.isFavoriteCache(file))
+ .toList();
if (filesToMark.isEmpty) {
await dialog.hide();