mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: filter apps by patch count
This commit is contained in:
parent
01a681ad00
commit
d78868b462
@ -94,15 +94,14 @@ class PatcherAPI {
|
|||||||
return filteredApps;
|
return filteredApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Patch>> getFilteredPatches(String packageName) async {
|
List<Patch> getFilteredPatches(String packageName) {
|
||||||
List<Patch> filteredPatches = [];
|
List<Patch> filteredPatches = [];
|
||||||
_patches.forEach((patch) {
|
_patches.forEach((patch) {
|
||||||
if (patch.compatiblePackages.isEmpty) {
|
if (patch.compatiblePackages.isEmpty) {
|
||||||
filteredPatches.add(patch);
|
filteredPatches.add(patch);
|
||||||
} else {
|
} else {
|
||||||
if (!patch.name.contains('settings') &&
|
if (!patch.name.contains('settings') &&
|
||||||
patch.compatiblePackages.any((pack) => pack.name == packageName)
|
patch.compatiblePackages.any((pack) => pack.name == packageName)) {
|
||||||
) {
|
|
||||||
filteredPatches.add(patch);
|
filteredPatches.add(patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ import 'dart:io';
|
|||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
@ -19,7 +18,10 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
||||||
apps.sort((a, b) => a.appName.compareTo(b.appName));
|
apps.sort(((a, b) => _patcherAPI
|
||||||
|
.getFilteredPatches(b.packageName)
|
||||||
|
.length
|
||||||
|
.compareTo(_patcherAPI.getFilteredPatches(a.packageName).length)));
|
||||||
noApps = apps.isEmpty;
|
noApps = apps.isEmpty;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user