fix: Prevent printing of denied root permission exceptions for unrooted users

This commit is contained in:
Alberto Ponces 2022-09-22 14:01:05 +01:00
parent 3d25655851
commit f0f934f6a1
2 changed files with 10 additions and 3 deletions

View File

@ -7,8 +7,12 @@ class RootAPI {
Future<bool> hasRootPermissions() async { Future<bool> hasRootPermissions() async {
try { try {
bool? isRooted = await Root.isRooted(); bool? isRooted = await Root.isRootAvailable();
return isRooted != null && isRooted; if (isRooted != null && isRooted) {
isRooted = await Root.isRooted();
return isRooted != null && isRooted;
}
return false;
} on Exception { } on Exception {
return false; return false;
} }

View File

@ -54,7 +54,10 @@ dependencies:
path_provider: ^2.0.11 path_provider: ^2.0.11
permission_handler: ^10.0.0 permission_handler: ^10.0.0
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
root: ^2.0.2 root:
git:
url: https://github.com/gokul1630/root
ref: main
share_extend: ^2.0.0 share_extend: ^2.0.0
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
skeletons: ^0.0.3 skeletons: ^0.0.3