[mob] Support for force refresh

This commit is contained in:
Neeraj Gupta 2024-09-18 11:52:03 +05:30
parent 9c1f744f73
commit b4c6805d42
2 changed files with 5 additions and 2 deletions

View File

@ -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(

View File

@ -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);