Fixes and improvments.
M committed
Oct 2, 2020 at 20:28 UTC
04e7c1884176b5e6f607d3bd0074914492e16f78
13 files changed
+248
-242
ios/Runner.xcodeproj/project.pbxproj
+3
-3
@@ -354,7 +354,7 @@
354
buildSettings = {
355
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
356
CLANG_ENABLE_MODULES = YES;
357
- CURRENT_PROJECT_VERSION = 3;
357
+ CURRENT_PROJECT_VERSION = 4;
358
DEVELOPMENT_TEAM = 32J6BB6VUS;
359
ENABLE_BITCODE = NO;
360
FRAMEWORK_SEARCH_PATHS = (
@@ -493,7 +493,7 @@
493
buildSettings = {
494
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
495
CLANG_ENABLE_MODULES = YES;
496
- CURRENT_PROJECT_VERSION = 3;
496
+ CURRENT_PROJECT_VERSION = 4;
497
DEVELOPMENT_TEAM = 32J6BB6VUS;
498
ENABLE_BITCODE = NO;
499
FRAMEWORK_SEARCH_PATHS = (
@@ -526,7 +526,7 @@
526
buildSettings = {
527
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
528
CLANG_ENABLE_MODULES = YES;
529
- CURRENT_PROJECT_VERSION = 3;
529
+ CURRENT_PROJECT_VERSION = 4;
530
DEVELOPMENT_TEAM = 32J6BB6VUS;
531
ENABLE_BITCODE = NO;
532
FRAMEWORK_SEARCH_PATHS = (
lib/monero/monero_wallet.dart
-2
@@ -180,9 +180,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
180
181
@override
182
Future<void> save() async {
183
- print('SAVE CALLED');
183
await monero_wallet.store();
185
- print('SAVE FINISHED');
184
}
185
186
Future<int> getNodeHeight() async => monero_wallet.getNodeHeight();
lib/reactions/on_authentication_state_change.dart
-2
@@ -14,8 +14,6 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
14
15
if (state == AuthenticationState.installed) {
16
await loadCurrentWallet();
17
- // await navigatorKey.currentState
18
- // .pushNamedAndRemoveUntil(Routes.login, (_) => false);
17
}
18
19
if (state == AuthenticationState.allowed) {
lib/src/screens/contact/contact_list_page.dart
+74
-88
@@ -63,14 +63,14 @@ class ContactListPage extends BasePage {
63
builder: (_) {
64
return contactListViewModel.contacts.isNotEmpty
65
? SectionStandardList(
66
- sectionCount: 1,
67
- context: context,
68
- itemCounter: (int sectionIndex) => contactListViewModel.contacts.length,
69
- itemBuilder: (_, sectionIndex, index) {
70
- final contact = contactListViewModel.contacts[index];
71
- final image = _getCurrencyImage(contact.type);
72
- final content = Builder(
73
- builder: (context) => GestureDetector(
66
+ sectionCount: 1,
67
+ context: context,
68
+ itemCounter: (int sectionIndex) =>
69
+ contactListViewModel.contacts.length,
70
+ itemBuilder: (_, sectionIndex, index) {
71
+ final contact = contactListViewModel.contacts[index];
72
+ final image = _getCurrencyImage(contact.type);
73
+ final content = GestureDetector(
74
onTap: () async {
75
if (!isEditable) {
76
Navigator.of(context).pop(contact);
@@ -83,94 +83,79 @@ class ContactListPage extends BasePage {
83
if (isCopied != null && isCopied) {
84
await Clipboard.setData(
85
ClipboardData(text: contact.address));
86
- await showBar<void>(context,
87
- S.of(context).copied_to_clipboard);
86
+ await showBar<void>(
87
+ context, S.of(context).copied_to_clipboard);
88
}
89
},
90
- child: Column(
91
- children: <Widget>[
92
- Container(
93
- width: double.infinity,
94
- child: Padding(
95
- padding: const EdgeInsets.only(
96
- left: 24, top: 16, bottom: 16, right: 24),
97
- child: Row(
98
- mainAxisSize: MainAxisSize.min,
99
- mainAxisAlignment: MainAxisAlignment.start,
100
- crossAxisAlignment:
101
- CrossAxisAlignment.center,
102
- children: <Widget>[
103
- image ?? Offstage(),
104
- Padding(
105
- padding: image != null
106
- ? EdgeInsets.only(left: 12)
107
- : EdgeInsets.only(left: 0),
108
- child: Text(
109
- contact.name,
110
- style: TextStyle(
111
- fontSize: 14,
112
- fontWeight: FontWeight.normal,
113
- color: Theme.of(context)
114
- .primaryTextTheme
115
- .title
116
- .color),
117
- ),
118
- )
119
- ],
120
- )),
121
- ),
122
- ],
90
+ child: Container(
91
+ color: Colors.transparent,
92
+ padding: const EdgeInsets.only(
93
+ left: 24, top: 16, bottom: 16, right: 24),
94
+ child: Row(
95
+ mainAxisSize: MainAxisSize.min,
96
+ mainAxisAlignment: MainAxisAlignment.start,
97
+ crossAxisAlignment: CrossAxisAlignment.center,
98
+ children: <Widget>[
99
+ image ?? Offstage(),
100
+ Padding(
101
+ padding: image != null
102
+ ? EdgeInsets.only(left: 12)
103
+ : EdgeInsets.only(left: 0),
104
+ child: Text(
105
+ contact.name,
106
+ style: TextStyle(
107
+ fontSize: 14,
108
+ fontWeight: FontWeight.normal,
109
+ color: Theme.of(context)
110
+ .primaryTextTheme
111
+ .title
112
+ .color),
113
+ ),
114
+ )
115
+ ],
116
+ ),
117
),
124
- )
125
- );
118
+ );
119
127
- return !isEditable
128
- ? content
129
- : Slidable(
130
- key: Key('${contact.key}'),
131
- actionPane: SlidableDrawerActionPane(),
132
- child: content,
133
- secondaryActions: <Widget>[
134
- IconSlideAction(
135
- caption: S.of(context).edit,
136
- color: Colors.blue,
137
- icon: Icons.edit,
138
- onTap: () async => await Navigator.of(context)
139
- .pushNamed(Routes.addressBookAddContact,
140
- arguments: contact),
141
- ),
142
- IconSlideAction(
143
- caption: S.of(context).delete,
144
- color: Colors.red,
145
- icon: CupertinoIcons.delete,
146
- onTap: () async {
147
- final isDelete =
148
- await showAlertDialog(context) ?? false;
120
+ return !isEditable
121
+ ? content
122
+ : Slidable(
123
+ key: Key('${contact.key}'),
124
+ actionPane: SlidableDrawerActionPane(),
125
+ child: content,
126
+ secondaryActions: <Widget>[
127
+ IconSlideAction(
128
+ caption: S.of(context).edit,
129
+ color: Colors.blue,
130
+ icon: Icons.edit,
131
+ onTap: () async =>
132
+ await Navigator.of(context).pushNamed(
133
+ Routes.addressBookAddContact,
134
+ arguments: contact),
135
+ ),
136
+ IconSlideAction(
137
+ caption: S.of(context).delete,
138
+ color: Colors.red,
139
+ icon: CupertinoIcons.delete,
140
+ onTap: () async {
141
+ final isDelete =
142
+ await showAlertDialog(context) ??
143
+ false;
144
150
- if (isDelete) {
151
- await contactListViewModel
152
- .delete(contact);
153
- }
154
- },
155
- ),
156
- ],
157
- dismissal: SlidableDismissal(
158
- child: SlidableDrawerDismissal(),
159
- onDismissed: (actionType) async => null,
160
- // await contactListViewModel.delete(contact),
161
- onWillDismiss: (actionType) async =>
162
- showAlertDialog(context),
163
- ),
164
- );
165
- },
166
- )
145
+ if (isDelete) {
146
+ await contactListViewModel
147
+ .delete(contact);
148
+ }
149
+ },
150
+ ),
151
+ ]);
152
+ },
153
+ )
154
: Center(
155
child: Text(
156
S.of(context).placeholder_contacts,
157
textAlign: TextAlign.center,
171
- style: TextStyle(
172
- color: Colors.grey,
173
- fontSize: 14),
158
+ style: TextStyle(color: Colors.grey, fontSize: 14),
159
),
160
);
161
},
@@ -181,7 +166,8 @@ class ContactListPage extends BasePage {
166
Image image;
167
switch (currency) {
168
case CryptoCurrency.xmr:
184
- image = Image.asset('assets/images/monero_logo.png', height: 24, width: 24);
169
+ image =
170
+ Image.asset('assets/images/monero_logo.png', height: 24, width: 24);
171
break;
172
case CryptoCurrency.ada:
173
image = Image.asset('assets/images/ada.png', height: 24, width: 24);
lib/src/screens/dashboard/widgets/transaction_raw.dart
+18
-19
@@ -29,8 +29,21 @@ class TransactionRow extends StatelessWidget {
29
child: Row(
30
crossAxisAlignment: CrossAxisAlignment.center,
31
children: <Widget>[
32
+ Container(
33
+ height: 36,
34
+ width: 36,
35
+ decoration: BoxDecoration(
36
+ shape: BoxShape.circle,
37
+ color: Theme.of(context).textTheme.overline.decorationColor
38
+ ),
39
+ child: Image.asset(
40
+ direction == TransactionDirection.incoming
41
+ ? 'assets/images/down_arrow.png'
42
+ : 'assets/images/up_arrow.png'),
43
+ ),
44
Expanded(
45
child: Container(
46
+ padding: const EdgeInsets.only(left: 12),
47
height: 56,
48
child: Column(
49
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -48,25 +61,11 @@ class TransactionRow extends StatelessWidget {
61
fontSize: 16,
62
fontWeight: FontWeight.w500,
63
color: Colors.white)),
51
- Container(
52
- decoration: BoxDecoration(
53
- borderRadius:
54
- BorderRadius.all(Radius.circular(10)),
55
- color: (direction ==
56
- TransactionDirection.incoming
57
- ? Colors.green.withOpacity(0.8)
58
- : Theme.of(context)
59
- .accentTextTheme
60
- .body2
61
- .decorationColor
62
- .withOpacity(0.8))),
63
- padding: EdgeInsets.only(
64
- top: 3, bottom: 3, left: 10, right: 10),
65
- child: Text(formattedAmount,
66
- style: TextStyle(
67
- fontSize: 16,
68
- fontWeight: FontWeight.w500,
69
- color: Colors.white)))
64
+ Text(formattedAmount,
65
+ style: TextStyle(
66
+ fontSize: 16,
67
+ fontWeight: FontWeight.w500,
68
+ color: Colors.white))
69
]),
70
Row(
71
mainAxisAlignment: MainAxisAlignment.spaceBetween,
lib/src/screens/nodes/nodes_list_page.dart
+91
-88
@@ -10,6 +10,7 @@ import 'package:cake_wallet/src/screens/nodes/widgets/node_list_row.dart';
10
import 'package:cake_wallet/src/widgets/standard_list.dart';
11
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
12
import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart';
13
+import 'package:flutter_slidable/flutter_slidable.dart';
14
15
class NodeListPage extends BasePage {
16
NodeListPage(this.nodeListViewModel);
@@ -59,102 +60,104 @@ class NodeListPage extends BasePage {
60
}
61
62
@override
62
- Widget body(context) {
63
+ Widget body(BuildContext context) {
64
return Container(
65
padding: EdgeInsets.only(top: 10),
66
child: Observer(
66
- builder: (_) => SectionStandardList(
67
- sectionCount: 2,
68
- context: context,
69
- itemBuilder: (_, sectionIndex, index) {
70
- return Observer(builder: (_) {
71
- if (sectionIndex == 0) {
72
- return NodeHeaderListRow(
73
- title: S.of(context).add_new_node,
74
- onTap: (_) async => await Navigator.of(context)
75
- .pushNamed(Routes.newNode));
76
- }
67
+ builder: (BuildContext context) {
68
+ return nodeListViewModel.nodes.isNotEmpty
69
+ ? SectionStandardList(
70
+ sectionCount: 2,
71
+ context: context,
72
+ itemCounter: (int sectionIndex) {
73
+ if (sectionIndex == 0) {
74
+ return 1;
75
+ }
76
78
- final node = nodeListViewModel.nodes[index];
79
- final isSelected = node.keyIndex ==
80
- nodeListViewModel.settingsStore.currentNode.keyIndex;
81
- final nodeListRow = NodeListRow(
82
- title: node.uri,
83
- isSelected: isSelected,
84
- isAlive: node.requestNode(),
85
- onTap: (_) async {
86
- if (isSelected) {
87
- return;
88
- }
77
+ return nodeListViewModel.nodes.length;
78
+ },
79
+ itemBuilder: (_, sectionIndex, index) {
80
+ if (sectionIndex == 0) {
81
+ return NodeHeaderListRow(
82
+ title: S.of(context).add_new_node,
83
+ onTap: (_) async => await Navigator.of(context)
84
+ .pushNamed(Routes.newNode));
85
+ }
86
90
- await showPopUp<void>(
91
- context: context,
92
- builder: (BuildContext context) {
93
- // FIXME: Add translation.
94
- return AlertWithTwoActions(
95
- alertTitle: 'Change current node',
96
- alertContent:
97
- S.of(context).change_current_node(node.uri),
98
- leftButtonText: S.of(context).cancel,
99
- rightButtonText: S.of(context).change,
100
- actionLeftButton: () =>
101
- Navigator.of(context).pop(),
102
- actionRightButton: () async {
103
- await nodeListViewModel.setAsCurrent(node);
104
- Navigator.of(context).pop();
105
- });
106
- });
107
- });
87
+ final node = nodeListViewModel.nodes[index];
88
+ final isSelected = node.keyIndex ==
89
+ nodeListViewModel.settingsStore.currentNode.keyIndex;
90
+ final nodeListRow = NodeListRow(
91
+ title: node.uri,
92
+ isSelected: isSelected,
93
+ isAlive: node.requestNode(),
94
+ onTap: (_) async {
95
+ if (isSelected) {
96
+ return;
97
+ }
98
109
- final dismissibleRow = Dismissible(
110
- key: Key('${node.keyIndex}'),
111
- confirmDismiss: (direction) async {
112
- return await showPopUp(
113
- context: context,
114
- builder: (BuildContext context) {
115
- return AlertWithTwoActions(
116
- alertTitle: S.of(context).remove_node,
117
- alertContent: S.of(context).remove_node_message,
118
- rightButtonText: S.of(context).remove,
119
- leftButtonText: S.of(context).cancel,
120
- actionRightButton: () =>
121
- Navigator.pop(context, true),
122
- actionLeftButton: () =>
123
- Navigator.pop(context, false));
124
- });
125
- },
126
- onDismissed: (direction) async =>
127
- nodeListViewModel.delete(node),
128
- direction: DismissDirection.endToStart,
129
- background: Container(
130
- padding: EdgeInsets.only(right: 10.0),
131
- alignment: AlignmentDirectional.centerEnd,
132
- color: Palette.red,
133
- child: Column(
134
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
135
- children: <Widget>[
136
- const Icon(
137
- CupertinoIcons.delete,
138
- color: Colors.white,
139
- ),
140
- Text(
141
- S.of(context).delete,
142
- style: TextStyle(color: Colors.white),
143
- )
144
- ],
145
- )),
146
- child: nodeListRow);
99
+ await showPopUp<void>(
100
+ context: context,
101
+ builder: (BuildContext context) {
102
+ // FIXME: Add translation.
103
+ return AlertWithTwoActions(
104
+ alertTitle: 'Change current node',
105
+ alertContent: S
106
+ .of(context)
107
+ .change_current_node(node.uri),
108
+ leftButtonText: S.of(context).cancel,
109
+ rightButtonText: S.of(context).change,
110
+ actionLeftButton: () =>
111
+ Navigator.of(context).pop(),
112
+ actionRightButton: () async {
113
+ await nodeListViewModel
114
+ .setAsCurrent(node);
115
+ Navigator.of(context).pop();
116
+ });
117
+ });
118
+ });
119
148
- return isSelected ? nodeListRow : dismissibleRow;
149
- });
150
- },
151
- itemCounter: (int sectionIndex) {
152
- if (sectionIndex == 0) {
153
- return 1;
154
- }
120
+ final dismissibleRow = Slidable(
121
+ key: Key('${node.keyIndex}'),
122
+ actionPane: SlidableDrawerActionPane(),
123
+ child: nodeListRow,
124
+ secondaryActions: <Widget>[
125
+ IconSlideAction(
126
+ caption: S.of(context).delete,
127
+ color: Colors.red,
128
+ icon: CupertinoIcons.delete,
129
+ onTap: () async {
130
+ final confirmed = await showPopUp<bool>(
131
+ context: context,
132
+ builder: (BuildContext context) {
133
+ return AlertWithTwoActions(
134
+ alertTitle:
135
+ S.of(context).remove_node,
136
+ alertContent: S
137
+ .of(context)
138
+ .remove_node_message,
139
+ rightButtonText:
140
+ S.of(context).remove,
141
+ leftButtonText:
142
+ S.of(context).cancel,
143
+ actionRightButton: () =>
144
+ Navigator.pop(context, true),
145
+ actionLeftButton: () =>
146
+ Navigator.pop(context, false));
147
+ }) ??
148
+ false;
149
+
150
+ if (confirmed) {
151
+ await nodeListViewModel.delete(node);
152
+ }
153
+ },
154
+ ),
155
+ ]);
156
156
- return nodeListViewModel.nodes.length;
157
- }),
157
+ return isSelected ? nodeListRow : dismissibleRow;
158
+ })
159
+ : Container();
160
+ },
161
),
162
);
163
}
lib/src/screens/pin_code/pin_code_widget.dart
+2
-2
@@ -81,8 +81,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
81
}
82
83
@override
84
- Widget build(BuildContext context) =>
85
- Scaffold(key: _key, body: body(context));
84
+ Widget build(BuildContext context) => Scaffold(
85
+ key: _key, body: body(context), resizeToAvoidBottomPadding: false);
86
87
Widget body(BuildContext context) {
88
final deleteIconImage = Image.asset(
lib/src/screens/send/send_page.dart
+39
-25
@@ -25,15 +25,29 @@ import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart'
25
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
26
27
class SendPage extends BasePage {
28
- SendPage({@required this.sendViewModel});
28
+ SendPage({@required this.sendViewModel})
29
+ : _addressController = TextEditingController(),
30
+ _cryptoAmountController = TextEditingController(),
31
+ _fiatAmountController = TextEditingController(),
32
+ _formKey = GlobalKey<FormState>(),
33
+ _cryptoAmountFocus = FocusNode(),
34
+ _fiatAmountFocus = FocusNode(),
35
+ _addressFocusNode = FocusNode() {
36
+ _addressFocusNode.addListener(() {
37
+ if (!_addressFocusNode.hasFocus && _addressController.text.isNotEmpty) {
38
+ getOpenaliasRecord(_addressFocusNode.context);
39
+ }
40
+ });
41
+ }
42
43
final SendViewModel sendViewModel;
31
- final _addressController = TextEditingController();
32
- final _cryptoAmountController = TextEditingController();
33
- final _fiatAmountController = TextEditingController();
34
- final _formKey = GlobalKey<FormState>();
35
- final _cryptoAmountFocus = FocusNode();
36
- final _fiatAmountFocus = FocusNode();
44
+ final TextEditingController _addressController;
45
+ final TextEditingController _cryptoAmountController;
46
+ final TextEditingController _fiatAmountController;
47
+ final GlobalKey<FormState> _formKey;
48
+ final FocusNode _cryptoAmountFocus;
49
+ final FocusNode _fiatAmountFocus;
50
+ final FocusNode _addressFocusNode;
51
52
bool _effectsInstalled = false;
53
@@ -105,6 +119,7 @@ class SendPage extends BasePage {
119
child: Column(
120
children: <Widget>[
121
AddressTextField(
122
+ focusNode: _addressFocusNode,
123
controller: _addressController,
124
onURIScanned: (uri) {
125
var address = '';
@@ -672,24 +687,23 @@ class SendPage extends BasePage {
687
}
688
689
Future<void> getOpenaliasRecord(BuildContext context) async {
675
- // final isOpenalias =
676
- // await sendViewModel.isOpenaliasRecord(_addressController.text);
677
-
678
- // if (isOpenalias) {
679
- // _addressController.text = sendViewModel.recordAddress;
680
-
681
- // await showPopUp<void>(
682
- // context: context,
683
- // builder: (BuildContext context) {
684
- // return AlertWithOneAction(
685
- // alertTitle: S.of(context).openalias_alert_title,
686
- // alertContent: S
687
- // .of(context)
688
- // .openalias_alert_content(sendViewModel.recordName),
689
- // buttonText: S.of(context).ok,
690
- // buttonAction: () => Navigator.of(context).pop());
691
- // });
692
- // }
690
+ final record =
691
+ await sendViewModel.decodeOpenaliasRecord(_addressController.text);
692
+
693
+ if (record != null) {
694
+ _addressController.text = record.address;
695
+
696
+ await showPopUp<void>(
697
+ context: context,
698
+ builder: (BuildContext context) {
699
+ return AlertWithOneAction(
700
+ alertTitle: S.of(context).openalias_alert_title,
701
+ alertContent:
702
+ S.of(context).openalias_alert_content(record.name),
703
+ buttonText: S.of(context).ok,
704
+ buttonAction: () => Navigator.of(context).pop());
705
+ });
706
+ }
707
}
708
709
Future<void> _setTransactionPriority(BuildContext context) async {
lib/src/screens/wallet_list/wallet_list_page.dart
+1
-1
@@ -131,7 +131,7 @@ class WalletListBodyState extends State<WalletListBody> {
131
wallet.name,
132
style: TextStyle(
133
fontSize: 22,
134
- fontWeight: FontWeight.w600,
134
+ fontWeight: FontWeight.w500,
135
color: Theme.of(context)
136
.primaryTextTheme
137
.title
lib/utils/mobx.dart
+7
-8
@@ -61,7 +61,7 @@ extension MobxBindable<T extends Keyable> on Box<T> {
61
}
62
63
return watch().listen((event) {
64
- if (filter != null && !filter(event.value as T)) {
64
+ if (filter != null && event.value != null && !filter(event.value as T)) {
65
return;
66
}
67
@@ -80,7 +80,7 @@ extension MobxBindable<T extends Keyable> on Box<T> {
80
}
81
82
return watch().listen((event) {
83
- if (filter != null && !filter(event.value as T)) {
83
+ if (filter != null && event.value != null && !filter(event.value as T)) {
84
return;
85
}
86
@@ -124,15 +124,13 @@ extension HiveBindable<T extends Keyable> on ObservableList<T> {
124
listen().listen((event) => dest.acceptEntityChange(event));
125
126
void acceptBoxChange(BoxEvent event, {T transformed}) {
127
- print('---------------------');
128
- print('event.key: ${event.key}; event.deleted: ${event.deleted};');
127
if (event.deleted) {
128
removeWhere((el) {
131
- print('el.keyIndex ${el.keyIndex}');
132
- return el.keyIndex == event.key; });
133
- }
129
+ return el.keyIndex == event.key;
130
+ });
131
135
- print('---------------------');
132
+ return;
133
+ }
134
135
final dynamic value = transformed ?? event.value;
136
@@ -150,6 +148,7 @@ extension HiveBindable<T extends Keyable> on ObservableList<T> {
148
void acceptEntityChange(EntityChange<T> event) {
149
if (event.type == ChangeType.delete) {
150
removeWhere((el) => el.keyIndex == event.key);
151
+ return;
152
}
153
154
final dynamic value = event.value;
lib/utils/show_pop_up.dart
+2
-2
@@ -14,8 +14,8 @@ Future<T> showPopUp<T>({
14
context: context,
15
builder: builder,
16
barrierDismissible: barrierDismissible,
17
- //barrierColor: barrierColor,
18
- //useSafeArea: useSafeArea,
17
+ barrierColor: barrierColor,
18
+ useSafeArea: useSafeArea,
19
useRootNavigator: useRootNavigator,
20
routeSettings: routeSettings,
21
child: child);
lib/view_model/node_list/node_list_view_model.dart
+3
-2
@@ -16,7 +16,7 @@ abstract class NodeListViewModelBase with Store {
16
NodeListViewModelBase(this._nodeSource, this._wallet, this.settingsStore)
17
: nodes = ObservableList<Node>() {
18
_nodeSource.bindToList(nodes,
19
- filter: (Node val) => val.type == _wallet.type, initialFire: true);
19
+ filter: (Node val) => val?.type == _wallet.type, initialFire: true);
20
}
21
22
final ObservableList<Node> nodes;
@@ -46,7 +46,8 @@ abstract class NodeListViewModelBase with Store {
46
await setAsCurrent(node);
47
}
48
49
- Future<void> delete(Node node) async => _nodeSource.delete(node.key);
49
+ @action
50
+ Future<void> delete(Node node) async => node.delete();
51
52
Future<void> setAsCurrent(Node node) async =>
53
settingsStore.currentNode = node;
lib/view_model/send/send_view_model.dart
+8
@@ -1,3 +1,4 @@
1
+import 'package:cake_wallet/entities/openalias_record.dart';
2
import 'package:intl/intl.dart';
3
import 'package:mobx/mobx.dart';
4
import 'package:cake_wallet/core/template_validator.dart';
@@ -144,6 +145,13 @@ abstract class SendViewModelBase with Store {
145
void setTransactionPriority(TransactionPriority priority) =>
146
_settingsStore.transactionPriority = priority;
147
148
+ Future<OpenaliasRecord> decodeOpenaliasRecord(String name) async {
149
+ final record = await OpenaliasRecord
150
+ .fetchAddressAndName(OpenaliasRecord.formatDomainName(name));
151
+
152
+ return record.name != name ? record : null;
153
+ }
154
+
155
@action
156
void _updateFiatAmount() {
157
try {