mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-06 11:09:28 +00:00
remove manage external storage permission
This commit is contained in:
parent
c2cf999398
commit
2a715f6fa8
2 changed files with 68 additions and 66 deletions
|
|
@ -9,7 +9,6 @@
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
|
||||||
<application
|
<application
|
||||||
android:label="Vaani"
|
android:label="Vaani"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|
|
||||||
|
|
@ -78,74 +78,77 @@ class LogsPage extends HookConsumerWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
tooltip: 'Download logs',
|
|
||||||
icon: const Icon(Icons.download),
|
|
||||||
onPressed: () async {
|
|
||||||
appLogger.info('Preparing logs for download');
|
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
// downloads disabled since manage external storage permission was removed
|
||||||
final androidVersion =
|
// see https://gitlab.com/IzzyOnDroid/repo/-/issues/623#note_2240386369
|
||||||
await ref.watch(deviceSdkVersionProvider.future);
|
// IconButton(
|
||||||
|
// tooltip: 'Download logs',
|
||||||
|
// icon: const Icon(Icons.download),
|
||||||
|
// onPressed: () async {
|
||||||
|
// appLogger.info('Preparing logs for download');
|
||||||
|
|
||||||
if ((int.parse(androidVersion)) > 29) {
|
// if (Platform.isAndroid) {
|
||||||
final status = await Permission.manageExternalStorage.status;
|
// final androidVersion =
|
||||||
if (!status.isGranted) {
|
// await ref.watch(deviceSdkVersionProvider.future);
|
||||||
appLogger
|
|
||||||
.info('Requesting manageExternalStorage permission');
|
|
||||||
final newStatus =
|
|
||||||
await Permission.manageExternalStorage.request();
|
|
||||||
if (!newStatus.isGranted) {
|
|
||||||
appLogger
|
|
||||||
.warning('manageExternalStorage permission denied');
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(
|
|
||||||
content: Text('Storage permission denied'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final status = await Permission.storage.status;
|
|
||||||
if (!status.isGranted) {
|
|
||||||
appLogger.info('Requesting storage permission');
|
|
||||||
final newStatus = await Permission.storage.request();
|
|
||||||
if (!newStatus.isGranted) {
|
|
||||||
appLogger.warning('Storage permission denied');
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(
|
|
||||||
content: Text('Storage permission denied'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final zipLogFilePath =
|
|
||||||
await ref.read(logsProvider.notifier).getZipFilePath();
|
|
||||||
|
|
||||||
// save to folder
|
// if ((int.parse(androidVersion)) > 29) {
|
||||||
String? outputFile = await FilePicker.platform.saveFile(
|
// final status = await Permission.storage.status;
|
||||||
dialogTitle: 'Please select an output file:',
|
// if (!status.isGranted) {
|
||||||
fileName: zipLogFilePath.split('/').last,
|
// appLogger
|
||||||
bytes: await File(zipLogFilePath).readAsBytes(),
|
// .info('Requesting storage permission');
|
||||||
);
|
// final newStatus =
|
||||||
if (outputFile != null) {
|
// await Permission.storage.request();
|
||||||
try {
|
// if (!newStatus.isGranted) {
|
||||||
final file = File(outputFile);
|
// appLogger
|
||||||
final zipFile = File(zipLogFilePath);
|
// .warning('storage permission denied');
|
||||||
await zipFile.copy(file.path);
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
appLogger.info('File saved to: $outputFile');
|
// const SnackBar(
|
||||||
} catch (e) {
|
// content: Text('Storage permission denied'),
|
||||||
appLogger.severe('Error saving file: $e');
|
// ),
|
||||||
}
|
// );
|
||||||
} else {
|
// return;
|
||||||
appLogger.info('Download cancelled');
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// } else {
|
||||||
),
|
// final status = await Permission.storage.status;
|
||||||
|
// if (!status.isGranted) {
|
||||||
|
// appLogger.info('Requesting storage permission');
|
||||||
|
// final newStatus = await Permission.storage.request();
|
||||||
|
// if (!newStatus.isGranted) {
|
||||||
|
// appLogger.warning('Storage permission denied');
|
||||||
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
// const SnackBar(
|
||||||
|
// content: Text('Storage permission denied'),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// final zipLogFilePath =
|
||||||
|
// await ref.read(logsProvider.notifier).getZipFilePath();
|
||||||
|
|
||||||
|
// // save to folder
|
||||||
|
// String? outputFile = await FilePicker.platform.saveFile(
|
||||||
|
// dialogTitle: 'Please select an output file:',
|
||||||
|
// fileName: zipLogFilePath.split('/').last,
|
||||||
|
// bytes: await File(zipLogFilePath).readAsBytes(),
|
||||||
|
// );
|
||||||
|
// if (outputFile != null) {
|
||||||
|
// try {
|
||||||
|
// final file = File(outputFile);
|
||||||
|
// final zipFile = File(zipLogFilePath);
|
||||||
|
// await zipFile.copy(file.path);
|
||||||
|
// appLogger.info('File saved to: $outputFile');
|
||||||
|
// } catch (e) {
|
||||||
|
// appLogger.severe('Error saving file: $e');
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// appLogger.info('Download cancelled');
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: 'Refresh logs',
|
tooltip: 'Refresh logs',
|
||||||
icon: const Icon(Icons.refresh),
|
icon: const Icon(Icons.refresh),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue