fix: Previously applied patches not selected when loading patch selection

This commit is contained in:
aAbed 2024-04-13 09:27:37 +05:45 committed by GitHub
parent 5e6cc86c7e
commit a5c9548b4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -302,9 +302,16 @@ class PatchesSelectorViewModel extends BaseViewModel {
Future<void> loadSelectedPatches(BuildContext context) async {
if (_managerAPI.isPatchesChangeEnabled()) {
final List<String> selectedPatches = await _managerAPI.getSelectedPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
);
final List<String>? appliedPatches = _managerAPI
.getPatchedApps()
.firstWhereOrNull(
(app) => app.packageName == selectedApp!.packageName,
)
?.appliedPatches;
final List<String> selectedPatches = appliedPatches ??
await _managerAPI.getSelectedPatches(
selectedApp!.packageName,
);
if (selectedPatches.isNotEmpty) {
this.selectedPatches.clear();
this.selectedPatches.addAll(