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.
fix(connectors): stop the interval slider stalling on the main thread
Durganshu Mishra1139a9011aec
diff --git a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt b/app/src/main/java/com/gotcha/ui/ConnectorsSection.ktindex 2f8ad51..2952d30 100644--- a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt+++ b/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt@@ -37,6 +37,7 @@ import com.gotcha.connectors.notion.NotionConnectorimport com.gotcha.connectors.oauth.OAuthConnectFlowimport com.gotcha.data.SettingsRepositoryimport kotlin.math.roundToInt+import kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.delayimport kotlinx.coroutines.isActiveimport kotlinx.coroutines.launch@@ -93,10 +94,18 @@ fun ConnectorsSection() {AutoRefreshHeader(intervalMinutes = settings.connectorAutoRefreshIntervalMinutes,lastRefreshedAt = settings.connectorLastRefreshedAt,+ // 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+ // to drop frames while a finger is still on the slider.onIntervalChange = { newInterval ->- val current = settingsRepo.load()- settings = current.copy(connectorAutoRefreshIntervalMinutes = newInterval)- settingsRepo.save(settings)+ settings = settings.copy(connectorAutoRefreshIntervalMinutes = newInterval)+ scope.launch(Dispatchers.IO) {+ val current = settingsRepo.load()+ settingsRepo.save(+ current.copy(connectorAutoRefreshIntervalMinutes = newInterval)+ )+ }},onRefreshAll = {val results = refreshScheduler.refreshIfNeeded(force = true)