Revert "feat: filter apps by patch count"

This reverts commit d78868b462.
This commit is contained in:
Ushie 2022-12-14 13:19:59 +03:00
parent 4505f10e50
commit d7624e5e1f
2 changed files with 5 additions and 6 deletions

View File

@ -94,14 +94,15 @@ class PatcherAPI {
return filteredApps;
}
List<Patch> getFilteredPatches(String packageName) {
Future<List<Patch>> getFilteredPatches(String packageName) async {
List<Patch> filteredPatches = [];
_patches.forEach((patch) {
if (patch.compatiblePackages.isEmpty) {
filteredPatches.add(patch);
} else {
if (!patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == packageName)) {
patch.compatiblePackages.any((pack) => pack.name == packageName)
) {
filteredPatches.add(patch);
}
}

View File

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:device_apps/device_apps.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/patcher_api.dart';
@ -21,10 +22,7 @@ class AppSelectorViewModel extends BaseViewModel {
Future<void> initialize() async {
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
apps.sort(((a, b) => _patcherAPI
.getFilteredPatches(b.packageName)
.length
.compareTo(_patcherAPI.getFilteredPatches(a.packageName).length)));
apps.sort((a, b) => a.appName.compareTo(b.appName));
noApps = apps.isEmpty;
notifyListeners();
}