Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

refactor(connectors): drop the "Syncing connectors…" line

Durganshu Mishra85eb47af86a9
diff --git a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt b/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
index 0aadb78..2639faa 100644
--- a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
+++ b/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
@@ -68,9 +68,6 @@ fun ConnectorsSection() {
var disabled by remember { mutableStateOf(settings.disabledConnectors) }
val scope = rememberCoroutineScope()
val refreshScheduler = remember(context) { ConnectorRefreshScheduler(context) }
- // True while the scheduled refresh below is in flight, so the header can say
- // so instead of just looking stuck.
- var autoSyncing by remember { mutableStateOf(false) }
// Automatic background scheduler loop while screen is open.
//
@@ -81,12 +78,7 @@ fun ConnectorsSection() {
LaunchedEffect(settings.connectorAutoRefreshIntervalMinutes) {
if (settings.connectorAutoRefreshIntervalMinutes <= 0) return@LaunchedEffect
while (isActive) {
- autoSyncing = true
- val refreshed = try {
- refreshScheduler.refreshIfNeeded()
- } finally {
- autoSyncing = false
- }
+ val refreshed = refreshScheduler.refreshIfNeeded()
if (refreshed.isNotEmpty()) {
// Take the new stamp and nothing else. Reassigning all of
// Settings from disk would also overwrite the interval held in
@@ -112,7 +104,6 @@ fun ConnectorsSection() {
AutoRefreshHeader(
intervalMinutes = settings.connectorAutoRefreshIntervalMinutes,
lastRefreshedAt = settings.connectorLastRefreshedAt,
- isAutoSyncing = autoSyncing,
// Reflected in the UI immediately and persisted off the main thread.
// Settings lives in EncryptedSharedPreferences, so the read-modify-
// write behind this is ~60 AES reads plus 58 writes -- long enough
@@ -179,7 +170,6 @@ private fun indexOfInterval(minutes: Int): Int {
private fun AutoRefreshHeader(
intervalMinutes: Int,
lastRefreshedAt: Long,
- isAutoSyncing: Boolean,
onIntervalChange: (Int) -> Unit,
onRefreshAll: suspend () -> Map<String, String>
) {
@@ -290,16 +280,6 @@ private fun AutoRefreshHeader(
steps = AUTO_REFRESH_INTERVALS.size - 2,
modifier = Modifier.fillMaxWidth()
)
- // A new interval saves in milliseconds; what takes a moment is the
- // sync it starts when one is already due. Name that rather than the
- // save, so the pause is explained instead of looking like a hang.
- if (isAutoSyncing) {
- Text(
- "Syncing connectors…",
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant
- )
- }
}
}
}