mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: experimental patches stay selected when toggled off (#946)
This commit is contained in:
parent
d051ae576b
commit
716a30bf7b
@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
|||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/toast.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_card.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
|
|
||||||
@ -127,11 +128,16 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
!widget._managerAPI
|
!widget._managerAPI
|
||||||
.areExperimentalPatchesEnabled()) {
|
.areExperimentalPatchesEnabled()) {
|
||||||
widget.isSelected = false;
|
widget.isSelected = false;
|
||||||
widget.toast.showBottom(
|
widget.toast
|
||||||
'patchItem.unsupportedPatchVersion');
|
.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
} else {
|
} else {
|
||||||
widget.isSelected = newValue!;
|
widget.isSelected = newValue!;
|
||||||
}
|
}
|
||||||
|
if (widget.isUnsupported &&
|
||||||
|
widget.isSelected &&
|
||||||
|
!selectedUnsupportedPatches.contains(widget.name)) {
|
||||||
|
selectedUnsupportedPatches.add(widget.name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
widget.onChanged(widget.isSelected);
|
widget.onChanged(widget.isSelected);
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/widgets/I18nText.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';
|
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
||||||
|
|
||||||
class SExperimentalPatches extends StatefulWidget {
|
class SExperimentalPatches extends StatefulWidget {
|
||||||
@ -10,6 +11,7 @@ class SExperimentalPatches extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final _settingsViewModel = SettingsViewModel();
|
final _settingsViewModel = SettingsViewModel();
|
||||||
|
final List<String> selectedUnsupportedPatches = [];
|
||||||
|
|
||||||
class _SExperimentalPatchesState extends State<SExperimentalPatches> {
|
class _SExperimentalPatchesState extends State<SExperimentalPatches> {
|
||||||
@override
|
@override
|
||||||
@ -32,6 +34,12 @@ class _SExperimentalPatchesState extends State<SExperimentalPatches> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_settingsViewModel.useExperimentalPatches(value);
|
_settingsViewModel.useExperimentalPatches(value);
|
||||||
});
|
});
|
||||||
|
if(!value) {
|
||||||
|
for (final patch in selectedUnsupportedPatches) {
|
||||||
|
PatchesSelectorViewModel().selectedPatches.removeWhere((element) => patch == element.name);
|
||||||
|
}
|
||||||
|
selectedUnsupportedPatches.clear();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user