Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Support for force refresh

Neeraj Guptab4c6805d42d6
diff --git a/mobile/lib/services/magic_cache_service.dart b/mobile/lib/services/magic_cache_service.dart
index 445e875699..63d585abd5 100644
--- a/mobile/lib/services/magic_cache_service.dart
+++ b/mobile/lib/services/magic_cache_service.dart
@@ -147,10 +147,13 @@ class MagicCacheService {
return (await getApplicationSupportDirectory()).path + "/cache/magic_cache";
}
- Future<void> updateCache() async {
+ Future<void> updateCache({bool forced = false}) async {
if (!enableDiscover) {
return;
}
+ if (forced) {
+ _pendingUpdateReason.add("Forced update");
+ }
try {
if (_pendingUpdateReason.isEmpty || _isUpdateInProgress) {
_logger.info(
diff --git a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
index 0f0a6f26f0..f5ffa336b2 100644
--- a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
+++ b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
@@ -222,7 +222,7 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
trailingIconIsMuted: true,
onTap: () async {
try {
- await MagicCacheService.instance.updateCache();
+ await MagicCacheService.instance.updateCache(forced: true);
} catch (e, s) {
logger.warning('Update discover failed', e, s);
await showGenericErrorDialog(context: context, error: e);