feat(PatchOpts): remove version display
No purpose and it adds complexity so removing is better.
This commit is contained in:
parent
713d308f3e
commit
b329e1bad6
4 changed files with 4 additions and 37 deletions
|
|
@ -5,7 +5,6 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.tooling.preview.*
|
||||
import com.aliucord.manager.ui.components.ManagerTheme
|
||||
import com.aliucord.manager.ui.screens.patchopts.*
|
||||
import com.aliucord.manager.ui.util.DiscordVersion
|
||||
|
||||
// This preview has scrollable/interactable content that cannot be tested from an IDE preview
|
||||
|
||||
|
|
@ -13,14 +12,13 @@ import com.aliucord.manager.ui.util.DiscordVersion
|
|||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun PatchOptionsScreenPreview(
|
||||
@PreviewParameter(ContributorsProvider::class)
|
||||
@PreviewParameter(PatchOptionsParametersProvider::class)
|
||||
parameters: PatchOptionsParameters,
|
||||
) {
|
||||
ManagerTheme {
|
||||
PatchOptionsScreenContent(
|
||||
isUpdate = parameters.isUpdate,
|
||||
isDevMode = parameters.isDevMode,
|
||||
supportedVersion = parameters.supportedVersion,
|
||||
debuggable = parameters.debuggable,
|
||||
setDebuggable = {},
|
||||
replaceIcon = parameters.replaceIcon,
|
||||
|
|
@ -40,7 +38,6 @@ private fun PatchOptionsScreenPreview(
|
|||
private data class PatchOptionsParameters(
|
||||
val isUpdate: Boolean,
|
||||
val isDevMode: Boolean,
|
||||
val supportedVersion: DiscordVersion,
|
||||
val debuggable: Boolean,
|
||||
val replaceIcon: Boolean,
|
||||
val appName: String,
|
||||
|
|
@ -50,15 +47,12 @@ private data class PatchOptionsParameters(
|
|||
val isConfigValid: Boolean,
|
||||
)
|
||||
|
||||
private class ContributorsProvider : PreviewParameterProvider<PatchOptionsParameters> {
|
||||
private val stableVersion = DiscordVersion.Existing(DiscordVersion.Type.STABLE, "126.21", 126021)
|
||||
|
||||
private class PatchOptionsParametersProvider : PreviewParameterProvider<PatchOptionsParameters> {
|
||||
override val values = sequenceOf(
|
||||
// Default initial install
|
||||
PatchOptionsParameters(
|
||||
isUpdate = false,
|
||||
isDevMode = false,
|
||||
supportedVersion = stableVersion,
|
||||
debuggable = false,
|
||||
replaceIcon = true,
|
||||
appName = PatchOptions.Default.appName,
|
||||
|
|
@ -70,7 +64,6 @@ private class ContributorsProvider : PreviewParameterProvider<PatchOptionsParame
|
|||
PatchOptionsParameters(
|
||||
isUpdate = true,
|
||||
isDevMode = false,
|
||||
supportedVersion = stableVersion,
|
||||
debuggable = false,
|
||||
replaceIcon = true,
|
||||
appName = "an invalid app name.",
|
||||
|
|
@ -82,7 +75,6 @@ private class ContributorsProvider : PreviewParameterProvider<PatchOptionsParame
|
|||
PatchOptionsParameters(
|
||||
isUpdate = false,
|
||||
isDevMode = true,
|
||||
supportedVersion = stableVersion,
|
||||
debuggable = true,
|
||||
replaceIcon = false,
|
||||
appName = PatchOptions.Default.appName,
|
||||
|
|
|
|||
|
|
@ -150,10 +150,7 @@ class HomeModel(
|
|||
val patchOptions = metadata?.options
|
||||
?: PatchOptions.Default.copy(packageName = packageName)
|
||||
|
||||
return PatchOptionsScreen(
|
||||
prefilledOptions = patchOptions,
|
||||
supportedVersion = supportedVersion,
|
||||
)
|
||||
return PatchOptionsScreen(prefilledOptions = patchOptions)
|
||||
}
|
||||
|
||||
suspend fun fetchRemoteData() {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class HomeScreen : Screen, Parcelable {
|
|||
val navigator = LocalNavigator.currentOrThrow
|
||||
val scope = rememberCoroutineScope()
|
||||
val model = getScreenModel<HomeModel>()
|
||||
val onClickInstall = remember { { navigator.push(PatchOptionsScreen(supportedVersion = model.supportedVersion)) } }
|
||||
val onClickInstall = remember { { navigator.push(PatchOptionsScreen()) } }
|
||||
|
||||
// Refresh installations list when the screen changes or activity resumes
|
||||
LifecycleResumeEffect(Unit) {
|
||||
|
|
|
|||
|
|
@ -8,14 +8,10 @@ import androidx.compose.material3.*
|
|||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.koin.getScreenModel
|
||||
|
|
@ -23,7 +19,6 @@ import cafe.adriel.voyager.navigator.LocalNavigator
|
|||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.ui.components.TextDivider
|
||||
import com.aliucord.manager.ui.components.VersionDisplay
|
||||
import com.aliucord.manager.ui.components.dialogs.NetworkWarningDialog
|
||||
import com.aliucord.manager.ui.components.dialogs.UnknownSourcesPermissionDialog
|
||||
import com.aliucord.manager.ui.screens.patching.PatchingScreen
|
||||
|
|
@ -42,7 +37,6 @@ import org.koin.core.parameter.parametersOf
|
|||
@Parcelize
|
||||
class PatchOptionsScreen(
|
||||
private val prefilledOptions: PatchOptions? = null,
|
||||
private val supportedVersion: DiscordVersion = DiscordVersion.None,
|
||||
) : Screen, Parcelable {
|
||||
@IgnoredOnParcel
|
||||
override val key = "PatchOptions"
|
||||
|
|
@ -80,7 +74,6 @@ class PatchOptionsScreen(
|
|||
PatchOptionsScreenContent(
|
||||
isUpdate = prefilledOptions != null,
|
||||
isDevMode = model.isDevMode,
|
||||
supportedVersion = supportedVersion,
|
||||
|
||||
debuggable = model.debuggable,
|
||||
setDebuggable = model::changeDebuggable,
|
||||
|
|
@ -106,7 +99,6 @@ class PatchOptionsScreen(
|
|||
fun PatchOptionsScreenContent(
|
||||
isUpdate: Boolean,
|
||||
isDevMode: Boolean,
|
||||
supportedVersion: DiscordVersion,
|
||||
|
||||
debuggable: Boolean,
|
||||
setDebuggable: (Boolean) -> Unit,
|
||||
|
|
@ -204,20 +196,6 @@ fun PatchOptionsScreenContent(
|
|||
)
|
||||
}
|
||||
|
||||
VersionDisplay(
|
||||
version = supportedVersion,
|
||||
prefix = {
|
||||
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
|
||||
append(stringResource(R.string.version_supported))
|
||||
append(" ")
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.alpha(.5f)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(top = 20.dp)
|
||||
)
|
||||
|
||||
Spacer(Modifier.weight(1f))
|
||||
|
||||
FilledTonalButton(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue