diff --git a/lib/ui/widgets/patchesSelectorView/patch_item.dart b/lib/ui/widgets/patchesSelectorView/patch_item.dart index 1b14bbb663..267fb1c325 100644 --- a/lib/ui/widgets/patchesSelectorView/patch_item.dart +++ b/lib/ui/widgets/patchesSelectorView/patch_item.dart @@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/toast.dart'; +import 'package:revanced_manager/ui/widgets/settingsView/settings_experimental_patches.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; @@ -116,7 +117,7 @@ class _PatchItemState extends State { value: widget.isSelected, activeColor: Theme.of(context).colorScheme.primary, checkColor: - Theme.of(context).colorScheme.secondaryContainer, + Theme.of(context).colorScheme.secondaryContainer, side: BorderSide( width: 2.0, color: Theme.of(context).colorScheme.primary, @@ -127,11 +128,16 @@ class _PatchItemState extends State { !widget._managerAPI .areExperimentalPatchesEnabled()) { widget.isSelected = false; - widget.toast.showBottom( - 'patchItem.unsupportedPatchVersion'); + widget.toast + .showBottom('patchItem.unsupportedPatchVersion'); } else { widget.isSelected = newValue!; } + if (widget.isUnsupported && + widget.isSelected && + !selectedUnsupportedPatches.contains(widget.name)) { + selectedUnsupportedPatches.add(widget.name); + } }); widget.onChanged(widget.isSelected); }, diff --git a/lib/ui/widgets/settingsView/settings_experimental_patches.dart b/lib/ui/widgets/settingsView/settings_experimental_patches.dart index b5bf97db40..79f5e7fe82 100644 --- a/lib/ui/widgets/settingsView/settings_experimental_patches.dart +++ b/lib/ui/widgets/settingsView/settings_experimental_patches.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_i18n/widgets/I18nText.dart'; +import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart'; import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; class SExperimentalPatches extends StatefulWidget { @@ -10,6 +11,7 @@ class SExperimentalPatches extends StatefulWidget { } final _settingsViewModel = SettingsViewModel(); +final List selectedUnsupportedPatches = []; class _SExperimentalPatchesState extends State { @override @@ -32,6 +34,12 @@ class _SExperimentalPatchesState extends State { setState(() { _settingsViewModel.useExperimentalPatches(value); }); + if(!value) { + for (final patch in selectedUnsupportedPatches) { + PatchesSelectorViewModel().selectedPatches.removeWhere((element) => patch == element.name); + } + selectedUnsupportedPatches.clear(); + } }, ); }