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:
@@ -16,7 +16,6 @@ import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -42,8 +41,6 @@ private val CAP_OPTIONS: List<Pair<Long, String>> = listOf(
|
||||
0L to "Unlimited",
|
||||
)
|
||||
|
||||
private val PREFETCH_OPTIONS: List<Int> = listOf(1, 3, 5, 7, 10)
|
||||
|
||||
@Composable
|
||||
fun StorageCard(viewModel: StorageViewModel = hiltViewModel()) {
|
||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||
@@ -69,15 +66,12 @@ fun StorageCard(viewModel: StorageViewModel = hiltViewModel()) {
|
||||
value = state.settings.rollingCapBytes,
|
||||
onSet = viewModel::setRollingCapBytes,
|
||||
)
|
||||
PrefetchDropdown(
|
||||
value = state.settings.prefetchWindow,
|
||||
onSet = viewModel::setPrefetchWindow,
|
||||
)
|
||||
SwitchRow(
|
||||
label = "Cache liked tracks",
|
||||
value = state.settings.cacheLikedTracks,
|
||||
onSet = viewModel::setCacheLikedTracks,
|
||||
)
|
||||
// Pre-fetch ahead + Cache-liked-tracks toggles intentionally
|
||||
// omitted in v1. The underlying systems (MetadataPrefetcher,
|
||||
// pin-on-like flow) don't exist on Android yet — surfacing
|
||||
// controls that silently do nothing is worse than hiding
|
||||
// them. The CacheSettings fields are still persisted so
|
||||
// the toggles return when the systems land.
|
||||
Text(
|
||||
text = "Cache limits take effect on the next app launch.",
|
||||
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
|
||||
* a DropdownMenu of [options]. Used by both Cap and Prefetch selectors.
|
||||
* a DropdownMenu of [options]. Used by the cap selectors.
|
||||
*/
|
||||
@Composable
|
||||
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
|
||||
private fun StorageActions(
|
||||
isSyncing: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user