squash pdf export + storage permissions
This commit is contained in:
@@ -18,11 +18,18 @@ class NoteFile {
|
||||
final path = (await getSavePath()).path + Platform.pathSeparator + filepath;
|
||||
_db = await openDatabase(
|
||||
path,
|
||||
onCreate: (db, version) {
|
||||
return db.execute(
|
||||
'CREATE TABLE strokes(id integer primary key autoincrement, color INTEGER, elevation INTEGER);'
|
||||
'CREATE TABLE points(id integer primary key autoincrement, x INTEGER, y INTEGER, thickness REAL, strokeid INTEGER)',
|
||||
);
|
||||
onCreate: (db, version) async {
|
||||
Batch batch = db.batch();
|
||||
|
||||
batch.execute('DROP TABLE IF EXISTS strokes;');
|
||||
batch.execute('DROP TABLE IF EXISTS points;');
|
||||
|
||||
batch.execute(
|
||||
'CREATE TABLE strokes(id integer primary key autoincrement, color INTEGER, elevation INTEGER)');
|
||||
batch.execute(
|
||||
'CREATE TABLE points(id integer primary key autoincrement, x INTEGER, y INTEGER, thickness REAL, strokeid INTEGER)');
|
||||
await batch.commit();
|
||||
return;
|
||||
},
|
||||
// Set the version. This executes the onCreate function and provides a
|
||||
// path to perform database upgrades and downgrades.
|
||||
|
@@ -7,8 +7,11 @@ Future<Directory> getSavePath() async {
|
||||
Directory dbpath;
|
||||
if (defaultTargetPlatform == TargetPlatform.android ||
|
||||
defaultTargetPlatform == TargetPlatform.iOS) {
|
||||
final dir =
|
||||
(await getExternalStorageDirectory())?.parent.parent.parent.parent ??
|
||||
(await getApplicationDocumentsDirectory());
|
||||
dbpath = Directory(
|
||||
'${(await getApplicationDocumentsDirectory()).path}${Platform.pathSeparator}notes');
|
||||
'${dir.path}${Platform.pathSeparator}Documents${Platform.pathSeparator}notes');
|
||||
} else {
|
||||
dbpath = Directory(
|
||||
'${(await getApplicationDocumentsDirectory()).path}${Platform.pathSeparator}notes');
|
||||
|
Reference in New Issue
Block a user