CWA-209 | added possibility to show address of subaddress instead empty label; added possibility to edit label of subaddress; added setLabel method to subaddress creation store; fixed setLabelSubaddress method in the subaddress_list.dart

This commit is contained in:
Oleksandr Sobol
2020-05-11 21:00:43 +03:00
parent 4b5a2f8b06
commit 9193cb63f6
5 changed files with 79 additions and 12 deletions
@@ -27,6 +27,7 @@ abstract class SubadrressCreationStoreBase with Store {
walletService.onWalletChange.listen(_onWalletChanged);
}
@observable
SubaddressCreationState state;
@observable
@@ -70,6 +71,20 @@ abstract class SubadrressCreationStoreBase with Store {
}
}
Future<void> setLabel({int addressIndex, String label}) async {
try {
state = SubaddressIsCreating();
await _subaddressList.setLabelSubaddress(
accountIndex: _account.id,
addressIndex: addressIndex,
label: label
);
state = SubaddressCreatedSuccessfully();
} catch (e) {
state = SubaddressCreationFailure(error: e.toString());
}
}
Future<void> _onWalletChanged(Wallet wallet) async {
if (wallet is MoneroWallet) {
_account = wallet.account;