fix(android): hide Storage prefetch + cache-liked toggles (no-ops)

Both were rendering controls that silently did nothing — there's no
MetadataPrefetcher on Android, and no pin-on-like flow. A toggle
that flips persisted state but has no functional effect makes the
app look broken.

Removed the two rows from StorageCard; CacheSettings persistence
keeps the fields so the controls come back unchanged when the
underlying systems land.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 19:44:50 -04:00
parent d99d317563
commit 4d7a4312db
@@ -16,7 +16,6 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Switch
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -42,8 +41,6 @@ private val CAP_OPTIONS: List<Pair<Long, String>> = listOf(
0L to "Unlimited", 0L to "Unlimited",
) )
private val PREFETCH_OPTIONS: List<Int> = listOf(1, 3, 5, 7, 10)
@Composable @Composable
fun StorageCard(viewModel: StorageViewModel = hiltViewModel()) { fun StorageCard(viewModel: StorageViewModel = hiltViewModel()) {
val state by viewModel.state.collectAsStateWithLifecycle() val state by viewModel.state.collectAsStateWithLifecycle()
@@ -69,15 +66,12 @@ fun StorageCard(viewModel: StorageViewModel = hiltViewModel()) {
value = state.settings.rollingCapBytes, value = state.settings.rollingCapBytes,
onSet = viewModel::setRollingCapBytes, onSet = viewModel::setRollingCapBytes,
) )
PrefetchDropdown( // Pre-fetch ahead + Cache-liked-tracks toggles intentionally
value = state.settings.prefetchWindow, // omitted in v1. The underlying systems (MetadataPrefetcher,
onSet = viewModel::setPrefetchWindow, // pin-on-like flow) don't exist on Android yet — surfacing
) // controls that silently do nothing is worse than hiding
SwitchRow( // them. The CacheSettings fields are still persisted so
label = "Cache liked tracks", // the toggles return when the systems land.
value = state.settings.cacheLikedTracks,
onSet = viewModel::setCacheLikedTracks,
)
Text( Text(
text = "Cache limits take effect on the next app launch.", text = "Cache limits take effect on the next app launch.",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
@@ -131,20 +125,9 @@ private fun CapDropdown(label: String, value: Long, onSet: (Long) -> Unit) {
) )
} }
@Composable
private fun PrefetchDropdown(value: Int, onSet: (Int) -> Unit) {
val selected = if (value in PREFETCH_OPTIONS) value else PREFETCH_OPTIONS[2]
LabeledDropdown(
label = "Pre-fetch ahead",
selectedLabel = "$selected tracks",
options = PREFETCH_OPTIONS.map { it to "$it tracks" },
onSelect = onSet,
)
}
/** /**
* Label on the left, button-with-current-value on the right that opens * Label on the left, button-with-current-value on the right that opens
* a DropdownMenu of [options]. Used by both Cap and Prefetch selectors. * a DropdownMenu of [options]. Used by the cap selectors.
*/ */
@Composable @Composable
private fun <T> LabeledDropdown( private fun <T> LabeledDropdown(
@@ -184,22 +167,6 @@ private fun <T> LabeledDropdown(
} }
} }
@Composable
private fun SwitchRow(label: String, value: Boolean, onSet: (Boolean) -> Unit) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = label,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.weight(1f),
)
Switch(checked = value, onCheckedChange = onSet)
}
}
@Composable @Composable
private fun StorageActions( private fun StorageActions(
isSyncing: Boolean, isSyncing: Boolean,