mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-25 20:11:04 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19f990c564 | ||
|
|
62467007b2 | ||
|
|
d7624e5e1f |
@@ -94,14 +94,15 @@ class PatcherAPI {
|
|||||||
return filteredApps;
|
return filteredApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Patch> getFilteredPatches(String packageName) {
|
Future<List<Patch>> getFilteredPatches(String packageName) async {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
name: app.appName,
|
name: app.appName,
|
||||||
pkgName: app.packageName,
|
pkgName: app.packageName,
|
||||||
icon: app.icon,
|
icon: app.icon,
|
||||||
patchesCount: model.patchesCount(app.packageName),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.selectApp(app);
|
model.selectApp(app);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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';
|
||||||
@@ -15,16 +16,10 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final List<ApplicationWithIcon> apps = [];
|
final List<ApplicationWithIcon> apps = [];
|
||||||
bool noApps = false;
|
bool noApps = false;
|
||||||
int patchesCount(String packageName) {
|
|
||||||
return _patcherAPI.getFilteredPatches(packageName).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
||||||
apps.sort(((a, b) => _patcherAPI
|
apps.sort((a, b) => a.appName.compareTo(b.appName));
|
||||||
.getFilteredPatches(b.packageName)
|
|
||||||
.length
|
|
||||||
.compareTo(_patcherAPI.getFilteredPatches(a.packageName).length)));
|
|
||||||
noApps = apps.isEmpty;
|
noApps = apps.isEmpty;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ class InstalledAppItem extends StatefulWidget {
|
|||||||
final String name;
|
final String name;
|
||||||
final String pkgName;
|
final String pkgName;
|
||||||
final Uint8List icon;
|
final Uint8List icon;
|
||||||
final int patchesCount;
|
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
|
|
||||||
const InstalledAppItem({
|
const InstalledAppItem({
|
||||||
@@ -14,7 +13,6 @@ class InstalledAppItem extends StatefulWidget {
|
|||||||
required this.name,
|
required this.name,
|
||||||
required this.pkgName,
|
required this.pkgName,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.patchesCount,
|
|
||||||
this.onTap,
|
this.onTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@@ -47,29 +45,14 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Text(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
widget.name,
|
||||||
children: <Widget>[
|
maxLines: 2,
|
||||||
Text(
|
overflow: TextOverflow.visible,
|
||||||
widget.name,
|
style: const TextStyle(
|
||||||
maxLines: 2,
|
fontSize: 16,
|
||||||
overflow: TextOverflow.visible,
|
fontWeight: FontWeight.w500,
|
||||||
style: const TextStyle(
|
),
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
widget.patchesCount == 1
|
|
||||||
? "${widget.patchesCount} patch"
|
|
||||||
: "${widget.patchesCount} patches",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 8,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(widget.pkgName),
|
Text(widget.pkgName),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.49+49
|
version: 0.0.50+50
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.5 <3.0.0"
|
sdk: ">=2.17.5 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user