refactor: reduce CalDAV sync to login and manual sync button only

- Remove auto-login sync in AuthGuard
- Remove 10s interval sync and syncAndReload in calendar tab
- Remove lazy syncOnce pattern in ChatService AI callbacks
- Remove CaldavService dependency from ChatService constructor
This commit is contained in:
2026-02-09 23:32:04 +01:00
parent 5a9485acfc
commit b9ffc6c908
4 changed files with 3 additions and 45 deletions

View File

@@ -17,7 +17,6 @@ import { Ionicons } from "@expo/vector-icons";
import { useThemeStore } from "../../stores/ThemeStore";
import BaseBackground from "../../components/BaseBackground";
import { EventService } from "../../services";
import { CaldavConfigService } from "../../services/CaldavConfigService";
import { useEventsStore } from "../../stores";
import { useDropdownPosition } from "../../hooks/useDropdownPosition";
@@ -108,25 +107,11 @@ const Calendar = () => {
}
}, [monthIndex, currentYear, setEvents]);
// Sync CalDAV in background, then reload events
const syncAndReload = useCallback(async () => {
try {
await CaldavConfigService.sync();
await loadEvents();
} catch {
// Sync failed — not critical
}
}, [loadEvents]);
// Load events instantly on focus, then sync in background periodically
// Load events from DB on focus
useFocusEffect(
useCallback(() => {
loadEvents();
syncAndReload();
const interval = setInterval(syncAndReload, 10_000);
return () => clearInterval(interval);
}, [loadEvents, syncAndReload]),
}, [loadEvents]),
);
// Re-open overlay after back navigation from editEvent