From d7624e5e1fd00dce039a18c4b86114d800c929b1 Mon Sep 17 00:00:00 2001 From: Ushie Date: Wed, 14 Dec 2022 13:19:59 +0300 Subject: [PATCH] Revert "feat: filter apps by patch count" This reverts commit d78868b4625747b8c30e278d5a6a8fbb49bdc19d. --- lib/services/patcher_api.dart | 5 +++-- lib/ui/views/app_selector/app_selector_viewmodel.dart | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 134f8053..c0f7d70e 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -94,14 +94,15 @@ class PatcherAPI { return filteredApps; } - List getFilteredPatches(String packageName) { + Future> getFilteredPatches(String packageName) async { List 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); } } diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart index 982b4447..1803905c 100644 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ b/lib/ui/views/app_selector/app_selector_viewmodel.dart @@ -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 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(); }