fix(android) detekt: extract SignOutConfirmDialog helper
Sign-out confirm dialog landed inline in SettingsScreen and pushed it past the 60-line cap (93/60). Same pattern as other dialog extractions in the project. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -131,34 +131,42 @@ fun SettingsScreen(
|
||||
}
|
||||
}
|
||||
if (showSignOutConfirm) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showSignOutConfirm = false },
|
||||
title = { Text("Sign out?") },
|
||||
text = {
|
||||
Text(
|
||||
"Sign out of this server? Your downloaded music and " +
|
||||
"settings on this device will be removed.",
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Button(
|
||||
onClick = {
|
||||
showSignOutConfirm = false
|
||||
viewModel.signOut()
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.errorContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||
),
|
||||
) { Text("Sign out") }
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showSignOutConfirm = false }) { Text("Cancel") }
|
||||
SignOutConfirmDialog(
|
||||
onConfirm = {
|
||||
showSignOutConfirm = false
|
||||
viewModel.signOut()
|
||||
},
|
||||
onDismiss = { showSignOutConfirm = false },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SignOutConfirmDialog(onConfirm: () -> Unit, onDismiss: () -> Unit) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text("Sign out?") },
|
||||
text = {
|
||||
Text(
|
||||
"Sign out of this server? Your downloaded music and " +
|
||||
"settings on this device will be removed.",
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Button(
|
||||
onClick = onConfirm,
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.errorContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||
),
|
||||
) { Text("Sign out") }
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NavTile(
|
||||
icon: ImageVector,
|
||||
|
||||
Reference in New Issue
Block a user