diff --git a/lib/ui/views/navigation/navigation_viewmodel.dart b/lib/ui/views/navigation/navigation_viewmodel.dart index 58ae74c186..51b3497cf6 100644 --- a/lib/ui/views/navigation/navigation_viewmodel.dart +++ b/lib/ui/views/navigation/navigation_viewmodel.dart @@ -18,6 +18,8 @@ class NavigationViewModel extends IndexTrackingViewModel { Future initialize(BuildContext context) async { locator().initialize(context); final SharedPreferences prefs = await SharedPreferences.getInstance(); + requestManageExternalStorage(); + if (prefs.getBool('permissionsRequested') == null) { await Permission.storage.request(); await Permission.manageExternalStorage.request(); @@ -28,6 +30,7 @@ class NavigationViewModel extends IndexTrackingViewModel { ), ); } + if (prefs.getBool('useDarkTheme') == null) { final bool isDark = MediaQuery.of(context).platformBrightness != Brightness.light; @@ -46,6 +49,17 @@ class NavigationViewModel extends IndexTrackingViewModel { ); } + Future requestManageExternalStorage() async { + final manageExternalStorageStatus = + await Permission.manageExternalStorage.status; + if (manageExternalStorageStatus.isDenied) { + await Permission.manageExternalStorage.request(); + } + if (manageExternalStorageStatus.isPermanentlyDenied) { + await openAppSettings(); + } + } + Widget getViewForIndex(int index) { switch (index) { case 0: diff --git a/pubspec.yaml b/pubspec.yaml index a4eb72247d..5d8b9d6417 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager publish_to: 'none' -version: 1.3.4+100300004 +version: 1.3.5+100300005 environment: sdk: '>=3.0.0 <4.0.0'