mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: patch options reset button being broken
This commit is contained in:
parent
4acef776b2
commit
0b9889ea44
@ -52,7 +52,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
|
||||
var selectionWarningEnabled by mutableStateOf(true)
|
||||
private set
|
||||
|
||||
val allowIncompatiblePatches = get<PreferencesManager>().disablePatchVersionCompatCheck.getBlocking()
|
||||
val allowIncompatiblePatches =
|
||||
get<PreferencesManager>().disablePatchVersionCompatCheck.getBlocking()
|
||||
val bundlesFlow =
|
||||
get<PatchBundleRepository>().bundleInfoFlow(packageName, input.app.version)
|
||||
|
||||
@ -63,7 +64,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
|
||||
return@launch
|
||||
}
|
||||
|
||||
fun BundleInfo.hasDefaultPatches() = patchSequence(allowIncompatiblePatches).any { it.include }
|
||||
fun BundleInfo.hasDefaultPatches() =
|
||||
patchSequence(allowIncompatiblePatches).any { it.include }
|
||||
|
||||
// Don't show the warning if there are no default patches.
|
||||
selectionWarningEnabled = bundlesFlow.first().any(BundleInfo::hasDefaultPatches)
|
||||
@ -179,7 +181,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
|
||||
}
|
||||
|
||||
fun resetOptions(bundle: Int, patch: PatchInfo) {
|
||||
patchOptions[bundle]?.remove(patch.name)
|
||||
app.toast(app.getString(R.string.patch_options_reset_toast))
|
||||
patchOptions[bundle] = patchOptions[bundle]?.remove(patch.name) ?: return
|
||||
}
|
||||
|
||||
fun dismissDialogs() {
|
||||
|
@ -166,6 +166,7 @@
|
||||
<string name="unsupported_patches">Unsupported patches</string>
|
||||
<string name="universal_patches">Universal patches</string>
|
||||
<string name="patch_selection_reset_toast">Patch selection and options has been reset to recommended defaults</string>
|
||||
<string name="patch_options_reset_toast">Patch options have been reset</string>
|
||||
<string name="selection_warning_title">Stop using defaults?</string>
|
||||
<string name="selection_warning_description">You may encounter issues when not using the default patch selection and options.</string>
|
||||
<string name="selection_warning_continue_countdown">Continue (%ds)</string>
|
||||
|
Loading…
Reference in New Issue
Block a user