From 2a715f6fa8c5a08b4056b931bde9b3d43d9ab806 Mon Sep 17 00:00:00 2001
From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com>
Date: Sat, 7 Dec 2024 21:07:48 +0530
Subject: [PATCH] remove manage external storage permission
---
android/app/src/main/AndroidManifest.xml | 1 -
lib/features/logging/view/logs_page.dart | 133 ++++++++++++-----------
2 files changed, 68 insertions(+), 66 deletions(-)
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index f74b367..3856060 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -9,7 +9,6 @@
-
29) {
- final status = await Permission.manageExternalStorage.status;
- if (!status.isGranted) {
- 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();
+ // if (Platform.isAndroid) {
+ // final androidVersion =
+ // await ref.watch(deviceSdkVersionProvider.future);
- // 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');
- }
- },
- ),
+ // if ((int.parse(androidVersion)) > 29) {
+ // 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;
+ // }
+ // }
+ // } 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(
tooltip: 'Refresh logs',
icon: const Icon(Icons.refresh),