From 25ceb9dacbdaedd66a370c0e61677c83235d2f42 Mon Sep 17 00:00:00 2001 From: aAbed <39409020+TheAabedKhan@users.noreply.github.com> Date: Fri, 4 Aug 2023 19:36:15 +0545 Subject: [PATCH 1/3] fix(patch-item): hide universal patches if not enabled --- .../patches_selector/patches_selector_viewmodel.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart index ca776ccf7c..f5419c8210 100644 --- a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart +++ b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart @@ -81,7 +81,7 @@ class PatchesSelectorViewModel extends BaseViewModel { } List getQueriedPatches(String query) { - return patches + final List patch = return patches .where( (patch) => query.isEmpty || @@ -90,6 +90,13 @@ class PatchesSelectorViewModel extends BaseViewModel { patch.getSimpleName().toLowerCase().contains(query.toLowerCase()), ) .toList(); + if (_managerAPI.areUniversalPatchesEnabled()) { + return patch; + } else { + return patch + .where((patch) => patch.compatiblePackages.isNotEmpty) + .toList(); + } } String getAppVersion() { From 48f3c3549c6c5816373fa3b13327ae617f9aa00e Mon Sep 17 00:00:00 2001 From: aAbed <39409020+TheAabedKhan@users.noreply.github.com> Date: Fri, 4 Aug 2023 19:43:14 +0545 Subject: [PATCH 2/3] refactor: logic issue --- lib/ui/views/patches_selector/patches_selector_viewmodel.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart index f5419c8210..b480f51cf5 100644 --- a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart +++ b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart @@ -81,7 +81,7 @@ class PatchesSelectorViewModel extends BaseViewModel { } List getQueriedPatches(String query) { - final List patch = return patches + final List patch = patches .where( (patch) => query.isEmpty || From 912245ba481ff1b00aa9cd1d7fc6c582f544eba8 Mon Sep 17 00:00:00 2001 From: aAbed <39409020+TheAabedKhan@users.noreply.github.com> Date: Sat, 5 Aug 2023 18:35:48 +0545 Subject: [PATCH 3/3] fix: patches count not changing --- lib/services/patcher_api.dart | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 568e6183ce..df99db8ba1 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -103,16 +103,20 @@ class PatcherAPI { } List getFilteredPatches(String packageName) { - if (!filteredPatches.keys.contains(packageName)) { - final List patches = _patches - .where( - (patch) => - patch.compatiblePackages.isEmpty || - !patch.name.contains('settings') && - patch.compatiblePackages - .any((pack) => pack.name == packageName), - ) + final List patches = _patches + .where( + (patch) => + patch.compatiblePackages.isEmpty || + !patch.name.contains('settings') && + patch.compatiblePackages + .any((pack) => pack.name == packageName), + ) + .toList(); + if (!_managerAPI.areUniversalPatchesEnabled()) { + filteredPatches[packageName] = patches + .where((patch) => patch.compatiblePackages.isNotEmpty) .toList(); + } else { filteredPatches[packageName] = patches; } return filteredPatches[packageName];