fix: use original package name to load patches.

This commit is contained in:
Aunali321 2022-10-10 19:02:42 +05:30
parent 3ab5d12f3e
commit b550016681
2 changed files with 3 additions and 8 deletions

View File

@ -72,14 +72,10 @@ class PatcherAPI {
}
Future<List<Patch>> getFilteredPatches(String packageName) async {
String newPackageName = packageName.replaceFirst(
'app.revanced.',
'com.google.',
);
return _patches
.where((patch) =>
!patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == newPackageName))
patch.compatiblePackages.any((pack) => pack.name == packageName))
.toList();
}

View File

@ -17,7 +17,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
Future<void> initialize() async {
patches.addAll(await _patcherAPI.getFilteredPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
locator<PatcherViewModel>().selectedApp!.originalPackageName,
));
patches.sort((a, b) => a.name.compareTo(b.name));
notifyListeners();
@ -74,8 +74,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
query.isEmpty ||
query.length < 2 ||
patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.getSimpleName().toLowerCase().contains(query.toLowerCase())
)
patch.getSimpleName().toLowerCase().contains(query.toLowerCase()))
.toList();
}