mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: fix not asking for permission
This commit is contained in:
parent
da0d88d86f
commit
13b7179941
@ -18,6 +18,8 @@ class NavigationViewModel extends IndexTrackingViewModel {
|
|||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
locator<Toast>().initialize(context);
|
locator<Toast>().initialize(context);
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
requestManageExternalStorage();
|
||||||
|
|
||||||
if (prefs.getBool('permissionsRequested') == null) {
|
if (prefs.getBool('permissionsRequested') == null) {
|
||||||
await Permission.storage.request();
|
await Permission.storage.request();
|
||||||
await Permission.manageExternalStorage.request();
|
await Permission.manageExternalStorage.request();
|
||||||
@ -28,6 +30,7 @@ class NavigationViewModel extends IndexTrackingViewModel {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs.getBool('useDarkTheme') == null) {
|
if (prefs.getBool('useDarkTheme') == null) {
|
||||||
final bool isDark =
|
final bool isDark =
|
||||||
MediaQuery.of(context).platformBrightness != Brightness.light;
|
MediaQuery.of(context).platformBrightness != Brightness.light;
|
||||||
@ -46,6 +49,17 @@ class NavigationViewModel extends IndexTrackingViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> requestManageExternalStorage() async {
|
||||||
|
final manageExternalStorageStatus =
|
||||||
|
await Permission.manageExternalStorage.status;
|
||||||
|
if (manageExternalStorageStatus.isDenied) {
|
||||||
|
await Permission.manageExternalStorage.request();
|
||||||
|
}
|
||||||
|
if (manageExternalStorageStatus.isPermanentlyDenied) {
|
||||||
|
await openAppSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget getViewForIndex(int index) {
|
Widget getViewForIndex(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.3.4+100300004
|
version: 1.3.5+100300005
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
Loading…
Reference in New Issue
Block a user