mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: use default include property from patches
This commit is contained in:
parent
8434211b61
commit
e142a5aa19
@ -13,6 +13,7 @@ import app.revanced.patcher.PatcherOptions
|
|||||||
import app.revanced.patcher.data.Data
|
import app.revanced.patcher.data.Data
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.include
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.version
|
import app.revanced.patcher.extensions.PatchExtensions.version
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
@ -149,7 +150,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
) {
|
) {
|
||||||
Thread(
|
Thread(
|
||||||
Runnable {
|
Runnable {
|
||||||
val filteredPatches = mutableListOf<Map<String, String?>>()
|
val filteredPatches = mutableListOf<Map<String, Any?>>()
|
||||||
patches.forEach patch@{ patch ->
|
patches.forEach patch@{ patch ->
|
||||||
patch.compatiblePackages?.forEach { pkg ->
|
patch.compatiblePackages?.forEach { pkg ->
|
||||||
if (pkg.name == targetPackage &&
|
if (pkg.name == targetPackage &&
|
||||||
@ -157,10 +158,11 @@ class MainActivity : FlutterActivity() {
|
|||||||
pkg.versions.isNotEmpty() ||
|
pkg.versions.isNotEmpty() ||
|
||||||
pkg.versions.contains(targetVersion))
|
pkg.versions.contains(targetVersion))
|
||||||
) {
|
) {
|
||||||
var p = mutableMapOf<String, String?>()
|
var p = mutableMapOf<String, Any?>()
|
||||||
p.put("name", patch.patchName)
|
p.put("name", patch.patchName)
|
||||||
p.put("version", patch.version)
|
p.put("version", patch.version)
|
||||||
p.put("description", patch.description)
|
p.put("description", patch.description)
|
||||||
|
p.put("include", patch.include)
|
||||||
filteredPatches.add(p)
|
filteredPatches.add(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@ class Patch {
|
|||||||
final String simpleName;
|
final String simpleName;
|
||||||
final String version;
|
final String version;
|
||||||
final String description;
|
final String description;
|
||||||
|
final bool include;
|
||||||
|
|
||||||
Patch({
|
Patch({
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.simpleName,
|
required this.simpleName,
|
||||||
required this.version,
|
required this.version,
|
||||||
required this.description,
|
required this.description,
|
||||||
|
required this.include,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ class PatcherAPI {
|
|||||||
.toTitleCase(),
|
.toTitleCase(),
|
||||||
version: patch['version'] ?? '?.?.?',
|
version: patch['version'] ?? '?.?.?',
|
||||||
description: patch['description'] ?? 'N/A',
|
description: patch['description'] ?? 'N/A',
|
||||||
|
include: patch['include'] ?? true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -150,6 +151,7 @@ class PatcherAPI {
|
|||||||
.toTitleCase(),
|
.toTitleCase(),
|
||||||
version: patch['version'] ?? '?.?.?',
|
version: patch['version'] ?? '?.?.?',
|
||||||
description: patch['description'] ?? 'N/A',
|
description: patch['description'] ?? 'N/A',
|
||||||
|
include: patch['include'] ?? true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/app/app.router.dart';
|
|
||||||
import 'package:revanced_manager/main_viewmodel.dart';
|
import 'package:revanced_manager/main_viewmodel.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
@ -17,11 +16,9 @@ import 'package:revanced_manager/services/patcher_api.dart';
|
|||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class HomeViewModel extends BaseViewModel {
|
class HomeViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
|
||||||
final ManagerAPI _managerAPI = ManagerAPI();
|
final ManagerAPI _managerAPI = ManagerAPI();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
|
@ -14,6 +14,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
patches.addAll(await _patcherAPI.getFilteredPatches(
|
patches.addAll(await _patcherAPI.getFilteredPatches(
|
||||||
locator<PatcherViewModel>().selectedApp,
|
locator<PatcherViewModel>().selectedApp,
|
||||||
));
|
));
|
||||||
|
for (Patch p in patches) {
|
||||||
|
if (p.include) {
|
||||||
|
selectedPatches.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user