Skip to content

Commit

Permalink
fix: Select previously applied patches when loading patch selection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAabedKhan authored Jun 29, 2024
1 parent 232b702 commit 7ef8f04
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/ui/views/patches_selector/patches_selector_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,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(
Expand Down

0 comments on commit 7ef8f04

Please sign in to comment.