mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
fix: show patcher when clicking on the patch button
This commit is contained in:
parent
b327926219
commit
8434211b61
6 changed files with 16 additions and 11 deletions
|
@ -1,9 +1,11 @@
|
|||
import 'package:revanced_manager/main.dart';
|
||||
import 'package:revanced_manager/main_viewmodel.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
|
||||
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/installer/installer_view.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_view.dart';
|
||||
import 'package:revanced_manager/ui/views/root_checker/root_checker_view.dart';
|
||||
|
@ -15,6 +17,7 @@ import 'package:stacked_themes/stacked_themes.dart';
|
|||
@StackedApp(
|
||||
routes: [
|
||||
MaterialRoute(page: Navigation),
|
||||
MaterialRoute(page: PatcherView),
|
||||
MaterialRoute(page: AppSelectorView),
|
||||
MaterialRoute(page: PatchesSelectorView),
|
||||
MaterialRoute(page: InstallerView),
|
||||
|
@ -23,14 +26,15 @@ import 'package:stacked_themes/stacked_themes.dart';
|
|||
MaterialRoute(page: RootCheckerView),
|
||||
],
|
||||
dependencies: [
|
||||
LazySingleton(classType: NavigationService),
|
||||
LazySingleton(classType: PatcherAPI),
|
||||
LazySingleton(classType: MainViewModel),
|
||||
LazySingleton(classType: HomeViewModel),
|
||||
LazySingleton(classType: PatcherViewModel),
|
||||
LazySingleton(classType: NavigationService),
|
||||
LazySingleton(
|
||||
classType: ThemeService,
|
||||
resolveUsing: ThemeService.getInstance,
|
||||
),
|
||||
LazySingleton(classType: PatcherAPI),
|
||||
],
|
||||
)
|
||||
class AppSetup {}
|
||||
|
|
|
@ -85,7 +85,7 @@ class Navigation extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<MainViewModel>.reactive(
|
||||
viewModelBuilder: () => MainViewModel(),
|
||||
viewModelBuilder: () => locator<MainViewModel>(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
body: getViewForIndex(model.currentIndex),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:injectable/injectable.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class MainViewModel extends IndexTrackingViewModel {
|
||||
|
||||
|
||||
}
|
||||
@lazySingleton
|
||||
class MainViewModel extends IndexTrackingViewModel {}
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'package:fluttertoast/fluttertoast.dart';
|
|||
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/main_viewmodel.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
|
@ -42,11 +43,12 @@ class HomeViewModel extends BaseViewModel {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
void navigateToInstaller(PatchedApplication app) async {
|
||||
void navigateToPatcher(PatchedApplication app) async {
|
||||
locator<PatcherViewModel>().selectedApp = app;
|
||||
locator<PatcherViewModel>().selectedPatches =
|
||||
await _patcherAPI.getAppliedPatches(app);
|
||||
_navigationService.navigateTo(Routes.installerView);
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
locator<MainViewModel>().setIndex(1);
|
||||
}
|
||||
|
||||
Future<List<PatchedApplication>> getPatchedApps(bool isUpdatable) async {
|
||||
|
|
|
@ -38,7 +38,7 @@ class AvailableUpdatesCard extends StatelessWidget {
|
|||
changelog: snapshot2.data!,
|
||||
isUpdatableApp: true,
|
||||
onPressed: () =>
|
||||
locator<HomeViewModel>().navigateToInstaller(
|
||||
locator<HomeViewModel>().navigateToPatcher(
|
||||
snapshot.data![index],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -38,7 +38,7 @@ class InstalledAppsCard extends StatelessWidget {
|
|||
changelog: snapshot2.data!,
|
||||
isUpdatableApp: false,
|
||||
onPressed: () =>
|
||||
locator<HomeViewModel>().navigateToInstaller(
|
||||
locator<HomeViewModel>().navigateToPatcher(
|
||||
snapshot.data![index],
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue