feat: move logout button from About tab to Connection tab (#487)
- Remove the Logout button from the About tab content. - Add the Logout button at the bottom of the Connection tab so users can sign out directly where they manage their connection. - Delete the unused, duplicate AboutSection() composable (it was never called and carried its own Logout button) to keep a single source of truth for the action. Logout behavior is unchanged: it still calls viewModel.logout() then onLogout() (navigates to login). Verified with assembleDebug + ktlint.
This commit is contained in:
@@ -166,6 +166,20 @@ fun SettingsScreen(
|
|||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
viewModel.logout()
|
||||||
|
onLogout()
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
colors =
|
||||||
|
ButtonDefaults.buttonColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.error,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.settings_logout))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsTab.BEHAVIOR -> {
|
SettingsTab.BEHAVIOR -> {
|
||||||
@@ -252,20 +266,6 @@ fun SettingsScreen(
|
|||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
|
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = {
|
|
||||||
viewModel.logout()
|
|
||||||
onLogout()
|
|
||||||
},
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors =
|
|
||||||
ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.error,
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
Text(stringResource(R.string.settings_logout))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1166,66 +1166,3 @@ private fun NavBarSection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun AboutSection(onLogout: () -> Unit) {
|
|
||||||
SectionCard(title = stringResource(R.string.settings_sec_about)) {
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.settings_about_app_name),
|
|
||||||
style =
|
|
||||||
MaterialTheme.typography.titleMedium.copy(
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
InfoRow(
|
|
||||||
label = stringResource(R.string.settings_about_version),
|
|
||||||
value = "v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})",
|
|
||||||
)
|
|
||||||
InfoRow(
|
|
||||||
label = stringResource(R.string.settings_about_build),
|
|
||||||
value =
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
stringResource(R.string.settings_about_debug)
|
|
||||||
} else {
|
|
||||||
stringResource(R.string.settings_about_release)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if (BuildConfig.GIT_SHA.isNotBlank()) {
|
|
||||||
InfoRow(
|
|
||||||
label = stringResource(R.string.settings_about_commit),
|
|
||||||
value = BuildConfig.GIT_SHA,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
|
||||||
Text(
|
|
||||||
text = "https://github.com/Hy4ri/hermes-mobile",
|
|
||||||
style =
|
|
||||||
MaterialTheme.typography.bodySmall.copy(
|
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
|
||||||
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = onLogout,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors =
|
|
||||||
ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.error,
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
Text(stringResource(R.string.settings_logout))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user