feat(settings): Make upgrade prompt a clickable button inline with appearance header

This commit is contained in:
darken
2026-03-02 16:36:52 +01:00
committed by Matthias Urhahn
parent 073de3cf35
commit b3b55f1ca3
2 changed files with 21 additions and 10 deletions
@@ -4,6 +4,7 @@ import android.app.Activity
import android.os.Build
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
@@ -89,6 +90,7 @@ fun GeneralSettingsScreenHost(vm: GeneralSettingsViewModel = hiltViewModel()) {
onThemeModeSelected = { mode -> vm.setThemeMode(mode) },
onThemeStyleSelected = { style -> vm.setThemeStyle(style) },
onThemeColorSelected = { color -> vm.setThemeColor(color) },
onUpgrade = { vm.launchUpgrade() },
)
}
}
@@ -109,6 +111,7 @@ fun GeneralSettingsScreen(
onThemeModeSelected: (ThemeMode) -> Unit = {},
onThemeStyleSelected: (ThemeStyle) -> Unit = {},
onThemeColorSelected: (ThemeColor) -> Unit = {},
onUpgrade: () -> Unit = {},
modifier: Modifier = Modifier,
) {
var showMonitorModeDialog by remember { mutableStateOf(false) }
@@ -155,16 +158,20 @@ fun GeneralSettingsScreen(
)
}
item {
SettingsCategoryHeader(text = stringResource(R.string.settings_category_appearance_label))
}
if (!state.isPro) {
item {
Text(
text = stringResource(R.string.common_feature_requires_pro_msg),
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.error,
modifier = Modifier.padding(start = 56.dp, end = 16.dp, bottom = 4.dp),
)
Row(verticalAlignment = Alignment.CenterVertically) {
SettingsCategoryHeader(text = stringResource(R.string.settings_category_appearance_label))
if (!state.isPro) {
Spacer(modifier = Modifier.weight(1f))
TextButton(
onClick = onUpgrade,
modifier = Modifier.padding(end = 4.dp),
) {
Text(
text = stringResource(R.string.common_feature_requires_pro_msg),
style = MaterialTheme.typography.labelSmall,
)
}
}
}
}
item {
@@ -131,6 +131,10 @@ class GeneralSettingsViewModel @Inject constructor(
}
}
fun launchUpgrade() = launch {
launchUpgradeFlow.tryEmit { upgradeRepo.launchBillingFlow(it) }
}
fun goToDebugSettings() {
navTo(Nav.Settings.Debug)
}