From 9f3a30d9f2d06f00250623142a7e2e2c119d4aaa Mon Sep 17 00:00:00 2001 From: Alberto Ponces Date: Wed, 14 Sep 2022 23:30:02 +0100 Subject: [PATCH] feat: Request root and install permissions as soon as possible --- lib/ui/views/navigation/navigation_viewmodel.dart | 6 ++++++ pubspec.yaml | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/ui/views/navigation/navigation_viewmodel.dart b/lib/ui/views/navigation/navigation_viewmodel.dart index 684354cd03..5434b78a55 100644 --- a/lib/ui/views/navigation/navigation_viewmodel.dart +++ b/lib/ui/views/navigation/navigation_viewmodel.dart @@ -1,7 +1,11 @@ // ignore_for_file: use_build_context_synchronously +import 'package:app_installer/app_installer.dart'; +import 'package:device_apps/device_apps.dart'; import 'package:dynamic_themes/dynamic_themes.dart'; import 'package:flutter/material.dart'; import 'package:injectable/injectable.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:revanced_manager/services/root_api.dart'; import 'package:revanced_manager/ui/views/home/home_view.dart'; import 'package:revanced_manager/ui/views/patcher/patcher_view.dart'; import 'package:revanced_manager/ui/views/settings/settings_view.dart'; @@ -21,6 +25,8 @@ class NavigationViewModel extends IndexTrackingViewModel { DynamicTheme.of(context)!.setTheme(1); } } + RootAPI().hasRootPermissions(); + Permission.requestInstallPackages.request(); } Widget getViewForIndex(int index) { diff --git a/pubspec.yaml b/pubspec.yaml index ebffaf0377..99efc7038e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,6 +49,7 @@ dependencies: ref: feature/nullSafe package_info_plus: ^1.4.3+1 path_provider: ^2.0.11 + permission_handler: ^10.0.0 pull_to_refresh: ^2.0.0 root: ^2.0.2 share_extend: ^2.0.0