Fixes for backups for monero.com app

This commit is contained in:
M
2022-02-02 14:40:40 +02:00
parent 66d4b959af
commit 05c4d26634
8 changed files with 65 additions and 16 deletions
+4 -2
View File
@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:mobx/mobx.dart';
import 'package:intl/intl.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
part 'backup_view_model.g.dart';
@@ -58,9 +59,10 @@ abstract class BackupViewModelBase with Store {
state = ExecutedSuccessfullyState();
final now = DateTime.now();
final formatter = DateFormat('yyyy-MM-dd_Hm');
final snakeAppName = approximatedAppName.replaceAll(' ', '_').toLowerCase();
final fileName = '${snakeAppName}_backup_${formatter.format(now)}';
return BackupExportFile(backupContent.toList(),
name: 'cake_wallet_backup_${formatter.format(now)}');
return BackupExportFile(backupContent.toList(), name: fileName);
} catch (e) {
print(e.toString());
state = FailureState(e.toString());
@@ -3,10 +3,15 @@ import 'package:cw_core/wallet_type.dart';
class WalletListItem {
const WalletListItem(
{@required this.name, @required this.type, @required this.key, this.isCurrent = false});
{@required this.name,
@required this.type,
@required this.key,
this.isCurrent = false,
this.isEnabled = true});
final String name;
final WalletType type;
final bool isCurrent;
final dynamic key;
final bool isEnabled;
}
@@ -8,6 +8,7 @@ import 'package:cw_core/wallet_service.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/wallet_types.g.dart';
part 'wallet_list_view_model.g.dart';
@@ -55,6 +56,7 @@ abstract class WalletListViewModelBase with Store {
type: info.type,
key: info.key,
isCurrent: info.name == _appStore.wallet.name &&
info.type == _appStore.wallet.type)));
info.type == _appStore.wallet.type,
isEnabled: availableWalletTypes.contains(info.type))));
}
}