fix(patch-item): hide universal patches if not enabled (#1087)

This commit is contained in:
aAbed 2023-08-05 19:04:36 +05:45 committed by GitHub
parent 2f471b3de4
commit 5346f6e1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 10 deletions

View File

@ -103,7 +103,6 @@ class PatcherAPI {
}
List<Patch> getFilteredPatches(String packageName) {
if (!filteredPatches.keys.contains(packageName)) {
final List<Patch> patches = _patches
.where(
(patch) =>
@ -113,6 +112,11 @@ class PatcherAPI {
.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];

View File

@ -81,7 +81,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
}
List<Patch> getQueriedPatches(String query) {
return patches
final List<Patch> patch = 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() {