Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): ios clear file cache feedback (#31401)

Yohanes Kiranaf48d4b332127
diff --git a/i18n/en.json b/i18n/en.json
index 8751bc790c..87e89e577a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -727,6 +727,8 @@
"clear_all_recent_searches": "Clear all recent searches",
"clear_failed_count": "Clear failed ({count})",
"clear_file_cache": "Clear File Cache",
+ "clear_file_cache_error": "Failed to clear file cache",
+ "clear_file_cache_success": "File cache cleared",
"clear_message": "Clear message",
"clear_value": "Clear value",
"client_cert_import": "Import",
diff --git a/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart b/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart
index da59562133..becb6aab09 100644
--- a/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart
+++ b/mobile/lib/widgets/settings/beta_sync_settings/sync_status_and_actions.dart
@@ -86,7 +86,37 @@ class SyncStatusAndActions extends HookConsumerWidget {
}
Future<void> clearFileCache() async {
- await ref.read(storageRepositoryProvider).clearCache();
+ try {
+ await ref.read(storageRepositoryProvider).clearCache();
+
+ if (!context.mounted) {
+ return;
+ }
+
+ context.scaffoldMessenger.showSnackBar(
+ SnackBar(
+ duration: const Duration(seconds: 2),
+ content: Text(
+ context.t.clear_file_cache_success,
+ style: context.textTheme.bodyLarge?.copyWith(color: context.primaryColor),
+ ),
+ ),
+ );
+ } catch (e) {
+ if (!context.mounted) {
+ return;
+ }
+
+ context.scaffoldMessenger.showSnackBar(
+ SnackBar(
+ duration: const Duration(seconds: 2),
+ content: Text(
+ context.t.clear_file_cache_error,
+ style: context.textTheme.bodyLarge?.copyWith(color: context.colorScheme.error),
+ ),
+ ),
+ );
+ }
}
Future<void> resetSqliteDb(BuildContext context) {