Backup from Loading screen

This commit is contained in:
Hanh 2022-03-14 17:35:37 +08:00
parent d0de3fb832
commit 9139333f3d
3 changed files with 18 additions and 10 deletions

View File

@ -93,8 +93,14 @@ abstract class _AccountManager2 with Store {
// ? ShareInfo(
// r['idx'], r['threshold'], r['participants'], r['secret'])
// : null; // TODO: Multisig
final account = Account(coin,
r['id_account'], r['name'], r['address'], r['balance'], 0, null);
final account = Account(
coin,
id,
r['name'],
r['address'],
r['balance'],
0,
null);
accounts.add(account);
}
return accounts;

View File

@ -102,7 +102,7 @@ class BackupState extends State<BackupPage> {
Padding(padding: EdgeInsets.symmetric(vertical: 4)),
Text(s.tapAnIconToShowTheQrCode),
GestureDetector(
onLongPress: _exportDb,
onLongPress: exportDb,
child: Container(
margin: EdgeInsets.all(8),
padding: EdgeInsets.all(8),
@ -117,10 +117,4 @@ class BackupState extends State<BackupPage> {
}
_showQR(String text, String title) => showQR(context, text, title);
_exportDb() async {
final prefs = await SharedPreferences.getInstance();
prefs.setBool('export_db', true);
showSnackBar('Backup scheduled');
}
}

View File

@ -147,7 +147,9 @@ class LoadProgressState extends State<LoadProgress> {
child: SizedBox(height: 240, width: 200, child:
Column(
children: [
Image(image: AssetImage('assets/icon.png'), height: 64),
GestureDetector(
onLongPress: exportDb,
child: Image(image: AssetImage('assets/icon.png'), height: 64)),
Padding(padding: EdgeInsets.all(16)),
Text(S.of(context).loading, style: Theme.of(context).textTheme.headline4),
Padding(padding: EdgeInsets.all(16)),
@ -699,4 +701,10 @@ Future<void> resetApp(BuildContext context) async {
}
}
Future<void> exportDb() async {
final prefs = await SharedPreferences.getInstance();
prefs.setBool('export_db', true);
showSnackBar('Backup scheduled');
}
bool isMobile() => Platform.isAndroid || Platform.isIOS;