Merge pull request #57 from cake-tech/CWA-209-rework-receive-screen

Cwa 209 rework receive screen
This commit is contained in:
Oleksandr Sobol
2020-05-12 16:19:20 +03:00
committed by GitHub
35 changed files with 809 additions and 372 deletions
@@ -16,6 +16,7 @@ abstract class AcountListStoreBase with Store {
AcountListStoreBase({@required WalletService walletService}) {
accounts = [];
isAccountCreating = false;
isDisabledStatus = true;
if (walletService.currentWallet != null) {
_onWalletChanged(walletService.currentWallet);
@@ -37,10 +38,18 @@ abstract class AcountListStoreBase with Store {
@observable
bool isAccountCreating;
@observable
bool isDisabledStatus;
AccountList _accountList;
StreamSubscription<Wallet> _onWalletChangeSubscription;
StreamSubscription<List<Account>> _onAccountsChangeSubscription;
@action
void setDisabledStatus(bool isDisabled) {
isDisabledStatus = isDisabled;
}
@override
void dispose() {
_onWalletChangeSubscription.cancel();
@@ -17,6 +17,7 @@ class SubadrressCreationStore = SubadrressCreationStoreBase
abstract class SubadrressCreationStoreBase with Store {
SubadrressCreationStoreBase({@required WalletService walletService}) {
state = SubaddressCreationStateInitial();
isDisabledStatus = true;
if (walletService.currentWallet != null) {
_onWalletChanged(walletService.currentWallet);
@@ -26,6 +27,7 @@ abstract class SubadrressCreationStoreBase with Store {
walletService.onWalletChange.listen(_onWalletChanged);
}
@observable
SubaddressCreationState state;
@observable
@@ -34,11 +36,19 @@ abstract class SubadrressCreationStoreBase with Store {
@observable
String errorMessage;
@observable
bool isDisabledStatus;
SubaddressList _subaddressList;
StreamSubscription<Wallet> _onWalletChangeSubscription;
StreamSubscription<Account> _onAccountChangeSubscription;
Account _account;
@action
void setDisabledStatus(bool isDisabled) {
isDisabledStatus = isDisabled;
}
@override
void dispose() {
_onWalletChangeSubscription.cancel();
@@ -61,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;