From 8277283ebcfd27d78ec6ed307143384494d281cf Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 13 May 2025 14:52:13 +0200 Subject: [PATCH] only enable sync-in-background mode when file is already cached --- src/Kp2aBusinessLogic/database/edit/LoadDB.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Kp2aBusinessLogic/database/edit/LoadDB.cs b/src/Kp2aBusinessLogic/database/edit/LoadDB.cs index 5223ce65..01186dda 100644 --- a/src/Kp2aBusinessLogic/database/edit/LoadDB.cs +++ b/src/Kp2aBusinessLogic/database/edit/LoadDB.cs @@ -81,11 +81,12 @@ namespace keepass2android } else { - if (_app.SyncInBackgroundPreference && fileStorage is IOfflineSwitchable offlineSwitchable) + if (_app.SyncInBackgroundPreference && fileStorage is CachingFileStorage cachingFileStorage && + cachingFileStorage.IsCached(_ioc)) { - offlineSwitchable.IsOffline = true; - //no warning. We'll trigger a sync later. - offlineSwitchable.TriggerWarningWhenFallingBackToCache = false; + cachingFileStorage.IsOffline = true; + //no warning. We'll trigger a sync later. + cachingFileStorage.TriggerWarningWhenFallingBackToCache = false; requiresSubsequentSync = true; }