feat(PatchOptsScreen): change title if is update

This commit is contained in:
rushiiMachine 2025-02-09 15:19:00 -08:00
parent 300952ad21
commit e9d233861f
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
4 changed files with 9 additions and 5 deletions

View file

@ -176,6 +176,7 @@ class HomeModel(
}
private fun isInstallationUpToDate(pkg: PackageInfo): Boolean {
// Assume up-to-date when remote data hasn't been fetched yet
val remoteBuildData = remoteDataJson ?: return true
// `longVersionCode` is unnecessary since Discord doesn't use `versionCodeMajor`

View file

@ -37,7 +37,7 @@ import org.koin.core.parameter.parametersOf
@Parcelize
class PatchOptionsScreen(
private val prefilledOptions: PatchOptions = PatchOptions.Default,
private val prefilledOptions: PatchOptions? = null,
private val supportedVersion: DiscordVersion = DiscordVersion.None,
) : Screen, Parcelable {
@IgnoredOnParcel
@ -47,7 +47,7 @@ class PatchOptionsScreen(
override fun Content() {
val context = LocalContext.current
val navigator = LocalNavigator.currentOrThrow
val model = getScreenModel<PatchOptionsModel>() { parametersOf(prefilledOptions) }
val model = getScreenModel<PatchOptionsModel>() { parametersOf(prefilledOptions ?: PatchOptions.Default) }
LaunchedEffect(Unit) {
// Ensure that when popping this screen off the stack that permission requests don't get triggered
@ -72,7 +72,7 @@ class PatchOptionsScreen(
}
Scaffold(
topBar = { PatchOptionsAppBar() },
topBar = { PatchOptionsAppBar(isUpdate = prefilledOptions != null) },
) { paddingValues ->
Column(
verticalArrangement = Arrangement.spacedByLastAtBottom(20.dp),

View file

@ -11,10 +11,12 @@ import com.aliucord.manager.ui.components.BackButton
import com.aliucord.manager.ui.screens.settings.SettingsScreen
@Composable
fun PatchOptionsAppBar() {
fun PatchOptionsAppBar(
isUpdate: Boolean = false,
) {
TopAppBar(
navigationIcon = { BackButton() },
title = { Text(stringResource(R.string.action_add_install)) },
title = { Text(stringResource(if (!isUpdate) R.string.action_add_install else R.string.action_update_install)) },
actions = {
val navigator = LocalNavigator.currentOrThrow

View file

@ -16,6 +16,7 @@
<string name="action_install">Install</string>
<string name="action_uninstall">Uninstall</string>
<string name="action_add_install">New Aliucord Installation</string>
<string name="action_update_install">Update Aliucord Installation</string>
<string name="action_update">Update</string>
<string name="action_clear">Clear</string>
<string name="action_launch">Launch</string>