only enable sync-in-background mode when file is already cached

This commit is contained in:
Philipp Crocoll
2025-05-13 14:52:13 +02:00
parent 71806178d0
commit 8277283ebc

View File

@@ -81,11 +81,12 @@ namespace keepass2android
} }
else else
{ {
if (_app.SyncInBackgroundPreference && fileStorage is IOfflineSwitchable offlineSwitchable) if (_app.SyncInBackgroundPreference && fileStorage is CachingFileStorage cachingFileStorage &&
cachingFileStorage.IsCached(_ioc))
{ {
offlineSwitchable.IsOffline = true; cachingFileStorage.IsOffline = true;
//no warning. We'll trigger a sync later. //no warning. We'll trigger a sync later.
offlineSwitchable.TriggerWarningWhenFallingBackToCache = false; cachingFileStorage.TriggerWarningWhenFallingBackToCache = false;
requiresSubsequentSync = true; requiresSubsequentSync = true;
} }