Bug fix: db backup not being awaited

This commit is contained in:
Hanh 2022-03-16 12:54:24 +08:00
parent 0e4885c645
commit 199100c88b
4 changed files with 14 additions and 9 deletions

View File

@ -42,7 +42,7 @@ abstract class CoinBase {
final path = join(dbPath, dbName);
db = await openDatabase(path);
await db.close();
return Share.shareFiles([path], subject: dbName);
await Share.shareFiles([path], subject: dbName);
}
}
}

View File

@ -268,14 +268,19 @@ class ZWalletAppState extends State<ZWalletApp> {
final recover = prefs.getBool('recover') ?? false;
final exportDb = prefs.getBool('export_db') ?? false;
prefs.setBool('recover', false);
prefs.setBool('export_db', false);
if (!initialized || recover || exportDb) {
initialized = true;
final dbPath = await getDatabasesPath();
if (exportDb) {
print("Export ycash");
await ycash.export(dbPath);
final r1 = await showMessageBox(context, 'Export', 'Export completed?', "OK");
print("Export zcash");
await zcash.export(dbPath);
final r2 = await showMessageBox(context, 'Export', 'Export completed?', "OK");
print("Export done");
if (r1 && r2) prefs.setBool('export_db', false);
}
if (recover) {
ycash.delete(dbPath);

View File

@ -983,42 +983,42 @@ packages:
name: share_plus
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "4.0.1"
share_plus_linux:
dependency: transitive
description:
name: share_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
version: "3.0.0"
share_plus_macos:
dependency: transitive
description:
name: share_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "3.0.0"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "3.0.0"
share_plus_web:
dependency: transitive
description:
name: share_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
version: "3.0.0"
share_plus_windows:
dependency: transitive
description:
name: share_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "3.0.0"
shared_preferences:
dependency: "direct main"
description:

View File

@ -52,7 +52,7 @@ dependencies:
ref: 821f81681f8ee819cd721498f7b28d290f4ebe38
grouped_list: ^4.1.0
json_annotation: ^4.1.0
share_plus: ^3.1.0
share_plus: ^4.0.1
path_provider: ^2.0.3
file_picker: ^4.5.0
mustache_template: ^2.0.0