Skip to content

Commit

Permalink
fix: permissions handling at first launch
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAabedKhan authored Aug 31, 2023
1 parent 5733acb commit 8cb96f1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ui/views/navigation/navigation_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ class NavigationViewModel extends IndexTrackingViewModel {
Future<void> initialize(BuildContext context) async {
locator<Toast>().initialize(context);
final SharedPreferences prefs = await SharedPreferences.getInstance();
requestManageExternalStorage();
await requestManageExternalStorage();

if (prefs.getBool('permissionsRequested') == null) {
await Permission.storage.request();
await Permission.manageExternalStorage.request();
await prefs.setBool('permissionsRequested', true);
RootAPI().hasRootPermissions().then(
await RootAPI().hasRootPermissions().then(
(value) => Permission.requestInstallPackages.request().then(
(value) => Permission.ignoreBatteryOptimizations.request(),
),
Expand Down

0 comments on commit 8cb96f1

Please sign in to comment.