diff --git a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart index 173c1f5376..6b6d7d2439 100644 --- a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart +++ b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart @@ -25,6 +25,9 @@ class PatchesSelectorViewModel extends BaseViewModel { locator().selectedPatches; PatchedApplication? selectedApp = locator().selectedApp; String? patchesVersion = ''; + + Set savedPatchNames = {}; + bool isDefaultPatchesRepo() { return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches'; } @@ -48,6 +51,9 @@ class PatchesSelectorViewModel extends BaseViewModel { }); currentSelection.clear(); currentSelection.addAll(selectedPatches); + + savedPatchNames = _managerAPI.getSavedPatches(selectedApp!.packageName).map((p) => p.name).toSet(); + notifyListeners(); } @@ -281,13 +287,10 @@ class PatchesSelectorViewModel extends BaseViewModel { } bool isPatchNew(Patch patch) { - final List savedPatches = - _managerAPI.getSavedPatches(selectedApp!.packageName); - if (savedPatches.isEmpty) { + if (savedPatchNames.isEmpty) { return false; } else { - return !savedPatches - .any((p) => p.getSimpleName() == patch.getSimpleName()); + return !savedPatchNames.contains(patch.name); } }