mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
feat: call Installer through Home View
This commit is contained in:
@ -1,17 +1,28 @@
|
||||
import 'dart:convert';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/app/app.router.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/github_api.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
@lazySingleton
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
final _navigationService = locator<NavigationService>();
|
||||
final GithubAPI githubAPI = GithubAPI();
|
||||
final PatcherAPI patcherAPI = locator<PatcherAPI>();
|
||||
bool showUpdatableApps = true;
|
||||
|
||||
Future<void> initialize() async {
|
||||
await patcherAPI.loadPatches();
|
||||
}
|
||||
|
||||
void toggleUpdatableApps(bool value) {
|
||||
showUpdatableApps = value;
|
||||
notifyListeners();
|
||||
@ -20,6 +31,13 @@ class HomeViewModel extends BaseViewModel {
|
||||
Future downloadPatches() => locator<ManagerAPI>().downloadPatches();
|
||||
Future downloadIntegrations() => locator<ManagerAPI>().downloadIntegrations();
|
||||
|
||||
void navigateToInstaller(PatchedApplication app) async {
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches =
|
||||
await patcherAPI.getAppliedPatches(app);
|
||||
_navigationService.navigateTo(Routes.installerView);
|
||||
}
|
||||
|
||||
Future<List<PatchedApplication>> getPatchedApps(bool isUpdatable) async {
|
||||
List<PatchedApplication> list = [];
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
Reference in New Issue
Block a user