Try fixing permissions on android
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:saf/saf.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:sheetless/sheetview.dart';
|
||||
|
||||
import 'sheet.dart';
|
||||
@@ -39,38 +38,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<String?> getSavedSheetsPath() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString("sheets-path");
|
||||
}
|
||||
|
||||
Future<void> saveSheetsPath(String path) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString("sheets-path", path);
|
||||
}
|
||||
|
||||
Future<String?> askForSheetsPath() async {
|
||||
return await FilePicker.platform.getDirectoryPath();
|
||||
}
|
||||
|
||||
Future<String> findAndSaveSheetsPath() async {
|
||||
String? savedSheetsPath = await getSavedSheetsPath();
|
||||
if (savedSheetsPath != null) {
|
||||
return savedSheetsPath;
|
||||
}
|
||||
|
||||
String? selectedSheetsPath = await askForSheetsPath();
|
||||
if (selectedSheetsPath != null) {
|
||||
await saveSheetsPath(selectedSheetsPath);
|
||||
return selectedSheetsPath;
|
||||
}
|
||||
|
||||
return "No path selected";
|
||||
}
|
||||
|
||||
Future<String?> getSafPickedSheetsDirectory() async {
|
||||
await Permission.storage.request();
|
||||
await Permission.manageExternalStorage.request();
|
||||
var pickedDirectories = await Saf.getPersistedPermissionDirectories();
|
||||
print("Picked dirs = $pickedDirectories");
|
||||
if (pickedDirectories == null || pickedDirectories.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user