mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-29 21:55:58 +00:00
fix stack backup saving issues. android 10 still not working
This commit is contained in:
parent
a30ee6f329
commit
3bd0fca737
1 changed files with 7 additions and 4 deletions
|
@ -3,6 +3,7 @@ import 'dart:io';
|
|||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class StackFileSystem {
|
||||
Directory? rootPath;
|
||||
|
@ -14,6 +15,9 @@ class StackFileSystem {
|
|||
final bool isDesktop = !(Platform.isAndroid || Platform.isIOS);
|
||||
|
||||
Future<Directory> prepareStorage() async {
|
||||
if (Platform.isAndroid) {
|
||||
await Permission.storage.request();
|
||||
}
|
||||
rootPath = (await getApplicationDocumentsDirectory());
|
||||
debugPrint(rootPath!.absolute.toString());
|
||||
if (Platform.isAndroid) {
|
||||
|
@ -22,13 +26,13 @@ class StackFileSystem {
|
|||
debugPrint(rootPath!.absolute.toString());
|
||||
|
||||
Directory sampleFolder =
|
||||
Directory('${rootPath!.path}/Documents/Stack_backups');
|
||||
Directory('${rootPath!.path}Documents/Stack_backups');
|
||||
if (Platform.isIOS) {
|
||||
sampleFolder = Directory(rootPath!.path);
|
||||
}
|
||||
try {
|
||||
if (!sampleFolder.existsSync()) {
|
||||
sampleFolder.createSync();
|
||||
sampleFolder.createSync(recursive: true);
|
||||
}
|
||||
} catch (e, s) {
|
||||
debugPrint("$e $s");
|
||||
|
@ -65,8 +69,7 @@ class StackFileSystem {
|
|||
result = await FilePicker.platform.pickFiles(
|
||||
dialogTitle: "Load backup file",
|
||||
initialDirectory: startPath!.path,
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['bin'],
|
||||
type: FileType.any,
|
||||
allowCompression: false,
|
||||
lockParentWindow: true,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue