private fun updateSyncPreferenceStatus() { syncPreference.apply { isSwitchWidgetVisible = true val syncEnginesStatus = SyncEnginesStorage(context).getStatus() val syncStatus = syncEnginesStatus.getOrElse(syncEngine) { false } title = loggedInTitle isChecked = syncStatus setOnPreferenceChangeListener { _, newValue -> SyncEnginesStorage(context).setStatus(syncEngine, newValue as Boolean) setSwitchCheckedState(newValue) true } } }
Shows a switch toggle for the sync preference when the user is logged in.