Skip to content

Colota - Android GPS Location tracker

fix: validate heartbeat interval, track sync failures and handle SSID fetch error

Max Dietricha17866f44d13
diff --git a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
index e1733dad..5a8d04b1 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
@@ -256,6 +256,7 @@ class SyncManager(
successfulIds.add(queueId)
} else {
dbHelper.incrementRetryCount(queueId, "Send failed")
+ totalFailed++
}
}
diff --git a/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx b/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx
index 39d6e33f..190d08d7 100644
--- a/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx
+++ b/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx
@@ -41,7 +41,10 @@ export function SyncStrategySettings({
useEffect(() => {
if (settings.syncCondition !== "wifi_ssid") return
- const fetchSsid = () => NativeLocationService.getCurrentSsid().then(setCurrentSsid)
+ const fetchSsid = () =>
+ NativeLocationService.getCurrentSsid()
+ .then(setCurrentSsid)
+ .catch(() => {})
fetchSsid()
const sub = AppState.addEventListener("change", (state) => {
diff --git a/apps/mobile/src/screens/GeofenceEditorScreen.tsx b/apps/mobile/src/screens/GeofenceEditorScreen.tsx
index 379e70ef..ab265a31 100644
--- a/apps/mobile/src/screens/GeofenceEditorScreen.tsx
+++ b/apps/mobile/src/screens/GeofenceEditorScreen.tsx
@@ -144,6 +144,10 @@ export function GeofenceEditorScreen({ navigation, route }: any) {
showAlert("Invalid Radius", "Please enter a valid radius.", "warning")
return
}
+ if (heartbeatEnabled && heartbeatIntervalMinutes < 1) {
+ showAlert("Invalid Heartbeat", "Heartbeat interval must be at least 1 minute.", "warning")
+ return
+ }
setSaving(true)
try {