Skip to content

Commit 2a715f6

Browse files
committed
remove manage external storage permission
1 parent c2cf999 commit 2a715f6

File tree

2 files changed

+68
-66
lines changed

2 files changed

+68
-66
lines changed

android/app/src/main/AndroidManifest.xml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<uses-permission android:name="android.permission.VIBRATE" />
1010
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1111
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
12-
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
1312
<application
1413
android:label="Vaani"
1514
android:name="${applicationName}"

lib/features/logging/view/logs_page.dart

+68-65
Original file line numberDiff line numberDiff line change
@@ -78,74 +78,77 @@ class LogsPage extends HookConsumerWidget {
7878
}
7979
},
8080
),
81-
IconButton(
82-
tooltip: 'Download logs',
83-
icon: const Icon(Icons.download),
84-
onPressed: () async {
85-
appLogger.info('Preparing logs for download');
8681

87-
if (Platform.isAndroid) {
88-
final androidVersion =
89-
await ref.watch(deviceSdkVersionProvider.future);
82+
// downloads disabled since manage external storage permission was removed
83+
// see https://gitlab.com/IzzyOnDroid/repo/-/issues/623#note_2240386369
84+
// IconButton(
85+
// tooltip: 'Download logs',
86+
// icon: const Icon(Icons.download),
87+
// onPressed: () async {
88+
// appLogger.info('Preparing logs for download');
9089

91-
if ((int.parse(androidVersion)) > 29) {
92-
final status = await Permission.manageExternalStorage.status;
93-
if (!status.isGranted) {
94-
appLogger
95-
.info('Requesting manageExternalStorage permission');
96-
final newStatus =
97-
await Permission.manageExternalStorage.request();
98-
if (!newStatus.isGranted) {
99-
appLogger
100-
.warning('manageExternalStorage permission denied');
101-
ScaffoldMessenger.of(context).showSnackBar(
102-
const SnackBar(
103-
content: Text('Storage permission denied'),
104-
),
105-
);
106-
return;
107-
}
108-
}
109-
} else {
110-
final status = await Permission.storage.status;
111-
if (!status.isGranted) {
112-
appLogger.info('Requesting storage permission');
113-
final newStatus = await Permission.storage.request();
114-
if (!newStatus.isGranted) {
115-
appLogger.warning('Storage permission denied');
116-
ScaffoldMessenger.of(context).showSnackBar(
117-
const SnackBar(
118-
content: Text('Storage permission denied'),
119-
),
120-
);
121-
return;
122-
}
123-
}
124-
}
125-
}
126-
final zipLogFilePath =
127-
await ref.read(logsProvider.notifier).getZipFilePath();
90+
// if (Platform.isAndroid) {
91+
// final androidVersion =
92+
// await ref.watch(deviceSdkVersionProvider.future);
12893

129-
// save to folder
130-
String? outputFile = await FilePicker.platform.saveFile(
131-
dialogTitle: 'Please select an output file:',
132-
fileName: zipLogFilePath.split('/').last,
133-
bytes: await File(zipLogFilePath).readAsBytes(),
134-
);
135-
if (outputFile != null) {
136-
try {
137-
final file = File(outputFile);
138-
final zipFile = File(zipLogFilePath);
139-
await zipFile.copy(file.path);
140-
appLogger.info('File saved to: $outputFile');
141-
} catch (e) {
142-
appLogger.severe('Error saving file: $e');
143-
}
144-
} else {
145-
appLogger.info('Download cancelled');
146-
}
147-
},
148-
),
94+
// if ((int.parse(androidVersion)) > 29) {
95+
// final status = await Permission.storage.status;
96+
// if (!status.isGranted) {
97+
// appLogger
98+
// .info('Requesting storage permission');
99+
// final newStatus =
100+
// await Permission.storage.request();
101+
// if (!newStatus.isGranted) {
102+
// appLogger
103+
// .warning('storage permission denied');
104+
// ScaffoldMessenger.of(context).showSnackBar(
105+
// const SnackBar(
106+
// content: Text('Storage permission denied'),
107+
// ),
108+
// );
109+
// return;
110+
// }
111+
// }
112+
// } else {
113+
// final status = await Permission.storage.status;
114+
// if (!status.isGranted) {
115+
// appLogger.info('Requesting storage permission');
116+
// final newStatus = await Permission.storage.request();
117+
// if (!newStatus.isGranted) {
118+
// appLogger.warning('Storage permission denied');
119+
// ScaffoldMessenger.of(context).showSnackBar(
120+
// const SnackBar(
121+
// content: Text('Storage permission denied'),
122+
// ),
123+
// );
124+
// return;
125+
// }
126+
// }
127+
// }
128+
// }
129+
// final zipLogFilePath =
130+
// await ref.read(logsProvider.notifier).getZipFilePath();
131+
132+
// // save to folder
133+
// String? outputFile = await FilePicker.platform.saveFile(
134+
// dialogTitle: 'Please select an output file:',
135+
// fileName: zipLogFilePath.split('/').last,
136+
// bytes: await File(zipLogFilePath).readAsBytes(),
137+
// );
138+
// if (outputFile != null) {
139+
// try {
140+
// final file = File(outputFile);
141+
// final zipFile = File(zipLogFilePath);
142+
// await zipFile.copy(file.path);
143+
// appLogger.info('File saved to: $outputFile');
144+
// } catch (e) {
145+
// appLogger.severe('Error saving file: $e');
146+
// }
147+
// } else {
148+
// appLogger.info('Download cancelled');
149+
// }
150+
// },
151+
// ),
149152
IconButton(
150153
tooltip: 'Refresh logs',
151154
icon: const Icon(Icons.refresh),

0 commit comments

Comments
 (0)