Skip to content

Commit

Permalink
feat(settings): move experimental patches option to advanced
Browse files Browse the repository at this point in the history
  • Loading branch information
Axelen123 committed Oct 5, 2023
1 parent 39caad1 commit d8392ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)) },
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
)
}
}
}
Expand Down Expand Up @@ -123,10 +113,12 @@ private fun ThemePicker(
}
},
confirmButton = {
Button(onClick = {
onConfirm(selectedTheme)
onDismiss()
}) {
Button(
onClick = {
onConfirm(selectedTheme)
onDismiss()
}
) {
Text(stringResource(R.string.apply))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d8392ad

Please sign in to comment.