fix(android) detekt: extract SettingsList helper

SettingsScreen was still 75/60 after the dialog extraction. Extracted
the Column-of-cards body into SettingsList so the main composable
only holds state collection, LaunchedEffect, and the Scaffold shell.
Also fixed the helper's state-param type — SettingsViewModel uses
SettingsState not SettingsUiState.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 21:22:19 -04:00
parent dd7c5544bf
commit 1c05b561ba
@@ -91,6 +91,37 @@ fun SettingsScreen(
) )
}, },
) { inner -> ) { inner ->
SettingsList(
inner = inner,
state = state,
themeMode = themeMode,
onPickTheme = themeVm::setThemeMode,
onNavToRequests = { navController.navigate(Requests) },
onNavToAdmin = { navController.navigate(Admin) },
onSignOutClick = { showSignOutConfirm = true },
)
}
if (showSignOutConfirm) {
SignOutConfirmDialog(
onConfirm = {
showSignOutConfirm = false
viewModel.signOut()
},
onDismiss = { showSignOutConfirm = false },
)
}
}
@Composable
private fun SettingsList(
inner: androidx.compose.foundation.layout.PaddingValues,
state: SettingsState,
themeMode: ThemeMode,
onPickTheme: (ThemeMode) -> Unit,
onNavToRequests: () -> Unit,
onNavToAdmin: () -> Unit,
onSignOutClick: () -> Unit,
) {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
@@ -108,36 +139,23 @@ fun SettingsScreen(
icon = Lucide.ListMusic, icon = Lucide.ListMusic,
title = "My requests", title = "My requests",
subtitle = "Track what you've asked Minstrel to add", subtitle = "Track what you've asked Minstrel to add",
onClick = { navController.navigate(Requests) }, onClick = onNavToRequests,
) )
if (state.isAdmin) { if (state.isAdmin) {
NavTile( NavTile(
icon = Lucide.Shield, icon = Lucide.Shield,
title = "Admin", title = "Admin",
subtitle = "Manage requests, quarantine, and users", subtitle = "Manage requests, quarantine, and users",
onClick = { navController.navigate(Admin) }, onClick = onNavToAdmin,
) )
} }
ProfileCard() ProfileCard()
PasswordCard() PasswordCard()
ListenBrainzCard() ListenBrainzCard()
AppearanceCard(themeMode = themeMode, onPick = themeVm::setThemeMode) AppearanceCard(themeMode = themeMode, onPick = onPickTheme)
StorageCard() StorageCard()
AboutCard() AboutCard()
SignOutButton( SignOutButton(isSigningOut = state.isSigningOut, onSignOut = onSignOutClick)
isSigningOut = state.isSigningOut,
onSignOut = { showSignOutConfirm = true },
)
}
}
if (showSignOutConfirm) {
SignOutConfirmDialog(
onConfirm = {
showSignOutConfirm = false
viewModel.signOut()
},
onDismiss = { showSignOutConfirm = false },
)
} }
} }