From f0f934f6a1617321d07b036ea6a298a7f4c45481 Mon Sep 17 00:00:00 2001 From: Alberto Ponces Date: Thu, 22 Sep 2022 14:01:05 +0100 Subject: [PATCH] fix: Prevent printing of denied root permission exceptions for unrooted users --- lib/services/root_api.dart | 8 ++++++-- pubspec.yaml | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/services/root_api.dart b/lib/services/root_api.dart index 68a8cc40..60ba4598 100644 --- a/lib/services/root_api.dart +++ b/lib/services/root_api.dart @@ -7,8 +7,12 @@ class RootAPI { Future hasRootPermissions() async { try { - bool? isRooted = await Root.isRooted(); - return isRooted != null && isRooted; + bool? isRooted = await Root.isRootAvailable(); + if (isRooted != null && isRooted) { + isRooted = await Root.isRooted(); + return isRooted != null && isRooted; + } + return false; } on Exception { return false; } diff --git a/pubspec.yaml b/pubspec.yaml index d0d23120..de64c8ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,10 @@ dependencies: path_provider: ^2.0.11 permission_handler: ^10.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 shared_preferences: ^2.0.15 skeletons: ^0.0.3