mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: use provided patches.json to load patches
This commit is contained in:
@ -27,7 +27,6 @@ class HomeViewModel extends BaseViewModel {
|
||||
|
||||
Future<void> initialize() async {
|
||||
await _getPatchedApps();
|
||||
await _patcherAPI.loadPatches();
|
||||
await flutterLocalNotificationsPlugin.initialize(
|
||||
const InitializationSettings(
|
||||
android: AndroidInitializationSettings('ic_notification'),
|
||||
@ -45,7 +44,7 @@ class HomeViewModel extends BaseViewModel {
|
||||
void navigateToPatcher(PatchedApplication app) async {
|
||||
locator<PatcherViewModel>().selectedApp = app;
|
||||
locator<PatcherViewModel>().selectedPatches =
|
||||
await _patcherAPI.getAppliedPatches(app);
|
||||
await _patcherAPI.getAppliedPatches(app.appliedPatches);
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
locator<MainViewModel>().setIndex(1);
|
||||
}
|
||||
|
@ -108,22 +108,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
update(0.0, '', 'Creating working directory');
|
||||
bool mergeIntegrations = false;
|
||||
bool resourcePatching = false;
|
||||
if (_app!.packageName == 'com.google.android.youtube') {
|
||||
mergeIntegrations = true;
|
||||
resourcePatching = true;
|
||||
} else if (_app!.packageName ==
|
||||
'com.google.android.apps.youtube.music') {
|
||||
resourcePatching = true;
|
||||
}
|
||||
await _patcherAPI.mergeIntegrations(mergeIntegrations);
|
||||
await _patcherAPI.runPatcher(
|
||||
apkFilePath,
|
||||
_patches,
|
||||
mergeIntegrations,
|
||||
resourcePatching,
|
||||
);
|
||||
await _patcherAPI.runPatcher(_app!.packageName, apkFilePath, _patches);
|
||||
} on Exception {
|
||||
update(1.0, 'Aborting...', 'An error occurred! Aborting');
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
.getQueriedPatches(_query)
|
||||
.map((patch) => PatchItem(
|
||||
name: patch.name,
|
||||
simpleName: patch.simpleName,
|
||||
simpleName: patch.getSimpleName(),
|
||||
version: patch.version,
|
||||
description: patch.description,
|
||||
isSelected: model.isSelected(patch),
|
||||
|
@ -12,11 +12,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
|
||||
Future<void> initialize() async {
|
||||
patches.addAll(await _patcherAPI.getFilteredPatches(
|
||||
locator<PatcherViewModel>().selectedApp,
|
||||
locator<PatcherViewModel>().selectedApp!.packageName,
|
||||
));
|
||||
patches.sort((a, b) => a.simpleName.compareTo(b.simpleName));
|
||||
patches.sort((a, b) => a.name.compareTo(b.name));
|
||||
for (Patch p in patches) {
|
||||
if (p.include) {
|
||||
if (!p.excluded) {
|
||||
selectedPatches.add(p);
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
.where((patch) =>
|
||||
query.isEmpty ||
|
||||
query.length < 2 ||
|
||||
patch.simpleName.toLowerCase().contains(
|
||||
patch.name.toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
))
|
||||
.toList();
|
||||
|
@ -72,7 +72,7 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
String _getPatchesSelection() {
|
||||
String text = '';
|
||||
for (Patch p in locator<PatcherViewModel>().selectedPatches) {
|
||||
text += '${p.simpleName} (v${p.version})\n';
|
||||
text += '${p.getSimpleName()} (v${p.version})\n';
|
||||
}
|
||||
return text.substring(0, text.length - 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user