Skip to content

Commit e1647fd

Browse files
Axelen123oSumAtrIX
authored andcommitted
fix: patch options reset button being broken
1 parent 0b362e3 commit e1647fd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/app/revanced/manager/ui/viewmodel/PatchesSelectorViewModel.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
5252
var selectionWarningEnabled by mutableStateOf(true)
5353
private set
5454

55-
val allowIncompatiblePatches = get<PreferencesManager>().disablePatchVersionCompatCheck.getBlocking()
55+
val allowIncompatiblePatches =
56+
get<PreferencesManager>().disablePatchVersionCompatCheck.getBlocking()
5657
val bundlesFlow =
5758
get<PatchBundleRepository>().bundleInfoFlow(packageName, input.app.version)
5859

@@ -63,7 +64,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
6364
return@launch
6465
}
6566

66-
fun BundleInfo.hasDefaultPatches() = patchSequence(allowIncompatiblePatches).any { it.include }
67+
fun BundleInfo.hasDefaultPatches() =
68+
patchSequence(allowIncompatiblePatches).any { it.include }
6769

6870
// Don't show the warning if there are no default patches.
6971
selectionWarningEnabled = bundlesFlow.first().any(BundleInfo::hasDefaultPatches)
@@ -179,7 +181,8 @@ class PatchesSelectorViewModel(input: Params) : ViewModel(), KoinComponent {
179181
}
180182

181183
fun resetOptions(bundle: Int, patch: PatchInfo) {
182-
patchOptions[bundle]?.remove(patch.name)
184+
app.toast(app.getString(R.string.patch_options_reset_toast))
185+
patchOptions[bundle] = patchOptions[bundle]?.remove(patch.name) ?: return
183186
}
184187

185188
fun dismissDialogs() {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
<string name="unsupported_patches">Unsupported patches</string>
167167
<string name="universal_patches">Universal patches</string>
168168
<string name="patch_selection_reset_toast">Patch selection and options has been reset to recommended defaults</string>
169+
<string name="patch_options_reset_toast">Patch options have been reset</string>
169170
<string name="selection_warning_title">Stop using defaults?</string>
170171
<string name="selection_warning_description">You may encounter issues when not using the default patch selection and options.</string>
171172
<string name="selection_warning_continue_countdown">Continue (%ds)</string>

0 commit comments

Comments
 (0)