2022-08-07 21:15:52 +02:00
|
|
|
import 'package:installed_apps/app_info.dart';
|
2022-08-09 01:01:06 +02:00
|
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
2022-08-07 21:15:52 +02:00
|
|
|
import 'package:revanced_manager/models/patch.dart';
|
|
|
|
import 'package:revanced_manager/services/patcher_api.dart';
|
2022-08-09 02:16:33 +02:00
|
|
|
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
|
2022-08-07 21:15:52 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
|
|
|
|
|
|
|
class PatchesSelectorViewModel extends BaseViewModel {
|
2022-08-09 02:20:50 +02:00
|
|
|
final PatcherAPI patcherAPI = locator<PatcherAPI>();
|
2022-08-09 02:16:33 +02:00
|
|
|
List<Patch>? patches = [];
|
|
|
|
List<Patch> selectedPatches = [];
|
2022-08-07 21:15:52 +02:00
|
|
|
|
2022-08-09 02:16:33 +02:00
|
|
|
Future<void> initialise() async {
|
|
|
|
await getPatches();
|
|
|
|
notifyListeners();
|
2022-08-07 21:15:52 +02:00
|
|
|
}
|
2022-08-09 01:01:06 +02:00
|
|
|
|
2022-08-09 02:16:33 +02:00
|
|
|
Future<void> getPatches() async {
|
|
|
|
AppInfo? appInfo = locator<AppSelectorViewModel>().selectedApp;
|
2022-08-09 02:20:50 +02:00
|
|
|
patches = await patcherAPI.getFilteredPatches(appInfo);
|
2022-08-07 21:15:52 +02:00
|
|
|
}
|
2022-08-09 02:16:33 +02:00
|
|
|
|
|
|
|
void selectPatches(List<Patch> patches) {}
|
2022-08-09 01:01:06 +02:00
|
|
|
}
|