feat(settings): move experimental patches option to advanced

This commit is contained in:
Ax333l 2023-10-05 22:16:58 +02:00
parent 39caad18a5
commit d8392ad3eb
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23
3 changed files with 17 additions and 14 deletions

View File

@ -32,9 +32,11 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.core.content.getSystemService
import androidx.lifecycle.viewModelScope
import app.revanced.manager.R
import app.revanced.manager.ui.component.AppTopBar
import app.revanced.manager.ui.component.GroupHeader
import app.revanced.manager.ui.component.settings.BooleanItem
import app.revanced.manager.ui.viewmodel.AdvancedSettingsViewModel
import org.koin.androidx.compose.getViewModel
@ -85,6 +87,14 @@ fun AdvancedSettingsScreen(
}
)
GroupHeader(stringResource(R.string.patcher))
BooleanItem(
preference = vm.allowExperimental,
coroutineScope = vm.viewModelScope,
headline = R.string.experimental_patches,
description = R.string.experimental_patches_description
)
GroupHeader(stringResource(R.string.patch_bundles_section))
ListItem(
headlineContent = { Text(stringResource(R.string.patch_bundles_redownload)) },

View File

@ -1,7 +1,6 @@
package app.revanced.manager.ui.screen.settings
import android.os.Build
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
@ -23,7 +22,6 @@ import app.revanced.manager.ui.component.GroupHeader
import app.revanced.manager.ui.component.settings.BooleanItem
import app.revanced.manager.ui.theme.Theme
import app.revanced.manager.ui.viewmodel.SettingsViewModel
import kotlinx.coroutines.launch
import org.koin.compose.koinInject
@OptIn(ExperimentalMaterial3Api::class)
@ -82,14 +80,6 @@ fun GeneralSettingsScreen(
description = R.string.dynamic_color_description
)
}
GroupHeader(stringResource(R.string.patcher))
BooleanItem(
preference = prefs.allowExperimental,
coroutineScope = coroutineScope,
headline = R.string.experimental_patches,
description = R.string.experimental_patches_description
)
}
}
}
@ -123,10 +113,12 @@ private fun ThemePicker(
}
},
confirmButton = {
Button(onClick = {
onConfirm(selectedTheme)
onDismiss()
}) {
Button(
onClick = {
onConfirm(selectedTheme)
onDismiss()
}
) {
Text(stringResource(R.string.apply))
}
}

View File

@ -17,6 +17,7 @@ class AdvancedSettingsViewModel(
private val patchBundleRepository: PatchBundleRepository
) : ViewModel() {
val apiUrl = prefs.api
val allowExperimental = prefs.allowExperimental
fun setApiUrl(value: String) = viewModelScope.launch(Dispatchers.Default) {
if (value == apiUrl.get()) return@launch