Skip to content

armgit / ente

Public Imported from GitHub
0

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

[metadata] Refactor editFileNameAndCaption to editFileName and update documentation

AmanRajSinghMourya5bab8f9774ea
diff --git a/mobile/apps/locker/lib/services/files/sync/metadata_updater_service.dart b/mobile/apps/locker/lib/services/files/sync/metadata_updater_service.dart
index 20a610135a..b4359c1850 100644
--- a/mobile/apps/locker/lib/services/files/sync/metadata_updater_service.dart
+++ b/mobile/apps/locker/lib/services/files/sync/metadata_updater_service.dart
@@ -29,15 +29,13 @@ class MetadataUpdaterService {
}
}
- Future<bool> editFileNameAndCaption(
+ Future<bool> editFileName(
EnteFile file,
String name,
- String caption,
) async {
try {
final Map<String, dynamic> updates = {
editNameKey: name,
- captionKey: caption,
};
await _updatePublicMetadataBulk([file], updates);
await CollectionService.instance.sync();
diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dart
index 37e4041f1b..14b63f77b1 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -19,7 +19,7 @@ import "package:logging/logging.dart";
class FileActions {
static final _logger = Logger("FileActions");
- /// Shows edit dialog for a file to update title, caption, and collections
+ /// Shows edit dialog for a file to update title
static Future<void> editFile(
BuildContext context,
EnteFile file, {
@@ -61,14 +61,12 @@ class FileActions {
try {
final currentTitle = file.displayName;
- final currentCaption = file.caption ?? '';
- final hasMetadataChanged =
- result.title != currentTitle || result.caption != currentCaption;
+ final hasMetadataChanged = result.title != currentTitle;
if (hasMetadataChanged) {
- _logger.info('Updating file metadata: title and/or caption changed');
+ _logger.info('Updating file metadata: title changed');
final metadataUpdateSuccess = await MetadataUpdaterService.instance
- .editFileNameAndCaption(file, result.title, result.caption);
+ .editFileName(file, result.title);
if (!metadataUpdateSuccess) {
await dialog.hide();
@@ -158,15 +156,10 @@ class FileActions {
await dialog.hide();
if (!context.mounted) {
+ onSuccess?.call();
return;
}
- if (hasMetadataChanged) {
- showToast(context, context.l10n.fileUpdatedSuccessfully);
- } else {
- showToast(context, context.l10n.fileUpdatedSuccessfully);
- }
-
onSuccess?.call();
} catch (e) {
await dialog.hide();
@@ -322,10 +315,10 @@ class FileActions {
await dialog.hide();
if (context.mounted) {
- showToast(
- context,
- context.l10n.fileDeletedSuccessfully,
- );
+ showToast(
+ context,
+ context.l10n.fileDeletedSuccessfully,
+ );
}
onSuccess?.call();